Edge grids

These are but one of the grids stored in the game files, but they are there in every game, and in all of them they serve the same purpose. So what are edge grids? I've called them that way because I use them to figure out whether a given tile of a multi-tile (2x2 or bigger) building is on the building's edge or not.

When you have a blank map, all bytes of this grid are set to 0x40 (64 decimal), basically indicating that the structure at that tile has a size of 1x1. When the building is bigger than that, the byte's value depends on which tile of the building is on that map tile.

The value of the tile can be calculated from the X and Y coordinates of the building: value = 8 * y + x. The only exception to this formula is the bottom left corner, for which you need to add 0x40 (64) to the total. An example of a 3x3 building surrounded by 1x1 buildings (or empty land): (all values are in hexadecimal)

40 40 40 40 40
40 00 01 02 40
40 08 09 0a 40
40 50 11 12 40
40 40 40 40 40

Last modified on 2007-11-14 17:55:56