Command & Conquer Mission Format
Format type | Map/level |
---|---|
Map type | 2D cell-based |
Layer count | N/A (if object types are seen as a layers, at least 7) |
Viewport (pixels) | 240×192 (DOS) 320×192 (DOS, no sidebar) 480×384 (Win95) 640×384 (Win95, no sidebar) |
Cell dimensions | 64×64 (C&C) 128×128 (Sole Survivor) |
Viewport (cells) | 10×8 (DOS) 13.33×8 (DOS, no sidebar) 20×16 (Win95) 26.67×16 (Win95, no sidebar) |
Games |
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.
Terrain file
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:
Offset | Data type | Name | Description |
---|---|---|---|
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.
The 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. Additionally, it uses bytes "FF FF" for clear terrain, where the PC version normally uses "FF 00".
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:
Offset | Data type | Name | Description |
---|---|---|---|
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.
Ini file
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 Player setting; 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 X and 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
They can contain the following keys:
- 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
The [Terrain], [Overlay] and [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.
Examples:
[TERRAIN] ; Cell=Type,Trigger 1107=ROCK1,None [OVERLAY] ; Cell=Type 1406=SBAG [SMUDGE] ; Cell=Type,Cell,State 3816=SC1,3816,0
Owned objects sections
The [Structures], [Units] and [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 orders, a strength (health) value ranging from 1 to 256 (the latter meaning 100%), the direction in which it is facing (ranging from 0 to 255 for a full rotation), 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. These sub-cells are laid out like the five dots on a die, with 0 as the center, 1 for top-left, 2 for top-right, 3 for bottom-left and 4 for bottom-right.
The facing direction is usually not useful for buildings, but does actually work on Gun Turrets. In fact, units are limited to the values for cardinal and intercardinal directions (0 for north, 32 for northeast, 64 for east, etc.), while the Gun Turret can use more precise values.
Examples:
[Structures] ; index=House,Type,Strength,Cell,Facing,Trigger 002=BadGuy,GUN,256,3566,160,None [Units] ; index=House,Type,Strength,Cell,Facing,Orders,Trigger 000=BadGuy,BIKE,256,1231,0,Guard,None [Infantry] ; index=House,Type,Strength,Cell,SubCell,Orders,Facing,Trigger 046=GoodGuy,E2,256,3867,2,Area Guard,0,None
Note that the "index" can be anything; it simply needs to be a unique key for the ini system, and numbers are the easiest way to do that.
Scripting sections
Mission scripting, including but not limited to the AI's ability to react on events, is determined by the sections [Triggers], [CellTriggers], [TeamTypes] and [Waypoints].
- Triggers are actual scripted Actions, caused by an Event. There is a wide range of Events in the game, from a simple timer, to certain cells being walked on by units from a certain house, to specific pre-placed units or structures being destroyed, damaged or discovered. Actions include letting the player Win or Lose, making the AI send out units based on a TeamType definition, triggering a superweapon unlock or attack, revealing an area with a dropzone flare, and disabling another trigger. Triggers can be set to either activate once, repeat every time the Event is triggered, or only activate once the Event has been triggered on every object linked to the trigger. A full overview of all the game's Events and Actions can be found here.
- CellTriggers are a list of cell numbers and a trigger linked to each one. Triggers linked to CellTriggers should always have the activation criterion Player Enters.
- TeamTypes are definitions of groups of units and the orders they execute on the map, usually including a series of specific movement orders to go through to follow a path. These are used for enemy attacks and patrols, but also for friendly reinforcements. There are a bunch of extra options on them which were only recently revealed, with the release of the first official map editor, and its source code.
- 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' ('Z' meaning the 26th Waypoint, which is index #25), the top-left corner of the viewed location at the start of a mission (#26) and the default dropoff location for reinforcements (#27).
Examples:
[Triggers] ; Name=Event,Action,Count,House,TeamType,ExecutionType ; ExecutionType (internally referred to as a trigger's "Persistence") can be: ; 0: execute once, on first triggering ; 1: execute once after all linked objects are triggered ; 2: execute every time it is triggered atk4=Player Enters,Create Team,0,GoodGuy,nod3,0 [CellTriggers] ; Cell=Trigger 1319=atk4 [TeamTypes] ; Name=House,R,L,S,A,M,P,X,I,F,NrOfTypes,[Type:Amount,Type:Amount,...],NrOfOrders,[Order:Arg,Order:Arg,...],IsReinforcable,IsPrebuilt ; Options after House are IsRoundAbout, IsLearning, IsSuicide, IsAutocreate, IsMercenary, RecruitPriority, MaxAllowed, InitNum, Fear. nod3=BadGuy,1,0,0,0,0,15,0,0,0,2,E4:2,LTNK:1,4,Move:0,Move:1,Move:7,Move:8,0,0 [Waypoints] ; WayPointNr=Cell 8=2706 7=2263 1=1180 0=1000
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.
Example:
[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 number64*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.
Other sections
Two other sections can be encountered in the missions. While they might 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.
- Aircraft: Deactivated code for reading an [Aircraft] 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 section functions like the [Units] section, except it has no trigger at the end. 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. The only reliable way to make the unit land on the actual designated cell, thereby clearing the impassable spot, is to give them the "Unload" order. Note that while several missions feature Transport Helicopters 'placed' on the map for the player to capture, these are always flown in by mission scripts at the start of the mission.
Examples:
[REINFORCEMENTS] 1=GoodGuy,E1,Beach,0 [TEMPLATE] 3645=SH2 [Aircraft] 000=GoodGuy,ORCA,256,2960,160,Unload
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.
Tools
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. |