IsoMapPack5: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{WrongTitle|[IsoMapPack5]}} | {{WrongTitle|[IsoMapPack5]}} | ||
{{MappingBar}} | {{MappingBar}} | ||
This section contains the data that is used to create terrain to play on, meaning information about tiles. The tiles are located in <game.mix>/iso<theater>.mix/*.<theater extension>, for Red Alert 2 temperate for example, in ra2.mix/isotemp.mix/*.tmp. Information about these tiles are found in its theater's terrain INI files like temperat.ini or snow.ini. | This section in maps contains the data that is used to create terrain to play on, meaning information about tiles. The tiles are located in <game.mix>/iso<theater>.mix/*.<theater extension>, for Red Alert 2 temperate for example, in ra2.mix/isotemp.mix/*.tmp. Information about these tiles are found in its theater's terrain INI files like temperat.ini or snow.ini. | ||
The data is encoded using base64 and chunked LZO (miniLZO) compression. Decompression process looks like this: | The data is encoded using base64 and chunked LZO (miniLZO) compression. Decompression process looks like this: | ||
Line 16: | Line 16: | ||
struct IsoMapPack5Tile { | struct IsoMapPack5Tile { | ||
__int16 X, Y; | __int16 X, Y; | ||
__int32 | __int32 TileIndex; | ||
byte | byte TileSubIndex; | ||
byte Level; | byte Level; | ||
byte IceGrowth; | byte IceGrowth; | ||
Line 23: | Line 23: | ||
*The X and Y coordinates are cell coordinates in the map which depends on Size in Map section. Number of cells in a map is computed by | *The X and Y coordinates are cell coordinates in the map which depends on Size in Map section. Number of cells in a map is computed by | ||
Number of cells = ((MapWidth * 2) - 1) * MapHeight | Number of cells = ((MapWidth * 2) - 1) * MapHeight | ||
* | *TileIndex refers to the index of the Tile that should be used for this cell - the first TMP in the first tileset for this theater is index 0, the next Tile is at index 1 and so on. Tile index 0xFFFF (65535) is same as index 0. | ||
* | *TileSubIndex refers to the sub-index of the tile to use for this cell as a tile could span over multiple cells. | ||
*IceGrowth being set to 1 is used in TS Snow maps only. When set to 0, ice growth is not allowed on that tile, even if the tiles are of ice/water. When set to 1 (or above 0), that tile allows ice growth. This is usually set on the ice tiles (where growth feature is needed) so that ice can regrow and also in the surrounding water tiles where ice is supposed to expand. | *IceGrowth being set to 1 is used in TS Snow maps only. When set to 0, ice growth is not allowed on that tile, even if the tiles are of ice/water. When set to 1 (or above 0), that tile allows ice growth. This is usually set on the ice tiles (where growth feature is needed) so that ice can regrow and also in the surrounding water tiles where ice is supposed to expand. | ||
A map without IsoMapPack5 section is a blank terrain flat map, it doesn't have tile information (like cliffs or water) for cells. When game doesn't find the tile information, it fills those cells with height level 0 clear tiles (clear tiles have TileIndex as 0, defined in terrain INI files as ClearTile = 0). | A map without IsoMapPack5 section is a blank terrain or flat map, it doesn't have tile information (like cliffs or water) for cells. When game doesn't find the tile information, it fills those cells with height level 0 clear tiles (clear tiles have TileIndex as 0, defined in terrain INI files as first tile in first tileset with ClearTile = 0). | ||
IsoMapPack5 section can be compressed by removing those height level 0 clear tiles as the game fills them up. Typically, removing the height level 0 clear tiles and then sorting the tiles first by X then by Level and then by TileIndex gives good compression. | IsoMapPack5 section can be compressed by removing those height level 0 clear tiles as the game fills them up. Typically, removing the height level 0 clear tiles and then sorting the tiles first by X then by Level and then by TileIndex gives good compression. | ||
Line 34: | Line 34: | ||
=== External Links === | === External Links === | ||
* LZO compression: http://www.oberhumer.com/opensource/lzo/ | * LZO compression: http://www.oberhumer.com/opensource/lzo/ | ||
See also [[OverlayPack]] | |||
[[Category:Map_Information]] | [[Category:Map_Information]] |
Revision as of 09:08, 26 May 2018
This section in maps contains the data that is used to create terrain to play on, meaning information about tiles. The tiles are located in <game.mix>/iso<theater>.mix/*.<theater extension>, for Red Alert 2 temperate for example, in ra2.mix/isotemp.mix/*.tmp. Information about these tiles are found in its theater's terrain INI files like temperat.ini or snow.ini.
The data is encoded using base64 and chunked LZO (miniLZO) compression. Decompression process looks like this:
- Combine all the values in this section into one long string.
- Base64-decode it into a byte array.
- Read two bytes from this array into an unsigned int16 value - call this InputSize.
- Read two bytes into an unsigned int16 value - call this OutputSize. This will typically be 8192 for all except the last pass.
- Read InputSize bytes into a buffer.
- Use lzo1x_decompress to decompress this buffer.
- It should decompress into OutputSize bytes.
- Repeat steps 3-7 until the whole array from step 2 has been read, combining all the decompressed bytes into one long array.
This resulting array will contain a list of tile declarations. Each declaration takes up 11 bytes:
struct IsoMapPack5Tile { __int16 X, Y; __int32 TileIndex; byte TileSubIndex; byte Level; byte IceGrowth; }
- The X and Y coordinates are cell coordinates in the map which depends on Size in Map section. Number of cells in a map is computed by
Number of cells = ((MapWidth * 2) - 1) * MapHeight
- TileIndex refers to the index of the Tile that should be used for this cell - the first TMP in the first tileset for this theater is index 0, the next Tile is at index 1 and so on. Tile index 0xFFFF (65535) is same as index 0.
- TileSubIndex refers to the sub-index of the tile to use for this cell as a tile could span over multiple cells.
- IceGrowth being set to 1 is used in TS Snow maps only. When set to 0, ice growth is not allowed on that tile, even if the tiles are of ice/water. When set to 1 (or above 0), that tile allows ice growth. This is usually set on the ice tiles (where growth feature is needed) so that ice can regrow and also in the surrounding water tiles where ice is supposed to expand.
A map without IsoMapPack5 section is a blank terrain or flat map, it doesn't have tile information (like cliffs or water) for cells. When game doesn't find the tile information, it fills those cells with height level 0 clear tiles (clear tiles have TileIndex as 0, defined in terrain INI files as first tile in first tileset with ClearTile = 0).
IsoMapPack5 section can be compressed by removing those height level 0 clear tiles as the game fills them up. Typically, removing the height level 0 clear tiles and then sorting the tiles first by X then by Level and then by TileIndex gives good compression.
External Links
- LZO compression: http://www.oberhumer.com/opensource/lzo/
See also OverlayPack