Terrain graphics (TERRAIN.LBX subfile 0)
Posted: Mon Feb 27, 2006 1:35 am
The terrain graphics in TERRAIN.LBX aren't in the same graphics format as the rest of the MoM graphics. The format is much simpler.
TERRAIN.LBX subfile 0 has a 192 byte header on it - I've no idea what this is for so skip it.
Each terrain tile is then made up of
An 8 byte header
The image data
A 4 byte footer
The first byte of the header is the width - this is always 20. The second byte is the height - this is always 18. I've no idea what the remaining 6 bytes in the header or the 4 bytes in the footer are for.
The image data is therefore always 20 * 18 = 360 bytes long, so each image including the header and footer takes up 372 bytes. Each byte of image data is an index into the standard MoM palette (see code in post about standard graphics format for this palette). There are 1,761 images.
The LBX extractor program on the downloads page will extract all 1,761 images out as BMP files. It also creates a single BMP file TERRAIN_000.bmp containing all the tile images listed out and numbered.
After many hours of shuffling the tiles around into a logical sequence (shuffling around to group similar tilesets together), I ended up with this. FYI the pink numbers the bracket the grass/sea border tiles are animation numbers used within MoM IME, this is what gives the coastline that nice rippling effect :)
Implode.
TERRAIN.LBX subfile 0 has a 192 byte header on it - I've no idea what this is for so skip it.
Each terrain tile is then made up of
An 8 byte header
The image data
A 4 byte footer
The first byte of the header is the width - this is always 20. The second byte is the height - this is always 18. I've no idea what the remaining 6 bytes in the header or the 4 bytes in the footer are for.
The image data is therefore always 20 * 18 = 360 bytes long, so each image including the header and footer takes up 372 bytes. Each byte of image data is an index into the standard MoM palette (see code in post about standard graphics format for this palette). There are 1,761 images.
The LBX extractor program on the downloads page will extract all 1,761 images out as BMP files. It also creates a single BMP file TERRAIN_000.bmp containing all the tile images listed out and numbered.
After many hours of shuffling the tiles around into a logical sequence (shuffling around to group similar tilesets together), I ended up with this. FYI the pink numbers the bracket the grass/sea border tiles are animation numbers used within MoM IME, this is what gives the coastline that nice rippling effect :)
Implode.