Difference between revisions of "TERRAIN"

From UFOpaedia
Jump to navigation Jump to search
(Fixed page structure)
(Major enhance - Worked in my, Hobbes, and BladeFireLight's stuff)
Line 4: Line 4:
 
=MCD=
 
=MCD=
 
==General Information==
 
==General Information==
Files made up of a variable amount of records, each of 62 bytes.
+
*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\DESERT''nn''.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.
  
 
==Structure==
 
==Structure==
 
'''0-7:''' Animation of the tile.
 
'''0-7:''' 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, bubbles on TFTD, blinking lifts, etc.
+
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:''' Loft of the tile. 12 values, each references into [[LOFTEMPS.DAT]] file.
+
'''8-19:''' Line Of Fire Template (LOFT) for the tile. 12 values, each references into [[LOFTEMPS.DAT]] file.
  
Each record is a 16x16 grid, which are stacked one over the other, with byte 8 being the bottom. Used to create a 3D map of the tile, for LOS.
+
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:''' Reference into [[SCANG.DAT]] file. [20] + [21] * 256 + 35 = offset. Used for top-down map.
+
'''20-21:''' 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:'''
+
'''22-29:''' Unknown.
  
'''30:''' Boolean: Is sliding door?
+
'''30:''' Boolean: Is sliding door? See [46]
  
 
'''31:''' Boolean: Can't be seen through?
 
'''31:''' Boolean: Can't be seen through?
  
'''32:''' Boolean: Can't be stood on?
+
'''32:''' Boolean: Can't be stood on? For ground tiles: non-flying units fall through. ''I only see two XCOM MCD ground tiles with this set; not sure if either tile is actually used: BLANKS MCD id 0 and UFO1 MCD id 0 -[[user:MikeTheRed|MTR]]
  
'''33:''' Boolean: Is impassable? (Used for objects)
+
'''33:''' 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:''' Boolean: Is a Grav lift?
+
'''34:''' Boolean: Is Grav lift? Up/Down of Lifts is determined by whether there is another one above or below in the .MAP.
  
'''35:''' Boolean: Is a hinged door?
+
'''35:''' Boolean: Is hinged door? See [46]
  
 
'''36:''' Boolean: Blocks fire?
 
'''36:''' Boolean: Blocks fire?
Line 35: Line 47:
 
'''37:''' Boolean: Blocks smoke?
 
'''37:''' Boolean: Blocks smoke?
  
'''38:''' Always 3.
+
'''38:''' Unknown - Always 3.
  
 
'''39:''' Time units used to walk across the tile. (255 means unpassable)
 
'''39:''' Time units used to walk across the tile. (255 means unpassable)
Line 41: Line 53:
 
'''40:''' Time units used to fly across the tile. (255 means unpassable)
 
'''40:''' Time units used to fly across the tile. (255 means unpassable)
  
'''41:''' Time units used to slide across the tile. (255 means unpassable) (Used for some aliens. Tanks?)
+
'''41:''' Time units used to slide across the tile. (255 means unpassable) (Used for aliens like Snakemen and Silacoids. Tanks?)
  
'''42:''' Armor of tile. Tile must take this amount of damage to be destroyed (in a single
+
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]):
blast). Tile will then change to mcd[44]. (255 Indestructable!)
 
''Note:'' 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.
 
  
''- Yes, but you'd have to destroy the gate to open/close it [[User:Hobbes|Hobbes]]''
+
<u>Walk</u> <u>Fly</u> <u>Slide</u> <u>File</u>    <u>Description</u>
 +
 +
  2  0    2  Avenger Middle ramp object ''(but you can't fly there because they're on the
 +
                        ''ground anyway, no? - MTR)
 +
 +
  255 255  4  Arctic  Water pools in ice (18 ground MCDs) ''(huh! like water snakes, eh? -MTR)
 +
 +
  2  2    0  U_Base  Death ''objects'' for large round containers in alien bases (four quadrants)...
 +
                        thus, their remnants don't ''add'' TUs for sliders
 +
 +
  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)
  
