Tuesday, August 28, 2012

Fire and Text (1997)

I've always had a soft spot for 2D space-type shoot-em-ups, and I always wanted to write one.  I loved Raptor: Call of the Shadows and sort of looked to emulate it (minus the strange difficulty/upgrade path curve).

I wanted to display my shoot-em-up's intro text using a fire effect, with the flames themselves forming the letters of the text.  I tried a few different approaches and wound up settling a relatively simple scheme, where the frame buffer essentially holds the "temperature" of the fire at each pixel.  The palette is setup using a simple sequence of linear ramps of colours from yellow to red, then to black, dark drey, and black again.  This determines the colour of a fire "element" as its temperature decreases.

Every frame, the frame buffer is scrolled up by a pixel, and the color value of each pixel is decremented; this simulates the temperature decrease as the fire rises from the bottom of the screen.  A random series of 4x4 pixels clusters on the screen is selected, and the color value for each pixel in the cluster is incremented.  A second random series of 5x5 clusters is selected, and the color value for each pixel in the cluster is decremented.  Lastly, as text scrolls through the bottom-most 16 lines of the fire, the text is magnified and frame buffer is incremented everywhere a pixel is non-transparent in the source font.

No comments:

Post a Comment