ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Difference between revisions of "IsoMapPack5"

From ModEnc
Jump to: navigation, search
(Updating)
(Updated with information from executable and testing.)
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, which for 99% are located in <game.mix>/iso<theater>.mix/*.<theater extension>, for Red Alert 2 temperate for example, in ra2.mix/isotemp.mix/*.tmp
+
This section contains the data that is used to create terrain to play on, meaning information about tiles, which for 99% are located in <game.mix>/iso<theater>.mix/*.<theater extension>, for Red Alert 2 temperate for example, in ra2.mix/isotemp.mix/*.tmp.
The data is compressed in LZO compression format, and 11-byte chunks of data represent which tile, which subtile, the x- and y-location and height to place in a cell.
+
 
 +
The data is encoded using base64 and chunked LZO 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 TileTypeIndex;
 +
    byte TileSubtypeIndex;
 +
    byte Level;
 +
    byte Unknown;
 +
  }
 +
 
 +
*The X and Y coordinates are given in cells.
 +
*TileTypeIndex refers to the index of the IsometricTileType that should be used for this cell - the first TMP in the first tileset for this theater is index 0, the next is index 1...
 +
*TileSubtypeIndex refers to the index of the tile in that TMP to actually use in this cell.
 +
 
  
 
Because of 3 always-zero values used in each of these 11 byte chunks, map storage isn't quite optimal. XCC Map Encoder greatly exploits this, to compress this section greatly.
 
Because of 3 always-zero values used in each of these 11 byte chunks, map storage isn't quite optimal. XCC Map Encoder greatly exploits this, to compress this section greatly.
  
 
It is often advised to delete this section for TS maps, because of filesize limitations, however all terrain data gets lost.
 
It is often advised to delete this section for TS maps, because of filesize limitations, however all terrain data gets lost.
 +
 +
=== External Links ===
 +
* LZO compression: http://www.oberhumer.com/opensource/lzo/
 +
 
[[Category:Map_Information]]
 
[[Category:Map_Information]]

Revision as of 21:01, 22 July 2011

This page should correctly be named "[IsoMapPack5]"; it is wrong due to technical restrictions.


This section contains the data that is used to create terrain to play on, meaning information about tiles, which for 99% are located in <game.mix>/iso<theater>.mix/*.<theater extension>, for Red Alert 2 temperate for example, in ra2.mix/isotemp.mix/*.tmp.

The data is encoded using base64 and chunked LZO compression. Decompression process looks like this:

  1. Combine all the values in this section into one long string.
  2. Base64-decode it into a byte array.
  3. Read two bytes from this array into an unsigned int16 value - call this InputSize.
  4. Read two bytes into an unsigned int16 value - call this OutputSize. This will typically be 8192 for all except the last pass.
  5. Read InputSize bytes into a buffer.
  6. Use lzo1x_decompress to decompress this buffer.
  7. It should decompress into OutputSize bytes.
  8. 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 TileTypeIndex;
   byte TileSubtypeIndex;
   byte Level;
   byte Unknown;
 }
  • The X and Y coordinates are given in cells.
  • TileTypeIndex refers to the index of the IsometricTileType that should be used for this cell - the first TMP in the first tileset for this theater is index 0, the next is index 1...
  • TileSubtypeIndex refers to the index of the tile in that TMP to actually use in this cell.


Because of 3 always-zero values used in each of these 11 byte chunks, map storage isn't quite optimal. XCC Map Encoder greatly exploits this, to compress this section greatly.

It is often advised to delete this section for TS maps, because of filesize limitations, however all terrain data gets lost.

External Links