TERRAIN
This folder contains the information used for tiles in the battlescape view, both statistical and graphical.
Each of the three files used for each tileset contains a variable amount of records. PCK files and their respective TAB files should always contain an equal amount of records.
MCD
General Information
- MCD stands for Map Control Data.
- MCD files have a variable amount of records, each of 62 bytes.
- Each record defines one of four possible terrain items (see [54]):
- ground tile,
- north wall,
- west wall, or
- object
- For example, DESERT.MCD defines a number of desert terrain items such as sand (ground tiles), sand dunes, rocks, and cacti.
- The PCK and TAB files work hand-in-hand with MCD records to define what each terrain item looks like.
- These MCD terrain items are subsequently combined to make "3D" maplets in the MAPS\DESERTnn.MAP 10x10 or 20x20 tilesets.
- The MAP tilesets are then selected from, to make a "random" desert map when a new battlescape is created.
- Sometimes more than one collection is used for a given map type; farms are made from the CULTIVAT (fields) and BARN (farmhouse) sets.
- More complex terrain types, especially UFOs and bases, tend to have many more MCD records (terrain items) and/or more than one MCD set. The maximum total cannot excede 256 records.
- Most MCD files are accompanied by respective PCK & TAB files, and vice versa.
Structure
0-7 / 00-07: Animation of the tile.
The eight bytes refer to images on the PCK files which are used in a sequence (from the first byte to the last) to animate tiles. This animation is used by several tiles on both games, such as doors (see [46]), bubbles on TFTD, blinking lifts, etc. If all eight frames are the same, it's a static tile.
8-19 / 08-13: Line Of Fire Template (LOFT) for the tile. 12 values, each references into LOFTEMPS.DAT file.
Each LOFT record is a 16x16 grid; these are stacked one over the other, with mcd[8] being the bottom. Used to create a 3D map (16x16x12) of the tile, for LOS. For more info, see LOFTEMPS.DAT.
20-21 / 14-15: Reference into SCANG.DAT file. Two-byte integer ([20] + [21] * 256 + 35 = offset). 4x4 bmp images for the top-down map; see SCANG.DAT.
22-29 / 16-1D: Unknown.
30 / 1E: Boolean: Is sliding door? See [46]
31 / 1F: Boolean: Can't be seen through?
32 / 20: Boolean: Can't be stood on? For ground tiles: non-flying units fall through. Only two ground tiles have this set: BLANKS MCD id 0 and UFO1 MCD id 0
33 / 21: Boolean: Is Wall? Used for Objects intended to act as Walls; used to make UFO, Skyranger, and Avenger outer "walls" that aren't otherwise possible as "real" North or West walls. Used for a few other things, too. Called "BigWall" in MapView.
34 / 22: Boolean: Is Grav lift? Up/Down of Lifts is determined by whether there is another one above or below in the .MAP.
35 / 23: Boolean: Is hinged door? See [46]
36 / 24: Boolean: Blocks fire?
37 / 25: Boolean: Blocks smoke?
38 / 26: Unknown - Always 3.
39 / 27: Time units used to walk across the tile. (255 means unpassable)
40 / 28: Time units used to slide across the tile. (255 means unpassable)
41 / 29: Time units used to fly across the tile. (255 means unpassable)
For [39] to [41], values range from 0 to 8, or are 255. There are only a few places where they are not all the same ([39]=[40]=[41]):
Walk Slide Fly File Description 2 0 2 Avenger Middle ramp object 255 255 4 Arctic Water pools in ice (18 ground MCDs) 2 2 0 U_Base Death objects for large round containers in alien bases (four quadrants)... thus, their remnants don't add TUs for fliers 1 1 0 U_Base Little green plant objects found on black "base garden" flooring 2 2 0 Urbits Two death objects (splinters on ground) for city's tall green picket fence (one is a North-wall fence, the other is a West-wall fence)
Which of the three movement types a given unit uses is determined by UnitRef[11]. Note that by default, ALL units are "walkers".
42 / 2A: Armor of tile.
- Tile must take this amount of damage to be destroyed, at which point it changes to mcd[44].
- Terrain items do not "remember" damage (like units); terrain is either destroyed (if damage >= armor) or not.
- Some things are set to 255 to mean "indestructible" but actually, anything >100 is indestructible in a non-hacked game, and anything >127 (for explosives, 255/2) or >191 (firearms, 255x.75) cannot be destroyed, even in a hacked game (see Damage re: Damage to terrain).
- With explosions, all four terrain items in the tile are hit by the same strength, but firearm shots target only one of them.
- For a loopy exception to explosions being equally applied (due to erroneous data), see Mountain Madness.
- NKF: I suppose you could make a gate out of this by creating two tiles, each easily destroyed, which change to the other when hit. One could be walked across, the other could not.
43 / 2B: HE Blockage
44 / 2C: Tile becomes a tile of this type (i.e., this other MCD record in the same MCD file) when destroyed. Also known as the death tile. Also see [53].
Note: If [44]=0, it means there is no death tile per se; it reverts to a "raw earth" (BLANKS[01]) tile if on ground, or nothing if in air. (It does not revert to the MCD id 0 record in the current collection.)
45 / 2D: The higher this is, the less likely the tile will be set on fire.
46 / 2E: If the tile is a door ([30] or [35]), the tile will become this tile number when opened. Animation [0] (see [0] to [7]) is shown until someone walks through the door, in which case it cycles through its animation stopping and holding Animation [7]. Then it will return to a closed door next turn.
47 / 2F: Unknown - Always 0. MCDEdit calls this "Keycode".
48 / 30: Signed value; add this to the graphical Y offset of units or objects on this tile. A.k.a. terrain level.
49 / 31: Subtract this value from the graphical Y offset of the tile image (used for hills).
50 / 32: Unknown - Always 0.
51 / 33: From 0 to 10, amount of light blocked by tile.
0 Blocks no light. ... up to ... 10 Blocks all light.
52 / 34: Footstep sound effect. Most likely an index to the .CAT file RAW wave -BladeFireLight
0 Not used in XCOM (makes a metal sound if hacked); is used on TFTD for some objects -Hobbes 1 Metal 2 Normal (Grass, Wood, Dirt) 3 Three mountain ground tiles, and some city apt. furniture objects that can't be walked on? (six furniture objects might've been - but they're death tiles that nothing points to) Uses same sound as 6. 4 Pool of water (Not used in XCOM) 5 Sand (Desert) 6 Martian 7 Snow (Not used in XCOM, Arctic actually uses 2)
53 / 35: Tile type:
0 Floor 1 West Wall 2 North Wall 3 Object
In the map, there are four bytes per tile: One each for the floor, west wall, north wall and object. If one of those changes (eg Is destroyed, or in the case of a door, opened), it is removed from the map and a new object is placed instead. This byte is used to work out which of the four map bytes should recieve the new object.
For example, in the mountains, if you destroy the ground tile you get an object (tree stump). The new tile gets written into the fourth byte of the map record, even though the original tile that was destroyed belonged in the first byte.
As for the potential for change in tile type when becoming death tile ([44]): There are 22 instances of Mountain Madness (ground to object), 1 instance of North Wall becoming an object (XCOM1 northwall door becomes rubble), one MCD record with tile type of 10 (Barn 7 which looks like a North Wall and becomes northwall when killed; obviously a typo'd Tile Type), and 31 total instances on 18 different tilesets where objects become ground upon dying (probably to "scorched earth", but this was not checked).
54 / 36: Explosive type; [55] must be >0:
0 HE 1 Smoke
Notes:
- To see explosive objects in XCOM, see Explosions#Explosive Map Objects.
- Type 0 (HE) explosions follow the usual rules for explosions (average damage to units decreases by 10 per tile outward, etc.).
- Hackers: Type 0 (HE) terrain items with little or no armor ([42]=0) are obliterated before exploding (i.e., they won't explode, no matter how high [55] is). Probably also depends on, if it was a very big blast relative to the armor.
- Chain reactions are exceedingly difficult to set up (per Hobbes). Most of the time when you see e.g. the four sections of the Navigator's table explode, it's because you used explosives that actually set off each one individually. It has to do with a balance of, among other things, not obliterating the object (see previous point).
- Type 1 (Smoke) explosives are strange, and mainly only affect aliens - and very haphazardly at that. XCOM units are only very rarely affected; I could only get it to work if they were 1) unarmored, 2) on a diagonal, and 3) no other objects are "in the way" between the blast moving "over and up" or "up and over" to the diagonal (blast propagation never moves directly diagonally per se; see Explosions#Playing With Fire). -MTR
- Chain reactions are not possible with Type 1 (Smoke) explosive objects.
- Also, when dealing with smoke damage, remember that if there is already tons of smoke on the map (filling up the smoke table) such that no new smoke can appear, you might get unexpected results (or no effect). Hobbes: One strange thing that can happen when there's already too much smoke on the map and an object with [54]=1 explodes is that the alien dies and in the dying animation there's smoke on that square. Just in the dying animation, not after he's down? -MTR - I can't remember right now if the smoke remains afterward. Next time it happens I will check it Hobbes 12:00, 18 Nov 2005 (PST)
- There are no "naturally occuring" HE explosives tiles in UFO. All explosive objects are MCD[54]=1.
- TFTD uses both values for [54], 0 (more common, like the barrels on Port) and 1 (the Synomium device on Grunge/Artifact Site).
55 / 37: Strength of explosion when tile is destroyed.
56 / 38: Smoke blockage. This is set to 0 for all UFO tiles!
Perhaps [36] is used only? A varying [56] might have been where the 2 un-used smoke sprites would have come in. --Danial
57 / 39: The amount of turns this tile will burn for.
58 / 3A: Brightness of tile. Amount of light produced.
11 MCDs produce light: 7 alien base objects (several pulsing fuel pods and several 4-part round "museum containers"), 2 XCOM base ground tiles, and 2 city objects (street lamp and large standing room lamp). See Night Missions for pictures. Oddly, values range from 1 for the street lamp to 16 for the alien base museum containers, so lower values must be brighter. The distances of projected light have yet to be determined, but note that flares and personal lighting ignore vertical distance... at night, a soldier can see aliens on the ground exactly 9 tiles away, regardless of whether the soldier is at ground level or 4 levels high.
In practise, it seems if this is not zero then the tile will be fully illuminated regardless of the value. - Bomb Bloke 06:48, 20 June 2008 (PDT)
59 / 3B: Special properties of tile. Determines what is salvaged at end of mission:
0 No Special Properties 1 Starting Point (place to Abort mission) 2 UFO Power Source 3 UFO Navigation 4 UFO Construction 5 Alien Food 6 Alien Reproduction 7 Alien Entertainment 8 Alien Surgery 9 Examination Room 10 Alien Alloys 11 Alien Habitat 12 Dead Tile 13 End Point (from surface of Mars to base) 14 Alien Brain (final mission victory condition)
60 / 3C: Set to 1 for most (but not all) non-death-tile XCOM base objects (TileType=3). All other MCD records set to 0. MCDEdit calls this "Victory Points" - so presumably you lose VPs based on how much of your base is destroyed?
61 / 3D: Almost half (560 of 1317) MCD records have widely varying values here, from 1 to 255 with no apparent pattern or preferred value. The remaining MCD records are 0. Some kind of pointer?
List of MCD Files
Here are the 27 MCD files in XCOM. Here's a list of the number of MCD records in each (1,317 total):
File Terrain Records avenger Avenger 59 barn Farm 29 blanks All 2 brain Alien Base 4 cultitav Farm 37 desert Desert 66 forest Forest 83 frniture City 26 jungle Jungle 82 lightnin Lightning 42 mars Cydonia 36 mount Mountain 78 plane Skyranger 65 polar Polar 81 roads City 23 ufo1 Small Scout 20 urban City 112 urbits City 25 u_base Alien Base 67 u_bits UFOs 8 u_disec2 UFOs 17 u_ext02 UFOs 34 u_oper2 UFOs 15 u_pods UFO/Alien Base 11 u_wall02 UFO/Alien Base/Cydonia 47 xbase1 X-COM Base 97 xbase2 X-COM Base 62
And here's the same list for TFTD:
File Terrain Records asunk Sunken Galleon 50 atlantis Atlantis 77 barracud Barracuda 46 blanks All 2 cargo1 Cargo Ship 103 cargo2 Cargo Ship 13 cargo3 Cargo Ship 6 coral Coral 28 crypt1 Crypt 45 crypt2 Crypt 49 crypt3 Crypt 12 crypt4 Crypt 7 debris Seabed 50 deckc Liner Ship (Top) 18 entry Entry 12 grunge1 Artifact Site 38 grunge2 Artifact Site 8 grunge3 Artifact Site 10 grunge4 Artifact Site 37 hammer Hammerhead 44 island1 Island 50 island2 Island 50 island3 Island 35 leviath Leviathan 47 linera Liner Ship 99 linerb Liner Ship 24 linerc Liner Ship 40 linerd Liner Ship 23 manta Manta 44 msunk1 Sunken Ship 50 msunk2 Sunken Ship 29 mu Mu 80 organic1 Alien Base/Level/Entry 96 organic2 Alien Base/Level 10 organic3 Alien Base/Level 4 pipes Pipes 55 planes Sunken Plane 79 port01 Port 95 port02 Port 78 psynom Alien Base/Level 2 pyramid Artifact 24 rocks Artifact/Seabed/Galleon 15 sand several 20 sea several 18 triton Triton 46 uext1 ? 4 uext2 USO/Entry 9 uext3 USO/Entry 25 ufobits several 5 uint1 USO 41 uint2 USO 11 uint3 USO 14 volc Volcanic 80 weeds Artifact/Coral/Seabed 10 xbases1 X-COM Base 87 xbases2 X-COM Base 42 xbases3 X-COM Base 37 xbases4 X-COM Base 43 xbases5 X-COM Base 42 xbits Cargo Ship 39
Additional Information
MikeTheRed's MCD Database
An Acccess 2000 copy of all MCD data is here. It's from X-COM DOS 1.4, but AFAIK, all X-COM versions use the same data (even down to the buggy Mile-High Madness MCD record). You will need to use this wiki page to understand it; I did not name the fields. They're just called by their offset address (see above). This Access database can be readily exported to Excel if you want. Or contact me. There are also a few files giving overall stats; the "Exclude" field for tblFileTypes only means, I excluded them for most counts I've made. There are also a few queries that might or might not be helpful.
BladeFireLight's MCD Info
Another in-depth look at MCD (and more) can be found on this message by BladeFireLight. His post also contains a HexWorkshop template for viewing MCD files in a logical manner.
MCD Editor
Koralt's MCDEdit can view or modify MCD files. Find it here: mcdedit.zip. To see a screencap, scroll to the very bottom of BladeFireLight's MCD posting (above). MCDEdit needs vbrun200 to run!
MapView
DaiShiva has an excellent utility called MapView for viewing or editing maps. However, it does not allow editing of MCD terrain items per se, AFAIK; just moving/placement of them. Caution: You must install the extensive Microsoft .NET platform to use MapView; see DaiShiva's site.
BombBloke's Hacked Desert Terrain
Bomb Bloke has a numerical (ground) tileset which makes weapon damage blast testing easy as pie. It also has a little applet that lets you edit MCD variables Armor [42], HE Block [43], and Explosion Strength [55] (but not type, [54]), and it includes all four types of terrain item. Find his hacked terrain here or bundled with a savegame here. To see a screencap of the tiles in action, see this message.