Command & Conquer Tileset Format
The Command & Conquer Tileset Format is an uncompressed tileset containing tiles with dimensions of 24x24. Technically, this tile size can be changed, but the game defines cells as 24x24, so changing it does not seem useful.
A single Command & Conquer "tileset" does not represent an entire map environment; it only contains the terrain tiles of a single piece of terrain. The full collection of tileset files that comprise one map environment are called a "Theater", and are combined into one .mix archive together with its colour palette and the theater-dependent terrain objects, civilian buildings, and fading table files.
|0x00||UINT16LE||TileWidth||Tile width. Should always be 24.|
|0x02||UINT16LE||TileHeight||Tile height. Should always be 24.|
|0x04||UINT16LE||NrOfTiles||Number of tiles. While this is an Int16 value, the game's map format can only access tiles up to index 255. Since tiles can be marked as empty, this value can differ from the number of actual images stored inside the file.|
|0x08||UINT32LE||Size||Size of the entire file.|
|0x0C||UINT32LE||ImgStart||Offset of the first image.|
|0x18||UINT32LE||IndexImagesInfo||Offset of the images info array; an array containing one byte for each actual image in the file. It is unknown what these bytes mean; they are usually all just 0x00.|
|0x18||UINT32LE||IndexTilesetImages||Offset of the index linking each tile to the index of an actual image at |
Generally, the order of the data after the index is:
Of course, since these are read from header values, their order has no real effect.
Note that there is no way to know the dimensions (Width and Height) of the full tileset. If there are 6 tiles it could be 6x1, 1x6, 3x2, or 2x3. The game doesn't actually need this information either, since the maps reference the individual tile indices inside the tileset files directly; the only tools that would actually need this information (besides image converters) are map editors.
The game's exe file does contain the dimension information of all tilesets, though, alongside the tilesets' other information, because the map editor used to be built into the game engine, and because the
[Template] section in a mission file supports placing terrain tilesets from a mission file. This tileset information is available in the tilesets.ini file in Nyerguds' ini dump of the game's internal data. The Engie File Converter uses this ini file to determine the dimensions of C&C tileset files based on their file name.
Since the tileset can contain empty entries, the actual amount of images following the
ImgStart location should be determined by taking the maximum value (excluding any 255 values indicating empty tiles) in the the array at
IndexTilesetImages, and adding 1 to it. Note that like in the game's fonts, identical images are generally saved only once, with the data referenced in the index multiple times, which further reduces the actual amount of images.
The image data is located at
ImgStart. To look up the image data of a specific tile N, first check in the array at
IndexTilesetImages what the image index of the tile is. If it is not 0xFF, the image data can be found at:
tileImageStart = ImgStart + (TileWidth * TileHeight * fileData[IndexTilesetImages + N])
The image data will always be 24x24 bytes, and represents a simple 8-bit indexed image.
The following tools are able to work with files in this format.
|Name||Platform||View images in this format?||Convert/export to another file/format?||Import from another file/format?||Access hidden data?||Edit metadata?||Notes|
|Engie File Converter||Windows||Yes||Yes||Yes||No||N/A||Uses internal mapping based on the file name to show the tile in its correct dimensions. Automatically saves tiles containing nothing but colour 0x00 as empty tiles.|
|XCC Mixer||Windows||Yes||Yes||No||No||N/A||Does not attempt to show the actual shape of the tileset, and just shows a list of tiles.|
|Mix Manager||DOS||Yes||Yes||Yes||No||N/A||Conversion suite containing PCX2TMP and TMP2PCX tools for converting the tileset files.|
|RAMix||DOS||Yes||Yes||No||No||N/A||Contains a TMP2PCX tool that can visualize the tileset file to adjust dimensions before converting to PCX. Does not contain a tool to convert back; you just have to use the one from Mix Manager.|