MAPS

From UFOpaedia
Revision as of 14:34, 30 December 2015 by TBeholder (talk | contribs) (oops, my bad.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This folder contains pre-designed Battlescape terrain blocks (.MAP files). These are filled in with tiles from corresponding MCD files in the TERRAIN folder, and are combined in a semi-random fashion to create each battlefield your soldiers fight in.

Aside from a three byte header indicating their height, width and depth (in that order), .MAP files use the same format as MAP.DAT:

Each "position" of the map (that is, each tile you can move your mouse cursor over) is stored in order of left to right, top to bottom, top floor to bottom floor, and is represented by four bytes (so the filesize for each map module file will be equal to the map dimensions multiplied together, further multiplied by four). Each of the four bytes maps to a separate index within the associated MCD array:

  • The first byte links to the tile that represents the ground (eg, grass, dirt, pavement, etc).
  • The second byte links to the tile that represents the west-facing wall (eg, a barn wall, brick wall, fence, etc).
  • The third byte links to the tile that represents the north-facing wall (eg, a barn wall, brick wall, fence, etc).
  • The fourth byte links to the tile that represents an abstract object (eg, a fridge, a haybale, a tree, a chair, etc).
Map Record.png

If a given offset is set to 0, then no tile of that type exists at that location (for example, not every map position has to have a wall in it). If no "ground tile" is set for a location at ground level, the game will automatically place dirt there (from the second entry of BLANKS.MCD).

To combine these map modules together to create an actual battlefield, the associated MCD files must also be combined to create on single giant MCD array. Hence, the values within each MAP file need to be "translated" to index into this new array.

The first MAP files to be merged will always be those that represent the terrain (ie, the desert/urban/forest/etc map modules). These require no index translation and can be dumped directly into the combined map array.

Any further map modules to be added (eg, your dropship and perhaps the alien's craft) need to have all of their indexes that are already higher then 1 increased by a number equal to the amount of MCD records attached to the previous sets of MAP files.

The reason for this is that, within the separate MAP files, a value of 2 maps to the index 0 within the associated MCD set (the first tile). This is as opposed to MAP.DAT, where a value of 2 maps directly to index 2 in the collated MCD array (the third tile). Values of 0 always mean "no tile" (except at ground level, where tile 1 of BLANKS.MCD will be used for to stop mysterious holes appearing in the bottom of the the battlescape), and tile 1 of BLANKS.MCD (burnt earth) is available for use by all tilesets.

You may have noticed that the first index of the collated MCD array will be 0, but any maps indexes that point there are assumed to be "unused"! This "inaccessible" first MCD record is actually used to render the black area outside of the visible battlescape zone.

Note: When opening map files with MS-EDIT, open it in 4-column widths, but remember that the ground tile of the cell will be found at the last byte in the row above.


Map Combination Example

To expand the above out into a full example:

Say you have a terrain with 100 tiles in its MCD array, an X-COM craft with 30 tiles, and a UFO with 50. The collated MCD array will always start with the two indexes from BLANKS.MCD, and then will have all the tiles from the other relevant tilesets piled on top of those (for a total of 182 records, in this case).

All map modules for your terrain would go directly into your combined map array, with their indexes completely unaltered. The highest possible tile index used thus far would be 101 (the hundred-and-second record, remembering that the first index is 0).

Now you'd add the map indexes for your X-COM craft, completely overwriting any terrain indexes that happen to exist in the same locations, with any non-0 values in the craft MAP file. You would add 100 to all of these new indexes that are already higher then 1, so that they index into the "X-COM craft" area of the collated MCD array. The highest possible tile index at this point would be 131 (the hundred-and-thirty-second record).

Finally you'd add the map indexes for your alien craft, again overwriting any previously set map indexes at the same locations, with any non-0 values in the craft map file - but this time adding 130 to all alien craft indexes that are already higher then one. You'd now by up to a maximum index of 181, that being your hundred-and-eighty-second record.


Images

Below are examples of the map modules represented in the MAPS folder. Each level in the .MAP file is shown as indicated.

X-COM Ships

AVENGER.MAP (Avenger)

The Xcom Avenger craft

Level 1
Level 2
Level 3


LIGHTNIN.MAP (Lightning)

The Xcom Lightning craft

Level 1
Level 2
Level 3


PLANE.MAP (Skyranger)

The Xcom starter carrier - the Skyranger

Level 1
Level 2
Level 3


UFOs

UFO1A.MAP (Small Scout)

The Small Scout used by the aliens

Level 1
Level 2
Level 3


UFO_110.MAP (Medium Scout)

The Medium Scout used by the aliens

Level 1
Level 2


UFO_120.MAP (Large Scout)

The Large Scout

Level 1
Level 2


UFO_130.MAP (Harvester)

The Harvester UFO mainly crewed by Floaters, and sometimes Snakemen

Level 1
Level 2
Level 3
Level 4


UFO_140.MAP (Abductor)

The Abductor. Mostly Floaters use this UFO

Level 1
Level 2
Level 3


UFO_150.MAP (Terror Ship)

The alien's Terror Ship

Level 1
Level 2
Level 3


UFO_160.MAP (Battleship)

The Battleship

Level 1
Level 2
Level 3
Level 4


UFO_170.MAP (Supply Ship)

The alien's Supply Ship. Used to resupply bases

Level 1
Level 2
Level 3
Level 4


Terrain

There are also MAP files for the terrain in the Battlescape missions.

Unused

For present, but not used in the game maps see Talk:MAPS. Some are broken - they refer to MCDs different from those present in the release.