Chapter 5 - July 31st, 2013

Let the coding begin!

In the last chapter, we defined the screen locations in memory and where the program code will reside. Another important area to be defined is where the game graphics will be stored. These are all the bits of graphics such as the player's character, the enemy objects, explosions and more.

After much thought, I've decided to allocate a total of 32K residing in the MMU blocks 14 to 17. This 32K will be divided into 2 blocks of 16K which is each made up of two 8K MMU blocks. They will be defined as: Blocks 14 and 15 will store the game graphics elements while blocks 16 and 17 will store the title heading graphic.

We now have enough defined to start some real code. Time to have some fun!

Most people would start by writing the game and then do the final touches such as title pages and high score screens. But I have always preferred to work linearly by writing the title page first since it is the first part that comes up, then the game and finally the high score page. It also gives me a chance to get some graphics up onto the screen and setup a few base routines which will be required for the actual game such as the code to initialise the hardware, screen clearing routines, text print routines and interrupt handling. By starting with the title page, I can test much of this code to ensure that they are working correctly. This will lead nicely into the game start code.

It also has a psychological effect in that once I have a nicely presented title page up and running, it gives me the inspiration to jump in to the real core of the game code with enthusiasm. Like having a healthy breakfast in the morning to give you the energy to tackle the day.

Designing the title page text

The first step is to define the title page heading text and for this I use my trusty Amiga computer running Brilliance. This program is not only very intuitive but it can also match the Color Computer 3's color and graphics resolution.

In designing the heading, I wanted something with a cartoony look that emphasizes the pop in the name Popstar. It also had to fit into the 16K space I allocated. After a few hours playing around with different ideas, I came up with the text shown on the right.

The graphics are stored uncompressed. I could incorporate compression so that it takes up less space but space isn't a problem yet so I figure that it is more convenient to keep it uncompressed in case I decide to change or touch it up later.  

Adding animation

I also wanted to include an animation effect to give the page some life so I decided to create a scrolling backdrop behind the text. I thought it would look cool if the background could move while the text stayed fixed in the foreground, mimicking a dual playfield effect so commonly seen on the Amiga.

The easiest and least resource hungry method was to use palette animation. This is a technique where simply changing the color palette values can give the effect of movement. I eventually came up with a simple checker board pattern. Utilizing a horizontal scanline hardware interrupt, I can keep track of which scanline the GIME chip is currently drawing and change palette values accordingly.

 

                     

 

By filling the screen with the striped pattern shown above (left) using color palette values 0 and 1 defined as a dark and bright blue, I can swap the values at fixed positions during the drawing of the screen to create the checker board pattern on the right.

If I then alter the starting point for the colors, I can make the pattern appear to scroll even though no data is being moved and the screen itself is actually remaining stationary. I can then add any additional graphics that will appear overlaid on top as long as I don't use palette colors 0 and 1.

Below is an animated GIF recreation of the finished title page. The actual code running on a real Color Computer 3 is silky smooth and fast. The last line of text has a glow effect also achieved by simply changing palette values. The screen resolution is 320x225x16.

 

    

                                 

Copyright 2013 by Nickolas Marentes