TERRAIN

From UFOpaedia
Revision as of 00:57, 18 November 2005 by Danial (talk | contribs) (Fixed page structure)
Jump to navigation Jump to search

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

Files made up of a variable amount of records, each of 62 bytes.

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, bubbles on TFTD, blinking lifts, etc.

8-19: Loft of 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.

20-21: Reference into SCANG.DAT file. [20] + [21] * 256 + 35 = offset. Used for top-down map.

22-29:

30: Boolean: Is sliding door?

31: Boolean: Can't be seen through?

32: Boolean: Can't be stood on?

33: Boolean: Is impassable? (Used for objects)

34: Boolean: Is a Grav lift?

35: Boolean: Is a hinged door?

36: Boolean: Blocks fire?

37: Boolean: Blocks smoke?

38: 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 some aliens. Tanks?)

42: Armor of tile. Tile must take this amount of damage to be destroyed (in a single 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 Hobbes

43: HE Blockage.

44: Tile becomes a tile of this type (i.e., this other MCD record in the same MCD file) when destroyed.

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.

47: Always 0.

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.

50: 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.

0 Unknown (used on TFTD for some objects - I've confirmed it 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)
4 Unknown (no tiles have this value)
5 Sand (Desert)
6 Martian

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

54: Explosive type:

0 HE
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? --MTR

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

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:

  1. 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.
  2. 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?
  3. 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.
  4. 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? --MikeTheRed 17:40, 16 Nov 2005 (PST)

This is the answers, to the best of my knowledge:

  1. 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.
  2. 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.
  3. 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.
  4. 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. Hobbes 19:15, 16 Nov 2005 (PST)

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:

 0 No Special Properties
 1 Starting Point
 2 UFO Power Supply
 3 UFO Navigation
 5 Alien Food
 7 Alien Entertainment
 8 Alien Surgery
 9 Examination Room
10 Alien Alloy
12 Dead Tile
13 End Point
14 Alien Brain

60: Set to 1 for most (but not all) non-death-tile XCOM base objects (TileType=3). All other MCD records set to 0.

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?

Additional Information

More information can be found on this post by BladeFireLight: Map Control Data (MCD).

MCD Editor

Koralt's MCD Editor, which can be used to look/modify MCD files, can be found here: mcdedit.zip

This file needs vbrun200 to run!

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