'''43:''' HE Blockage.
+
'''42:''' 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 [[Explosions#Mile-High Madness|Mountain Madness]].
 +
*''[[user:NKF|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.
  
'''44:''' Tile becomes a tile of this type (i.e., this other MCD record in the same MCD file) when destroyed.
+
'''43:''' [[Explosions#HE Block|HE Blockage]]
 +
 
 +
'''44:''' 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" tile if on ground, or nothing if in air. (It does not revert to the MCD id 0 record in the current collection.)
 +
 
 +
''Is the "no death tile" raw earth tile found in BLANKS.MCD? -MTR
  
 
'''45:''' The higher this is, the less likely the tile will be set on fire.
 
'''45:''' The higher this is, the less likely the tile will be set on fire.
  
'''46:''' If the tile is a door, the tile will become this tile number when opened.
+
'''46:''' 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:''' Unknown - Always 0. [[TERRAIN#MCD Editor|MCDEdit]] calls this "Keycode".
  
'''47:''' Always 0.
+
'''48:''' Signed value; add this to the y offset of units or objects on this tile. A.k.a. terrain level.
  
'''48:''' Signed value; add this to the y offset of units when on this tile.
+
'''49:''' Subtract this value from the y offset of the tile image (used for hills).
  
'''49:''' Subtract this value from the y offset of the tile image.
+
''Why "y"? If this means up and down, isn't that the z axis? (Or just say up/down?) -MTR
  
'''50:''' Always 0.
+
'''50:''' Unknown - Always 0.
  
 
'''51:''' From 0 to 10, amount of light blocked by tile.
 
'''51:''' From 0 to 10, amount of light blocked by tile.
Line 72: Line 107:
 
  10 Blocks all light.
 
  10 Blocks all light.
  
'''52:''' Footstep sound effect.
+
'''52:''' Footstep sound effect. Most likely an index to the .CAT file RAW wave ''-[http://www.strategycore.co.uk/forums/lofiversion/index.php?t1468.html BladeFireLight]
  0 Unknown (used on TFTD for some objects - I've confirmed it ''[[User:Hobbes|Hobbes]]'')
+
  0 Not used in XCOM (makes a metal sound if hacked); is used on TFTD for some objects ''-[[User:Hobbes|Hobbes]]''
 
  1 Metal
 
  1 Metal
 
  2 Normal (Grass, Wood, Dirt)
 
  2 Normal (Grass, Wood, Dirt)
 
  3 Three mountain ground tiles, and some city apt. furniture objects that can't be walked on?
 
  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)
 
   (six furniture objects might've been - but they're death tiles that nothing points to)
 +
  Said to use same sound as 5 or 6 (sand).
 
  4 Unknown (no tiles have this value)
 
  4 Unknown (no tiles have this value)
 
  5 Sand (Desert)
 
  5 Sand (Desert)
 
  6 Martian
 
  6 Martian
 +
7 Not used in XCOM, but makes Snow sound (Arctic actually uses 6)
 +
 +
''Thanks whomever left those comments in Discussion... you didn't log in... did I get it right? Erase this comment after seeing it -[[user:MikeTheRed|MTR]]
 +
 
'''53:''' Tile type:
 
'''53:''' Tile type:
 
  0 Floor
 
  0 Floor
Line 88: Line 128:
 
As for the potential for change in tile type when becoming death tile ([44]): There are 22 instances of [[Explosions#Mile-High Madness|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).
 
As for the potential for change in tile type when becoming death tile ([44]): There are 22 instances of [[Explosions#Mile-High Madness|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:''' Explosive type:
+
BladeFireLight [http://www.strategycore.co.uk/forums/lofiversion/index.php?t1468.html adds] this comment on Tile Type: "When this type of tile is in the DieMCD ([44]) or OpenMCD ([46]) flags, this value is added to the tile coordinate to determine the byte in which the tile type should be written." Can anybody explain this to me? ''-MTR
 +
 
 +
'''54:''' Explosive type; [55] must be >0:
 
  0 HE
 
  0 HE
 
  1 Smoke
 
  1 Smoke
''I only see things that '''explode''' as having a 1 here... all 10 of the MCD records with [55] >0 (such as the Navigator's Console) have 1 here; the other 1317 MCD records are [54]=0, [55]=0. But MapView calls [54]=1 "smoke" and [54]=0 "HE". What's up with that? --[[User:MikeTheRed|MTR]]''
+
''Notes:''
 
+
#To see explosive objects in XCOM, see [[Explosions#Explosive Map Objects]].
''You've noticed a nice point there, which I think has to do with the fact that aliens can be killed with explosions happening from the 1 setting on [54] but not X-COM units. I've just tested this by moving unarmored soldiers right next to the gas pumps and shooting at them. Like you said, on UFO the objects explode with a 1 on [54], if [55]>0. But on my terrain mods I've barrels with a 0 setting on [54] and [55]>0 and those will kill X-COM units when they are hit and explode. Thus, the 0 HE and 1 Smoke designations are correct, it's only that for the aliens the Smoke explosion will hurt/kill them.  
+
#Type 0 (HE) explosions follow the usual rules for [[explosions]] (average damage to units decreases by 10 per tile outward, etc.).
''And on TFTD the game uses both values for [54], 0 (more common, like the barrels on Port) and 1 (the Synomium device on Grunge/Artifact Site). -- [[User:Hobbes|Hobbes]]''
+
#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).
''Ok... hmm well... I just took BB's numerical tileset for a spin... turned on explosivity and also hacked [54]... found some very weird things:
+
#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
#The objects (a dirt block) would not explode at all if [54]=0, [55]=100. This is with armor=0 and they are readily destroyed by any shot or explosion.
+
#Chain reactions are not possible with Type 1 (Smoke) explosive objects.
#If [54]=1, [55]=100, they do explode. But they will ''not'' chain react, even if side by side and zero armor. Nor do they even destroy each other (never mind a chain reaction). They also do not affect ground tiles in any way. So an HE=100 blast is not harming any terrain around it at all. I see where you said the same thing, in the comments on [[Explosions#Explosive_Map_Objects]]. No, wait... where'd that comment go?
+
#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). ''[[user:Hobbes|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
#Aliens are sometimes affected by [54]=1, [55]=100 object blasts that they are next to, but it is rare. Also it appears that they do have to be caught in smoke; IOW if you already have so much smoke elsewhere on the map that no new smoke can appear, they are not harmed.
+
#TFTD uses both values for [54], 0 (more common, like the barrels on Port) and 1 (the Synomium device on Grunge/Artifact Site).
#I DID see a XCOM unit in coveralls damaged or killed occasionally by this [54]=1, [55]=100 object. Oddly, it never worked if they were standing on one of the four tiles directly adjacent to it. But they were sometimes (not often) damaged if they were ''diagonal'' to it (and the two "points" between had to be empty of objects, i.e., it looks like any object adjacent to both the soldier and the exploding object, can block the blast).
 
 
 
''All in all Hobbes, it's very strange and unlike regular HE at all. I'm not sure I understand it. I could not get [54]=0 objects to even explode... and don't understand the "rules" too well even when they do ([54]=1). Can you say more about them? --[[User:MikeTheRed|MikeTheRed]] 17:40, 16 Nov 2005 (PST)''
 
 
 
''This is the answers, to the best of my knowledge:''
 
# The objects most likely didn't explode because of their armor setting of 0. If a blast is strong enough (either from objects or weapons) it will simply obliterate completely the object and remove it from the battlefield without provoking an explosion.
 
#With [54] = 1 the blast will only produce smoke and not chain react. Explosion chain reactions are only possible with [54] = 0 (for instance when the UFO Navigation objects control room on an Alien Base are hit by a Blaster Bomb, it is the BB's blast that makes them explode). But chain reactions are rare to happen because of what I mentioned on the previous point. If the explosion is too big, the other objects will be obliterate and not explode. I've tried creating maps with chain reactions but they are very hard to achieve. The comment is where you placed the link, on the Note.
 
#You are right there: the aliens reaction to [54]=1 explosions can be unpredictable. One strange thing that can also 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.  
 
#Interesting to know about the X-COM unit being injured/killed with the [54]=1 setting. I probably never saw it because I dump t-shirts as soon as possible :)
 
  
''The rules are basically on my two posts. There's probably a formula behind them, especially concerning the chain reactions but I never bothered figuring them out because I just needed to know the basics to design maps. If you want to test it more I have a terrain that contains some explosive barrels, both smoke and HE. [[User:Hobbes|Hobbes]] 19:15, 16 Nov 2005 (PST)''
+
'''''To Hobbes:''' I jacked my armor up and DID see [54]=0 explosions (whew!). Thanks for the map offer but I've already got BombBloke's numerical tileset which I can hack at will... I've incorporated our various notes above; edit them all you want! Hey, do you want to mention your savegame with the Notes here, or in Additional Information, or maybe on the explosions page? Delete this comment of mine after reading it... set [55]=100! ;) -[[user:MikeTheRed|MTR]]
  
 
'''55:''' Strength of explosion when tile is destroyed.
 
'''55:''' Strength of explosion when tile is destroyed.
Line 120: Line 153:
 
'''58:''' Brightness of tile. Amount of light produced.
 
'''58:''' Brightness of tile. Amount of light produced.
  
'''59:''' Special properties of tile:
+
'''59:''' Special properties of tile. Determines what is salvaged at end of mission:
 
   0 ''No Special Properties''
 
   0 ''No Special Properties''
   1 Starting Point
+
   1 Starting Point ''(place to Abort mission)
   2 UFO Power Supply
+
   2 [[UFO Power Source]]
   3 UFO Navigation
+
   3 [[UFO Navigation]]
   5 Alien Food
+
   5 [[Alien Food]]
   7 Alien Entertainment
+
   7 [[Alien Entertainment]]
   8 Alien Surgery
+
   8 [[Alien Surgery]]
   9 Examination Room
+
   9 [[Examination Room]]
  10 Alien Alloy
+
  10 [[Alien Alloys]]
 
  12 Dead Tile
 
  12 Dead Tile
  13 End Point
+
  13 End Point ''(from surface of Mars to base)
  14 Alien Brain
+
  14 Alien Brain ''(final mission victory condition)
  
'''60:''' Set to 1 for most (but not all) non-death-tile XCOM base objects (TileType=3). All other MCD records set to 0.
+
'''60:''' Set to 1 for most (but not all) non-death-tile XCOM base objects (TileType=3). All other MCD records set to 0. [[TERRAIN#MCD Editor|MCDEdit]] calls this "Victory Points" - so presumably you lose VPs based on how much of your base is destroyed?
  
 
'''61:''' 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?
 
'''61:''' 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 29 MCD files in XCOM. Here's a list of the number of MCD records in each (1,317 total):
 +
<u>Records</u>  <u>File</u>
 +
    59    AVENGER
 +
    29    BARN
 +
    2    BLANKS
 +
    4    BRAIN
 +
    37    CULTIVAT
 +
    66    DESERT
 +
    42    fires
 +
    83    FOREST
 +
    26    FRNITURE
 +
    65    interc
 +
    82    JUNGLE
 +
    42    LIGHTNIN
 +
    36    MARS
 +
    78    MOUNT
 +
    65    PLANE
 +
    81    POLAR
 +
    23    ROADS
 +
    67    U_BASE
 +
    8    U_BITS
 +
    17    U_DISEC2
 +
    34    U_EXT02
 +
    15    U_OPER2
 +
    11    U_PODS
 +
    47    U_WALL02
 +
    2    UFO1
 +
  112    URBAN
 +
    25    URBITS
 +
    97    XBASE1
 +
    62    XBASE2
  
 
==Additional Information==
 
==Additional Information==
More information can be found on this post by BladeFireLight: [http://www.strategycore.co.uk/forums/lofiversion/index.php?t1468.html Map Control Data (MCD)].
 
  
==MCD Editor==
+
===BladeFireLight's MCD Info===
Koralt's MCD Editor, which can be used to look/modify MCD files, can be found here: [http://mypage.bluewin.ch/xcom/mcdedit.zip mcdedit.zip]
+
Another in-depth look at MCD (and more) can be found on [http://www.strategycore.co.uk/forums/lofiversion/index.php?t1468.html this] message by BladeFireLight. His post also contains a [http://www.HexWorkshop.com HexWorkshop] template for viewing MCD files in a logical manner.
 +
 
 +
===MCD Editor===
 +
Koralt's MCDEdit can view or modify MCD files. Find it here: [http://mypage.bluewin.ch/xcom/mcdedit.zip mcdedit.zip]. To see a screencap, scroll to the very bottom of BladeFireLight's MCD posting (above). MCDEdit needs [http://mypage.bluewin.ch/xcom/vbrun200.zip vbrun200] to run!
 +
 
 +
===MapView===
 +
DaiShiva has an excellent utility called [http://www.daishiva.com/phpBB2/generic.php?page=progLinks.shtml 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.
  
This file needs [http://mypage.bluewin.ch/xcom/vbrun200.zip vbrun200] to run!
+
===BombBloke's Hacked Desert Terrain===
 +
[[User:Bomb Bloke|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
 +
[http://www.strategycore.co.uk/forums/index.php?showtopic=746&st=195&# here] or bundled with a savegame [http://www.xcomufo.com/forums/index.php?showtopic=8701&st=114&# here]. To see a screencap of the tiles in action, see [http://www.xcomufo.com/forums/index.php?showtopic=8701&st=112&# this] message.
  
 
=PCK / TAB=
 
=PCK / TAB=
 +
 
==General Information==
 
==General Information==
 +
 
Graphical tile data. The TAB file is made up of two byte values, each stating the starting offset of the respective graphic in the PCK file.<br>
 
Graphical tile data. The TAB file is made up of two byte values, each stating the starting offset of the respective graphic in the PCK file.<br>
 
<br>
 
<br>
 
PCK decoding is fairly simple: the first byte in the data stream tells you how many rows you should skip. Then you just draw each byte afterwards directly onto the screen (which should be using a 256 color palette).<br>  
 
PCK decoding is fairly simple: the first byte in the data stream tells you how many rows you should skip. Then you just draw each byte afterwards directly onto the screen (which should be using a 256 color palette).<br>  
 
<br>
 
<br>
Values 254/255 are not to be drawn. If you encounter a byte with a value of 254 (FE), then the next byte tells you how many pixils you should skip. If you encounter a byte with a value of 255 (FF), then you're done.<br>
+
Values 254/255 are not to be drawn. If you encounter a byte with a value of 254 (FE), then the next byte tells you how many pixels you should skip. If you encounter a byte with a value of 255 (FF), then you're done.<br>
 
<br>
 
<br>
 
While simplistic, I've found that the best way to use PCK files is to store them 'as is', then decode them straight onto the screen as needed (as opposed to pre-rendering them and storing the completed graphics in memory). This makes lighting effects that much easier to implement.
 
While simplistic, I've found that the best way to use PCK files is to store them 'as is', then decode them straight onto the screen as needed (as opposed to pre-rendering them and storing the completed graphics in memory). This makes lighting effects that much easier to implement.

Revision as of 07:38, 18 November 2005

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.

Structure

0-7: 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: 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: 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: Unknown.

30: Boolean: Is sliding door? See [46]

31: Boolean: Can't be seen through?

32: Boolean: Can't be stood on? For ground tiles: non-flying units fall through. I only see two XCOM MCD ground tiles with this set; not sure if either tile is actually used: BLANKS MCD id 0 and UFO1 MCD id 0 -MTR

33: 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: Boolean: Is Grav lift? Up/Down of Lifts is determined by whether there is another one above or below in the .MAP.

35: Boolean: Is hinged door? See [46]

36: Boolean: Blocks fire?

37: Boolean: Blocks smoke?

38: Unknown - Always 3.

39: Time units used to walk across the tile. (255 means unpassable)

40: Time units used to fly across the tile. (255 means unpassable)

41: Time units used to slide across the tile. (255 means unpassable) (Used for aliens like Snakemen and Silacoids. Tanks?)

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 Fly Slide File    Description

  2   0    2   Avenger Middle ramp object (but you can't fly there because they're on the
                       ground anyway, no? - MTR)

 255 255   4   Arctic  Water pools in ice (18 ground MCDs) (huh! like water snakes, eh? -MTR) 

  2   2    0   U_Base  Death objects for large round containers in alien bases (four quadrants)...
                       thus, their remnants don't add TUs for sliders

  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)

42: 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: HE Blockage

44: 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" tile if on ground, or nothing if in air. (It does not revert to the MCD id 0 record in the current collection.)

Is the "no death tile" raw earth tile found in BLANKS.MCD? -MTR

45: The higher this is, the less likely the tile will be set on fire.

46: 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: Unknown - Always 0. MCDEdit calls this "Keycode".

48: Signed value; add this to the y offset of units or objects on this tile. A.k.a. terrain level.

49: Subtract this value from the y offset of the tile image (used for hills).

Why "y"? If this means up and down, isn't that the z axis? (Or just say up/down?) -MTR

50: Unknown - Always 0.

51: From 0 to 10, amount of light blocked by tile.

 0 Blocks no light.
... up to ...
10 Blocks all light.

52: 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)
  Said to use same sound as 5 or 6 (sand).
4 Unknown (no tiles have this value)
5 Sand (Desert)
6 Martian
7 Not used in XCOM, but makes Snow sound (Arctic actually uses 6)

Thanks whomever left those comments in Discussion... you didn't log in... did I get it right? Erase this comment after seeing it -MTR

53: Tile type:

0 Floor
1 West Wall
2 North Wall
3 Object

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).

BladeFireLight adds this comment on Tile Type: "When this type of tile is in the DieMCD ([44]) or OpenMCD ([46]) flags, this value is added to the tile coordinate to determine the byte in which the tile type should be written." Can anybody explain this to me? -MTR

54: Explosive type; [55] must be >0:

0 HE
1 Smoke

Notes:

  1. To see explosive objects in XCOM, see Explosions#Explosive Map Objects.
  2. Type 0 (HE) explosions follow the usual rules for explosions (average damage to units decreases by 10 per tile outward, etc.).
  3. 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.
  4. 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).
  5. 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
  6. Chain reactions are not possible with Type 1 (Smoke) explosive objects.
  7. 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
  8. TFTD uses both values for [54], 0 (more common, like the barrels on Port) and 1 (the Synomium device on Grunge/Artifact Site).

To Hobbes: I jacked my armor up and DID see [54]=0 explosions (whew!). Thanks for the map offer but I've already got BombBloke's numerical tileset which I can hack at will... I've incorporated our various notes above; edit them all you want! Hey, do you want to mention your savegame with the Notes here, or in Additional Information, or maybe on the explosions page? Delete this comment of mine after reading it... set [55]=100! ;) -MTR

55: Strength of explosion when tile is destroyed.

56: Smoke blockage.

57: The amount of turns this tile will burn for.

58: Brightness of tile. Amount of light produced.

59: 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
 5 Alien Food
 7 Alien Entertainment
 8 Alien Surgery
 9 Examination Room
10 Alien Alloys
12 Dead Tile
13 End Point (from surface of Mars to base)
14 Alien Brain  (final mission victory condition)

60: 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: 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 29 MCD files in XCOM. Here's a list of the number of MCD records in each (1,317 total):

Records  File
   59    AVENGER
   29    BARN
    2    BLANKS
    4    BRAIN
   37    CULTIVAT
   66    DESERT
   42    fires
   83    FOREST
   26    FRNITURE
   65    interc
   82    JUNGLE
   42    LIGHTNIN
   36    MARS
   78    MOUNT
   65    PLANE
   81    POLAR
   23    ROADS
   67    U_BASE
    8    U_BITS
   17    U_DISEC2
   34    U_EXT02
   15    U_OPER2
   11    U_PODS
   47    U_WALL02
    2    UFO1
  112    URBAN
   25    URBITS
   97    XBASE1
   62    XBASE2

Additional Information

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.

PCK / TAB

General Information

Graphical tile data. The TAB file is made up of two byte values, each stating the starting offset of the respective graphic in the PCK file.

PCK decoding is fairly simple: the first byte in the data stream tells you how many rows you should skip. Then you just draw each byte afterwards directly onto the screen (which should be using a 256 color palette).

Values 254/255 are not to be drawn. If you encounter a byte with a value of 254 (FE), then the next byte tells you how many pixels you should skip. If you encounter a byte with a value of 255 (FF), then you're done.

While simplistic, I've found that the best way to use PCK files is to store them 'as is', then decode them straight onto the screen as needed (as opposed to pre-rendering them and storing the completed graphics in memory). This makes lighting effects that much easier to implement.