Difference between revisions of "Battlescape Map Generation"

From UFOpaedia
Jump to navigation Jump to search
(→‎[[Explosions#UFO_Power_Sources|KABOOM!!]]: The reason for this is game has a failsafe in the event all of the aliens are killed by the exploding power source so that there actually is a fight.)
Line 133: Line 133:
 
Because UPS explosions tend to have very high damage ratings (above any other tactical weapon in the game), they tend to obliterate anything nearby. This always results in the [[Elerium-115]] that was placed in them being destroyed, often causes massive damage to the insides of the UFO, and usually kills any aliens unfortunate enough to be in the blast's path.
 
Because UPS explosions tend to have very high damage ratings (above any other tactical weapon in the game), they tend to obliterate anything nearby. This always results in the [[Elerium-115]] that was placed in them being destroyed, often causes massive damage to the insides of the UFO, and usually kills any aliens unfortunate enough to be in the blast's path.
  
For some reason though, the game will often have aliens still alive within a medium scout, despite an almost point blank proximity to the blast. Furthermore, these aliens will either be at full health, or dead. Maximum health and species of alien do not appear to matter, the game merely gives nearby aliens a % chance to die or escape unharmed. This check is only performed on aliens which were determined to be within the blast affects.
+
Due to limitations of the game engine(as well as to challenge the player), the aliens will always have at least one or two units left alive, even if they all spawned in close proximity to the exploding UFO Power Source.
  
 
The UPS explosion is also the only explosion in the game to create random terrain damage. Taking a medium scout as an example, sometimes it will blow off the roof of the UFO. Sometimes it will destroy multiple outer walls. Whereas normal explosives will give the exact same blast pattern, every single time.
 
The UPS explosion is also the only explosion in the game to create random terrain damage. Taking a medium scout as an example, sometimes it will blow off the roof of the UFO. Sometimes it will destroy multiple outer walls. Whereas normal explosives will give the exact same blast pattern, every single time.

Revision as of 12:41, 17 March 2009

UFO/TFTD has two primary game engines - The GeoScape and the Tactical. When you go from the world map view in battle (or vice versa), the game switches between these two.

The two engines need to communicate with each other - When battle begins, the GeoScape engine needs to state the particulars such as which troops and aliens are present, and what the mission goals are. The Tactical engine then needs to piece together the map and place the units.

This page aims to state the steps taken during this process, so as to have all the relevant wiki articles listed in the one place.

Map Statistics

UFO

Typically, a battlescape map is 50 wide by 50 units long by 4 units high, with the maximum battlescape size being 10k units. There are a small handful of exceptions to this.

Battles against a small or medium scout are fought on maps only 40x40x4. X-Com bases are 60x60x2, as is the Cydonia underground base. Standard alien bases are 50x50x2.

Usually two or three large map modules (2x2) will make it into each battlescape. All alien bases contain a command center module, though the Cydonia base contains a brain module instead.

X-Com bases are built according to how you set them up.

Regarding roads in terror missions, these always go from one side of the map to the other, and there is always at least one road per map (at most one going in each direction).

TFTD

Artifact stage 1: 5x5x4

Colony stage 1: 6x6x4

Cruiser: 6x6x4

GeoScape Tasks

The GeoScape engine plays it's part by creating five data files in the MissDat folder:

GEODATA.DAT

This file holds information on the map's terrain and dimensions, as well as the types of X-Com/Alien craft present and where they are located.

It also contains a list of the map modules in the order that should be used to build the complete world map.

Only certain modules are used as landing sites for the craft present. For each terrain, these are:

UFO                                   TFTD
0: Jungle     -  0, 1, 2              0: Seabed                 -  0, 1
1: Farm       -  0, 7,11              1: Pipes                  -  0
2: Forest     -  0, 1                 2: Crashed Plane          -  0
3: X-Com Base -  N/A                  3: Atlantis               -  0, 1
4: Alien Base -  N/A                  4: Mu                     -  0
5: Urban      -  3, 4                 5: Sunken Galleon         - 13,14,15,16
6: Desert     -  0, 1, 2              6: Sunken Liner           -  0, 1
7: Mountains  -  0, 1, 2              7: Volcanic               -  0
8: Polar      -  0, 1, 2              8: Coral                  -  0
9: Mars       -  0                    9: Artefact Site Stage 1  -  0
                                     10: Artefact Site Stage 2  -  N/A
                                     11: Cargo Ship             -  0
                                     12: Port Attack            -  0, 1
                                     13: Island Attack          -  0, 1
                                     14: Colony Stage 2         -  N/A
                                     15: T'leth Stage 1         -  N/A
                                     16: T'leth Stage 2         -  N/A
                                     17: T'leth Stage 3         -  N/A
                                     18: X-Com Base             -  N/A
                                     19: Passenger Ship Stage 1 -  1
                                     20: Passenger Ship Stage 2 -  N/A
                                     21: Colony Stage 1         -  0, 2, 6

Ships take up rectangular layouts of modules, depending on their size:

 UFO                                  TFTD
 0 - SkyRanger    - 1x2               0 - Triton               - 1x2
 1 - Lightning    - 2x1               1 - Hammerhead           - 1x1
 2 - Avenger      - 1x2               2 - Leviathan            - 1x2
 3 - Interceptor  - 1x1               3 - Barracuda            - ???
 4 - Firestorm    - ???               4 - Manta                - ???
 5 - Small Scout  - 1x1               5 - Survey Ship          - 1x1
 6 - Medium Scout - 1x1               6 - Escort               - 1x1
 7 - Large Scout  - 2x2               7 - Cruiser              - 2x2
 8 - Harvestor    - 2x2               8 - Heavy Cruiser        - 2x2
 9 - Abductor     - 2x2               9 - Hunter               - 2x2
10 - Terror Ship  - 3x2              10 - Battleship           - 2x3
11 - Battleship   - 3x3              11 - Dreadnought          - 3x3
12 - Supply Ship  - 3x2              12 - Fleet Supply Cruiser - 2x3

MISSION.DAT

Unlike GeoData.Dat (which is primarily used for map generation), most Mission.Dat values are used for end-of-combat results.

It does, however, determine the mission type (Base attack/defense, UFO sites, etc), whether a UFO is present, and the lighting levels. It also holds info on what alien equipment has been researched (and hence can be used by your soldiers) plus the language the Tactical game engine should use. For TFTD, there's also a value determining the depth of the battle (surface, shallow water, deep water, etc).

OBPOSREF.DAT

Contains all the initial equipment that you and the aliens have brought to the battle. If an X-Com craft is present in the map, your equipment is all set to be at the location of your first unit (which can be determined according to the craft location set in GeoData.Dat).

ToDo: Check how X-Com equipment is placed in the case of base missions (which have no dropship).

Alien equipment is assigned to each alien present, then Elerium-115 is placed where ever UPSs can be found (again according to GeoData.Dat. An exception is in alien bases, where every second UPS lacks elerium).

UNIPOS.DAT

Lists the initial location records of units in play. All units are always alive (including aliens apparently killed by UPS explosions) here.

Usually the location of each unit is unset at this stage, though the exception to this is when you have a dropship present. The GeoScape engine will place each of your troopers/HWPs in their correct location when writing this file (hence the actual spawn nodes for X-Com craft are seldom used).

UNIREF.DAT

Here we have the initial statistics of all units in play. Again, all units are alive and well at this stage of map generation.

ToDo: Double check that this file does in fact match the initial UNITREF.DAT.

Tactical Tasks

Having read in all the information about the battle, it's up to the Tactical engine to actually put it altogether and present the mission to the player. The files listed below are only actually written to disk if you save the game, but these are likely the order in which they're created in memory:

MAP.DAT

The modules listed in GeoData.Dat are put together to create a full sized battlescape map. Once this is done, the X-Com then alien crafts are merged into the map (if need be).

ROUTES.DAT

The files stored in the routes folder are loaded in the order defined in GeoData.Dat (again with the X-Com/alien craft being loaded last). These define the spawn points on the map (which the aliens will also patrol between prior to spotting your units).

ToDo: Check if map modules that contain craft have their usual nodes loaded or not. Doubt they do.

UNITPOS.DAT

At this stage units are placed on the map. If a dropship is present, X-Com units will already have been placed by the GeoScape engine and so the Tactical leaves them alone.

ToDo: Check if there's a value somewhere that determines this, or if the game just goes by whether a dropship is present.

Different unit types tend to spawn on certain nodes: For example, you'll usually find alien commanders in the command center of alien bases. However, if there aren't enough nodes to follow this rule you might find unit types outside their usual areas. If there is a severe node shortage some aliens might not be placed at all (their equipment remains in the object table however, and can still be recovered if you win the mission).

KABOOM!!

If the mission is against a crashed UFO, all UPSs present in the craft have a 75% chance to explode (assuming the detonation of another UPS doesn't destroy them first). This is performed during a hidden "first turn" (actual gameplay always begins at turn 2).

Because UPS explosions tend to have very high damage ratings (above any other tactical weapon in the game), they tend to obliterate anything nearby. This always results in the Elerium-115 that was placed in them being destroyed, often causes massive damage to the insides of the UFO, and usually kills any aliens unfortunate enough to be in the blast's path.

Due to limitations of the game engine(as well as to challenge the player), the aliens will always have at least one or two units left alive, even if they all spawned in close proximity to the exploding UFO Power Source.

The UPS explosion is also the only explosion in the game to create random terrain damage. Taking a medium scout as an example, sometimes it will blow off the roof of the UFO. Sometimes it will destroy multiple outer walls. Whereas normal explosives will give the exact same blast pattern, every single time.

The check to see whether the craft crashed or not is determined by the relevant LOC.DAT record (as defined by MISSION.DAT). The amount of damage done to the craft has no effect on the amount of power supplies that will explode, nor how much damage they'll do.

Trooper Equiping

The final stage before battle begins is where you, the user, get to choose your loadout for your soldiers. You're presented with all items in the initial "equipment pile" and allowed to distribute them as you wish (without the need to ration TUs).

Once this is done, the battle is on!