Command & Conquer Mission Format
The Command & Conquer mission format is comprised of two files; a binary file containing the raw indestructible terrain, and a .ini file describing everything that should be put on that terrain, as well as the mission's scripting.
Command & Conquer missions always have a size of 64×64 cells, but the ini file determines which area of that map will actually be accessible in the game. The outer border should never be used, because it is where aircraft get stuck when leaving the map after doing deliveries, air strikes or evacuations. This leaves the map with a 62x62 cell usable area.
The outer edge is not completely useless, though: the cells immediately outside the ini-defined accessible area can be filled with impassable terrain with gaps to control exactly where ground-based reinforcements can enter the map.
In Command & Conquer: Sole Survivor, maps have a size of 128x128, but they retain the outer border requirement.
The raw indestructible map terrain, stored in a binary file with extension .bin, is a simple array of 64*64 cells, each cell being a struct of the following two bytes:
|0x00||UINT8||TilesetID||ID of the tileset file to use for this cell.|
|0x01||UINT8||TilesetCell||Specific cell number inside the tileset file to use for this cell.|
This array is interpreted like most image formats; wrapping around at a width of 64. The mission file works with a system of cell numbers, which are simply the indices of the cells in that full array.
The full range of
TilesetID values can be looked up in the tilesets.ini file in Nyerguds' ini dump of the game's internal data. The value 0xFF is reserved for clear terrain. This is automatically tiled over the map in 4x4 cell blocks.
TileSetCell refers directly to the cell number inside the tileset file, without any checks from the game, meaning additional tiles can be added to maps simply by providing a modded tileset file with added tiles, and by editing the map to access those extra tiles. Any such added tiles will use that tileset's primary terrain type, though.
This format is the same on all ports of the game, except for the Nintendo 64.
In the Nintendo 64 version
The Nintendo 64 version uses the .map extension for its terrain maps, because the .bin extension is already used for its music files.
The map format in the Nintendo 64 version looks superficially the same, but it does not work with tilesets at all; the two bytes inside a cell are simply taken together as a single UINT16LE value, forming a single graphics tile's ID. Unlike the PC theaters, which share a lot of tilesets between theaters, these IDs are completely different between Temperate and Desert theater.
The Engie File Converter contains the mappings required to convert maps between the two formats, though the N64 version of the game does not contain the full tilesets range the PC version has.
In Sole Survivor
Command & Conquer: Sole Survivor, the arena deathmatch spinoff of C&C, introduces a new terrain map format with a basic size of 128x128. The use of this map format is indicated in the .ini file by setting "Version=1" under the [Map] section. The extension is still .bin, just like in the original game.
The map format differs from the normal maps in that it is a variable-size array that only saves tiles that are not clear terrain. To still position everything correctly, each tile starts with its cell number, giving the following 4-byte structure:
|0x00||UINT16LE||CellNumber||Cell number of the saved cell.|
|0x02||UINT8||TilesetID||ID of the tileset file to use for this cell.|
|0x03||UINT8||TilesetCell||Specific cell number inside the tileset file to use for this cell.|
This format has gained some popularity after being included in some fan projects and C&C: Remastered mods based on the released Command & Conquer source code, which add the ability to use this larger map format in the basic Command & Conquer game. More interest also came with the successful reverse-engineering of the Sole Survivor server software, which made Sole Survivor playable in multiplayer mode again.
The ini file determines which theater (tilesets collection) will be used for the map, what objects are pre-placed on the map, and what mission scripting should happen. It is identical on all ports of the game.
The ini file uses a typical ini format like this:
[Section] Key1=value Key2=value Key3=value
Keys must always be unique, even in situations where the key has no real meaning, like the lists of units, structures and infantry. Usually, in these lists, each item is simply assigned a number as key.
Values are often comma-separated blocks that contain specifically-structured data for the different initialization options of things like units, structures, teams and script triggers.
Section names and keys are technically case-insensitive, but for keys, due to the way the game scans for them, their first letter needs to match the case in which they are stored in the game's internals. Since C&C's keys are all stored in Pascal-style camel case, this means they always need to start with a capital letter. The file needs to end on a line break, otherwise the game will not be able to read the last line of the file.
The full format is very extensive, so I'll only go over the basics. A lot of this information can be derived from just looking into mission files, and mission making guides like this one are available online.
The [Basic] section
This is all about the mission itself. Here, you can change which side you play, what videos you see, and some other stuff. It has the following options:
- CarryOverCap: A cap on the amount of money that can be carried over. Never enabled by the game, and always set to '-1'.
- CarryOverMoney: Specifies how much money from your ending credits in the previous mission will be carried over to this one, as percentage.
- Intro: Intro video of the mission, played before the Brief and Action video. File name is the name of a .VQA video file, without extension.
- BuildLevel: Build level used in the mission. In the campaigns, this defaults to the campaign mission number, however, it needs to be set for add-on missions in the New Missions menu.
- Theme: Start theme of the mission, either as filename or as actual track title. 'No theme' reverts to the default music behaviour.
- Percent: Unused leftover of Dune II, even though the option was never used there, either. In Dune II it determined how much of the enemy base was built from the start of the mission.
- Player: Normally 'GoodGuy' (GDI) or 'BadGuy' (Nod). Could use one of the other houses (Neutral, Special, Multi1-Multi6), but this is not advised since it makes the game lock up in the mission win logic.
- Action: Video played between the Brief video and the mission start.
- Lose: Video played when you lose.
- Win: Video played when you win.
- Brief: The briefing video.
- Name: Mission name. This should be present for missions in the New Missions menu of the game, but is unused for campaign missions.
The unofficial 1.06 patch for the game made a few changes to the behaviour of this section:
- It removed the forced link of BuildLevel to the campaign level number, allowing campaign missions to freely adapt their tech level.
- It solved a lot of problems related to using non-standard values for the
Playersetting; missions played with those will generally return to the game's main menu after completing them.
- It fixed a problem that occurred when both an Intro video and a Theme were set, which made the game play the music and video simultaneously.
- It added a bunch of new options that unlock either hidden beta options, or special behaviour that was previously hardcoded for specific missions.
The [Map] section
This determines which terrain set will be used, and which portion of the map will actually be playable. As mentioned before, the full map is 64x64 (or 128x128 for megamaps), but the outer border can't be used, meaning
Y both have a minimum of 1, and
X + Width and
Y + Height should both be at most 63.
- Width: Width of the map.
- Height: Height of the map.
- X: horizontal position of left corner of map.
- Y: vertical position of left corner of map.
- Theater: graphics set: WINTER, DESERT, TEMPERATE.
- Version: introduced in Sole Survivor, this is put to "1" to indicate 128x128 megamap format.
The theater determines which tileset files will be loaded to show the map. For example, TEMPERATE will load the TEMPERAT.MIX archive, and from it, it will load the TEMPERAT.PAL palette, and the tileset files with the .TEM extension.
The 1.06 patch adds an additional "SNOW" theater to is, based on graphics from Command & Conquer: Red Alert.
The [Briefing] section
This section can be used to give a mission briefing to the mission. While normal missions read this from an entry named like the mission file (e.g. [SCB01EA]) in the MISSION.INI file, this in-mission version will always override that external one, and is required for the missions in the "New Mission" menu which fall outside the scope of the normal campaign missions.
The format is simply
[Briefing] 1=GDI has attacked and cut off one of our bases. Find a way into 2=the base. One of our agents will assist you by placing a landing 3=flare at the right time. Once you're in, 4=rebuild the base and destroy the GDI forces in the area.
Note that line breaks in this are ignored; the text is always read as one long string and simply wrapped inside the briefing window in the game.
The 1.06 patch adds the ability to force line breaks by ending a line on ##. It also adds the ability to add language-specific briefings as different sections, like [BriefGer] and [BriefFre]. The names of these sections are controlled by the language control ini files also added by the unofficial patch.
The House sections
The game has 10 different "Houses" (a term left over from Dune II, and borrowed from the Dune books), or, simply put, player sides. Each of these can be used in the game, and can have settings related to their alliances and starting conditions.
- The section name itself will have one of the House names:
- [GoodGuy]: GDI
- [BadGuy]: Nod
- [Neutral]: Civilians
- [Special]: Dinosaurs, in the game's Jurassic Park themed Easter egg campaign (Internally designated as "Containment Team", but in reality used as the dinosaurs themselves)
- [Multi1]: Blue multiplayer team
- [Multi2]: Orange multiplayer team
- [Multi3]: Green multiplayer team
- [Multi4]: White multiplayer team
- [Multi5]: Yellow multiplayer team
- [Multi6]: Red multiplayer team
- FlagHome: Unused.
- FlagLocation: Unused.
- MaxBuilding: Unused. Leftover from Dune II.
- MaxUnit: Unused. Leftover from Dune II.
- Allies: Comma-separated list of all the Houses that this House will not attack. Alliances are not automatically mutual, so to prevent odd situations, also set this house in the list of their allies.
- Quota: Unused. Leftover from Dune II, where it was related to missions where the goal was to harvest until a certain amount of money was gained.
- Edge: Reinforcements for this house will come from this direction (North, East, South or West)
- Credits: number of credits they start with divided by 100 (so 10 means 1000)
The houses Special and Multi1-Multi6 do not have tech tree limitations when used in single player, meaning they can build all stuff from both GDI and Nod. The multiplayer mechanics of the game have a way of making the multiplayer houses conform to the player-chosen side. The Neutral house, on the other hand, has barely any construction options at all.
The unofficial 1.06 patch gives this section additional options to control the house's colours.
Ownerless objects sections
[Smudge] sections contain all ownerless objects on the map. Terrain consists of trees and rocks; overlay are walls, collectable crates, Tiberium, and a couple of unused pavement types; and Smudge has scorch marks, craters, and the building bibs.
Each object will be placed on the map based on a cell number indicating the top left corner of the object. This is true even if that cell of the object is passable, like the tops of trees sticking out. As mentioned in the terrain file section, cell numbers are simply the index of the terrain cell as seen in the map data; it wraps around at 64 cells.
The number behind the Smudge entry can be used to change the state of craters; a larger number (up to 4) shows a larger crater.
Terrain entries contain a trigger name, but the only event that can be triggered by Terrain objects is the "Attacked" one. This only works on destructible Terrain objects, like trees.
[TERRAIN] 1107=ROCK1,None [OVERLAY] 1406=SBAG [SMUDGE] 3816=SC1,3816,0
Owned objects sections
[Infantry] sections contain objects owned by Houses. Like with the ownerless objects, each one has a position defined by the cell number indicating the top left corner of the object. They will also have the unit's action, a health value ranging from 0 to 256 (the latter meaning 100%), the direction in which it is facing, and a trigger associated to the object for scripting purposes. Infantry will also have a sub-cell position, since five infantry units fit on each cell.
The facing direction is usually not useful for buildings, but does actually work on gun turrets.
[Structures] 002=BadGuy,GUN,256,3566,160,None [Units] 000=BadGuy,BIKE,256,1231,0,Guard,None [Infantry] 046=GoodGuy,E2,256,3867,2,Area Guard,0,None
Mission scripting, including but not limited to the AI's ability to react on events, is determined by the sections
- Triggers are actual scripted events. They are triggered by a cause, which can range from a certain area being reached by units from a certain house, to specific pre-placed units or structures being destroyed, damaged or discovered, to even a fixed timer. Triggers can be set to either activate once, repeat every time the cause is triggered, or only activate once every object linked to the trigger has been triggered.
- CellTriggers are a list of cell numbers and a trigger linked to each one. The linked triggers should have the activation criterion Player Enters.
- Teamtypes are definitions of groups of units and the path they take on the map. These are used for enemy attacks and patrols, but also for friendly reinforcements.
- Waypoints are shortcuts to cell numbers on the map, used by the TeamTypes section. They contain some special values, like the location of the signal flare that can be activated by the trigger action DZ at 'Z' (#25), the top-left corner of the viewed location at the start of a mission (#26) and the default dropoff location for reinforcements (#27).
The [Base] section
The [Base] section contains a list of all buildings that should be (re)built by the AI, in the order of build priority. This list can contain buildings that do not appear on the map. The AI will only start building structures from this list once its 'Production' trigger is activated.
The Base section must always contain a "Count" key to indicate how many items it should read from the list.
[Base] 004=NUKE,436215040 003=HAND,436213760 002=SILO,436216064 001=SILO,436215552 000=PROC,469769984 Count=5
- The key is always a three-digit number. It acts as priority number; 000 will be rebuilt first, then 001, then 002, etc.
- The first argument in the comma-separated value is the building type code. This is the same as the codes used in the [Structures] section.
- The second argument in the comma-separated value is calculated from the coordinates, and is a lot more clear when seen as hexadecimal. 436213760 is 1A001800, and the two immediately visible values in there, namely 1A and 18, are the Y and X values of the building's location. So the actual saved value in the ini file is 0x1000000*Y + 0x100*X (or, in decimal, 16777216*Y + 256*X). The actual coordinates in the example would be Y=26 and X=24, making the cell number
64*Y + X = 1688. The fact the values both appear as multiples of 0x100 is because they are actually saved as leptons, the game's more precise internal measurement unit which equates to 1/256th of the size (width or height) of a cell.
Note that the value does not contain an owner for the building, which leads to problems when multiple Production-enabled AIs with construction yards are on the map. They will compete over the available spots, and will send troops to remove enemy units or structures obstructing their build location.
Two other sections can be encountered in the missions. While they do work, their use is generally not advised:
[Reinforcements]: used to control hovercraft reinforcements. Anything this does should be possible in a more controlled way using triggers and teamtypes.
[Template]: allows placing tilesets directly on the map in a
CellNumber=TileSetName format, overriding whatever the map file had. This isn't very reliable since it can't use cell numbers that fall outside the used map, meaning it won't work well on the top and left map edges. Also, this always places an entire tileset piece, whereas the binary maps place them per single cell, allowing a lot more customisation.
Deactivated code for reading an [Aircraft] section, which functioned like the [Units] section, was discovered by people looking into the internals of the game, but even when reactivated, it didn't work correctly, spawning aircraft in the air and leaving impassable spots underneath. The use of this section was re-enabled in the C&C Remaster, but is pretty much as broken as it was in the original.
In Sole Survivor
The Sole Survivor map format remains largely the same as that in the base game. These changes exist:
- A [Crates] section is added which can be used to balance the different types of crate goodies that come out of crates, and has some more general settings determining the crate density and spawn rate. These settings can however be overridden by the server.
- The contents of the [Structures] section are not read. Earlier versions of the game did read this, however, and civilian buildings remain on some maps as decoration, though the final version of the game does not read them.
- Crates are never read from the [Overlay] section in the ini file.
- The ROAD pavement in the [Overlay] section is used to place Teleporters on maps.
- Certain waypoints have special meanings. Waypoints 0 to 3 are points around which a larger concentration of crates will be spawned. The next eight waypoints, 4 to 11, act as eight possible team home location points for team-based game such as Capture The Flag.
- In addition to the existing houses, Sole Survivor contains House sections for [Admin], [Spectator], [Team 1], [Team 2], [Team 3] and [Team 4]. The [Multi#] Houses also go up to [Multi100].
Vehicles and infantry units can perfectly be placed on maps, though these can cause strange behaviour in the game, since each player can only control one single unit and any non-player units will act as AI hunters, actively seeking out crates to upgrade themselves and hunting down players. The game's scripting also seems to be largely intact in the game's binaries, though very little of that ever worked right in multiplayer anyway.
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|
|XCC Editor||Windows||Yes||Yes||No||No||No||Saves briefings on one line, and converts all data except the briefing text to upper case.|
|CCMap||Windows||Yes||No||No||No||No||Requires the terrain archives from the DOS version of the game to work.|
|Mobius Map Editor||Windows||Yes||Yes||No||No||No||Fork of the official C&C: Remastered map editor. Can create and edit 128x128 megamaps and the Sole Survivor format.|
|Engie File Converter||Windows||Yes||Yes||Yes||No||No||Terrain visualization and conversion only (between PC and N64 versions). Cannot edit missions.|