TCFH helicopters
Tech FXHaiku Kaiju ReviewDesktop WallpaperSend Us Your Screams!Monster Personality Quiz

Craters are formed when bombs explode, or when a large object, like a car or airplane, hits the ground. Uprooted trees leave small craters. Napalm or fiery explosions leave burn marks. Crushed people leave blood stains (but only if the game's Gore setting is enabled). Most monsters leave some sort of footprint, but it varies depending on the weight of the monster and the softness of the terrain. Really big monsters, like The Tin Behemoth and Newtrino, will leave footprints everywhere they go. Smaller monsters like the 52-Foot Woman will leave footprints only on grass and other soft ground.

We have about a dozen basic terrain types: grass, cement, roads, sidewalk, rocky ground, dirt, sand, scrub, etc., plus three basic depths of water. Terrain type affects a unit's rate of movement. For example, people run fastest on hard surfaces, like sidewalks, roads and cement, but slower over sand or rough dirt. Tracked vehicles, like tanks, are less affected by soft ground than wheeled vehicles. Monsters generally don't notice terrain changes, except the deep water areas. While some terrain scars are purely cosmetic (like bloodstains), footprints and craters affect the gameplay by changing the damaged tile's terrain type to "rocky" -- making it difficult for most units to pass through. Tanks have no problems, but cars and people may be blocked.

Robot stomps Walk in the park Newt footprints

One of the supplemental advantages of having completely unique bitmaps for each map tile (as opposed to the repeating tiles that many tile-based games use) is that I'm free to doodle on one tile bitmap without messing up all the others. A repeating tile would show the doodle everywhere that tile was used. This lets us do ground scarring: craters, bloodstains, footprints, etc. on the tile bitmaps. Rather than draw the craters and scars as an overlay on the map, which would reduce rendering performance (especially in a heavily damaged area), I actually draw the scar images onto the original map tiles. This takes a one-time performance hit of drawing to the tile bitmaps, but then drawing damaged and heavily cratered terrain is no different than drawing virginal terrain.

Tile image drawing uses a method I call "reverse drawing". I render the potentially-affected map tiles into a temporary 2D buffer. There can be as many as four tiles affected by any given scar since the scar can land on the edges of a tile. Rather than draw all the tiles as pixels into that buffer, I draw them as pointers back to the source pixels. This way I end up with a 2D array of pointers-to-pixels instead of just pixels. Then I render the scar image into that buffer, but alpha blend/place pixels based on the de-referenced pointer at each coordinate, affecting the original tile image. This takes care of overlapping tile edges, stacked tiles, and eliminates the math needed to calculate where any pixel lies in the source images or grabbing the tile images back from the temp buffer. It also eliminates the need to decompress then recompress the pixel buffer in the tile image format...the pixels of the tile image do not need to be converted to a flat 2D bitmap.

For recovering saved games, or reconstructing tile bitmaps that have been flushed from memory during runtime, each tile keeps a record of the scars drawn onto it and where (which is a lot less data than the bitmap image). Using that information, I can rebuild the scarring on a tile.

-- Lars


delicious popcorn© 2004 Octopus Motor
They Came From Hollywood is a registered trademark of Octopus Motor
red hot zeppelins