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 64x64 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.
The terrain file 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.
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.
On the Nintendo '64 version
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 tilesets between theaters, these IDs are completely different between Temperate and Desert theater.
The C&C64 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.
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 case-insensitive, but need to start with a capital letter due to fact the game looks them up by their first letter in uppercase. 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: May be 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. Since no real limits have been observed in the amount that can be carried over, this may be a percentage rather than a fixed value.
- 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. The original game defaults this 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: Not sure about this one. Some say it is the Computer's intelligence. Generally left on "100".
- 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, but the outer border can't be used.
- Height: Height of the map (max 62)
- Width: Width of the map (max 62)
- X: horizontal position of left corner of map. Should be at least 1
- Y: vertical position of left corner of map. Should be at least 1
- Theater: graphics set: WINTER, DESERT, TEMPERATE.
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 and craters.
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.
Terrain entries appear to have a trigger name, but they don't seem to actually work. Similarly, the function of the number behind the Smudge entry is unknown.
[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 assiciated 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.
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.
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 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.|
|C&C64 File Converter||Windows||Yes||Yes||Yes||No||No||Terrain visualization and conversion only (between PC and N64 versions). Cannot edit missions.|