Saturday, January 14, 2012

Part Nine - Optimizations for the Princess

Let me tell you a thing about airplane coding. It's where I get things done. As soon as the plane has taken off and it's fine to use electronic devices again, I put on my headphones and start getting productive. Trying to cram as much work into a few hours allows me to work in a very focused manner.
That was also true on my flight to Barcelona. The stuff that I struggled with before was suddenly much clearer. I came up with a really good optimization for the redrawing of background graphics, which allowed the game to run at a much smoother frame rate.
Just before I went on the flight I added profiling code for the bitmap drawing routines. I needed to measure how much time is spent pushing pixels. Traditionally on the C64 this is achieved by changing the screen colors to visualize the raster time used by a function.

The initial measurement was quite sobering. It looked like this:

Drawing the flames, before optimization