Command & Conquer: Red Alert Tileset Format

From ModdingWiki
Jump to navigation Jump to search
Command & Conquer: Red Alert Tileset Format
Command & Conquer- Red Alert Tileset Format.png
Format typeTileset
HardwareVGA
Max tile count254
PaletteShared between all tilesets in one theater
Tile names?No
Minimum tile size (pixels)24×24
Maximum tile size (pixels)24×24
Plane count1
Plane arrangementLinear
Transparent pixels?No
Hitmap pixels?No
Metadata?Land Types
Supports sub-tilesets?No
Compressed tiles?No
Hidden data?Yes
Games

The Command & Conquer: Red Alert Tileset Format is an uncompressed tileset containing tiles with dimensions of 24×24. Technically, this tile size can be changed, but the game defines cells as 24×24 pixels, so changing it does not seem useful. Tiles inside this file are referred to as "icons".

As with the first game, a single "tileset" does not represent the tiles of an entire map environment, but only the tiles used to build up a single piece of terrain. For more information on that, see the Command & Conquer Tileset Format page.

This file type is a later version of the aforementioned C&C Tileset Format. Unlike its predecessor, it contains all information required to handle the tileset, without needing any hardcoded data from the game itself to function. This means that it contains the full tileset's X and Y dimensions in number of icons, and defines the land types of all individual icons that determine buildability and passability.

File format

Header

The header definition, called IControl_Type in the source code, can be found in the WIN32LIB code of Red Alert, in TILE.H. The header is 0x28 bytes long.

Offset Data type Name Description
0x00 INT16LE Width Width of icons (pixels). Should always be 24.
0x02 INT16LE Height Height of icons (pixels). Should always be 24.
0x04 INT16LE Count Number of icons. While this is an Int16 value, the game's map format can only access icons up to index 255. Since icons can be marked as empty, this value can differ from the number of actual images stored inside the file.
0x06 INT16LE Allocated Used by the game to indicate whether this tileset was allocated. In the file, it's always zero.
0x08 INT16LE MapWidth Width of map (in icons).
0x0A INT16LE MapHeight Height of map (in icons).
0x0C INT32LE Size Size of the entire file.
0x10 INT32LE Icons Offset from file start to icon data.
0x14 INT32LE Palettes Offset from file start to palette data. Obsolete leftover from Dune II; always empty.
0x18 INT32LE Remaps Offset from file start to remap index data. Obsolete leftover from Dune II; always seems to be 0x0D1AFFFF.
0x1C UINT32LE TransFlag Offset from file start for transparency flag table. This is an array containing one byte for each actual image in the file. Obsolete leftover from Dune II; all entries in the table are just 0x00.
0x20 UINT32LE ColorMap Offset from file start for colour control value table. The length of this array is always MapWidth×MapHeight. The values in this table can be mapped to the land types in the game that determine land properties such as speed and passability by different movement types, and whether the land can be built on.
0x24 UINT32LE Map Offset from file start for icon map offset. This is an index linking each icon index to the index of an actual image in the Icons array. This index is a UINT8[Count]. Value 0xFF in the index indicates an empty icon.

Generally, the order of the data after the index is:

  1. Icons
  2. Map
  3. TransFlag
  4. ColorMap

Of course, since these are read from header values, their order has no real effect.

1×1-Multiple Tilesets

The game has a special type of tilesets that identify themselves to have a MapWidth and MapHeight of 1, but which have a Count that is larger than 1. In this case, the different icons inside the file are not pieces of one larger shape, but are all alternates of the same 1×1 icon. This type is used for the game's Clear terrain, and for several tileset files in the Interior theater.

Because they represent only a single icon, the ColorMap of this type will only contain one single value. Note that in these 1×1-multiple sets, the ColorMap will contain value 0 instead of value 3 for indicating clear terrain.

Image Data

Since the tileset can contain empty entries, the actual amount of images following the Icons location should be determined by taking the maximum value (excluding any 0xFF values indicating empty icons) in the the array at Map, and adding 1 to it. As with the C&C1 variant, identical images are generally saved only once, with the data referenced in the index multiple times.

The image data is located at Icons. To look up the image data of a specific icon N, first check in the array at Map what the image index of the icon is. If it is not 0xFF, the image data can be found at:

iconImageStart = Icons + (Width * Height * fileData[Map + N])

The image data will always be 24*24 bytes, and represents a simple 8-bit indexed image.

Land Types

At the ColorMap index, a list of values will be given that determine the LandType of each icon. According to the description in the RA code, these are simply a set of extra colors set in the original art files as metadata, used to indicate the types. They seem to match the standard Westwood EGA palette that is found at the start of all 6-bit palettes used before Tiberian Sun.

This is the full mapping of all colours. The values indicated in bold are the ones that are actually used in tilesets.

Value Land Type Colour Description
00 LAND_CLEAR Black Filler value used for empty entries (0xFF in the Map array). On 1×1 sets with multiple icons, Clear terrain is always indicated using this value instead of the normal clear terrain indicator.
01 LAND_CLEAR Purple Unused.
02 LAND_CLEAR Teal Unused.
03 LAND_CLEAR Green Normal clear terrain.
04 LAND_CLEAR Lime Unused.
05 LAND_CLEAR Yellow Unused.
06 LAND_BEACH Light Red Sandy beach. Can't be built on.
07 LAND_CLEAR Brown Unused.
08 LAND_ROCK Red Impassable terrain.
09 LAND_ROAD Cyan Units move faster on this terrain.
10 LAND_WATER Light Blue Ships can travel over this.
11 LAND_RIVER Dark Blue Ships can't travel over this.
12 LAND_CLEAR Black Unused.
13 LAND_CLEAR Dark grey Unused.
14 LAND_ROUGH Light grey Rough terrain. Can't be built on.
15 LAND_CLEAR White Unused.


Tools

The following tools are able to work with files in this format.

Name PlatformView images in this format? Convert/export to another file/format? Import from another file/format? Access hidden data? Edit metadata? Notes
Engie File Converter WindowsYesYesYesNoYes Shows the Land Types for all icons, and allows setting them when saving.
XCC Mixer WindowsYesYesNoNoNo Can visualise the files and convert them to standard image formats.
RAMix DOSYesYesNoNoNo Contains the RMT2PCX.EXE and PCX2RMT.EXE command line tools to convert the format, but has no support for customising the Land Types. In tiles converted with PCX2RMT, the ColorMap array will correctly have type 0 to indicate empty tiles, but all others are simply set to type "Road" (value 9).
RTMType (Red Alert Template File Terrain Type Editing Tool) WindowsNoNoNoNoYes Command line tool. Can set the Land Types for template tiles, including support for the special 1×1-multiple type. The land types can be given as text, or can simply be imported from another template file.