Tactical AI

From UFOpaedia
Jump to navigation Jump to search

Route Nodes

Each individual map (10x10 or 20x20) comes with a .RMP file that defines the location and type of route nodes for that specific map. When a tactical mission is started the game engine combines the individual maps into a single one (50x50, 60x60 or bigger for TFTD) and also generates a file called ROUTES.DAT that contains all the nodes for that battlefield. The Tactical AI will then use the following information on each node for the following:

  • To place (spawn) XCOM/Alien/Civilian units when game starts, with settings to determine the type and rank of units that can (or not) be spawned on that node.
  • To move Aliens/Civilians across the battlefield - each node is linked to others on its vicinity and they create movement routes.
  • To determine the importance/priority of each node for the aliens when determining where to move (check 'Bytes 21&22' section below.

AI Modes

When the alien turn is in progress the game's AI assigns to each alien one mode that will determine its actions during the turn. The four modes are:

  • Patrol - the alien will travel between the battlefield using the links between nodes to locate human units.
  • Sniper - the alien will not move and will make a 360º turn to look for possible hostiles.

In both modes, if the alien detects an enemy unit (X-COM or civilian) the AI will assess the situation, based on the alien's aggressiveness stat and will trigger its intelligence stat (it will remember the position of the unit for X turns, X being its intelligence value). The AI will then switch the alien's mode to one of the following.

  • Combat - the alien will attack the human unit and/or try to find cover.
  • Escape - the alien will flee the human unit, usually when it is unarmed or it is a higher rank (Leader, Commander, etc.) alien.

AI Actions

The AI will then order each unit to perform actions:

  • Evaluating Mode
  • GoUfo
  • Guard
  • Finding Route
  • Moving
  • Firing
  • Attack Attempt
  • Select Target
  • Find Cover
  • Partial Cover
  • Final Facing
  • Set Patrol Point (???)
  • Find Fire Point (???)

Most of the actions are self-explanatory, but there's no clear explanation of how the AI considers 'Patrol' and 'Fire' points, although an hypothesis can be made from certain clues found on the ROUTES.DAT file regarding bytes 21&22 of each node.

Unknown functions - Bytes 21&22

There are 2 bytes for each route node whose function has not been completely identified.

Byte 21

byte 21 is called 'Flag' byte on Daishiva's Map View and looks used by the AI to give some sort of importance to each node.

Ufo 160 0 flags.gif Ufo 160 1 flags.gif Ufo 160 2 flags.gif

According to this theory the aliens will choose a node with the higher value 'flag' when their AI is set for patroling/guarding, unless it is already occupied. The Battleship schematics above show some proof of this, specially on the bridge area (the aliens that start on the bridge room usually never come out except to have a look outside the door). Now look at the plants for the Supply Ship:

Ufo 170 0 flag.gif Ufo 170 1 flag.gif Ufo 170 2 flag.gif

The ground and first level almost contains nodes with a 1 value, with a single exception - the 3 and 2 of the engine room.

Ufo 140 0 flag.gif Ufo 140 1 flag.gif

Next one is the Abductor. Usually the aliens don't come out much and you find a large number of them on the main chamber on the ground, due to the concentration of 3/4s that acts as a bottleneck.

Ufo 120 0 flag.gif Ufo 150 0 flag.gif Ufo 150 1 flag.gif

Ufo 130 0 flag.gif Ufo 130 1 flag.gif Ufo 130 2 flag.gif

Now, if these refer to Patrol Points is unconfirmed. However, a strong argument is that both Laser Squad (the predecessor of Enemy Unknown) and Apocalypse AI's use maps with predetermined regions (each rated with in a scale threat levels) and the presence of enemy (X-COM) units would provoke an AI response. In a similar way, Apocalypse's AI determined specific map regions to guard and others to patrol. Thus it should make sense that the game uses the values above to determine some of the alien actions, by giving some sort of importance to those nodes.

Byte 22

This byte is even a bigger mystery, although if the previous byte refers to a Patrol Point, then there might be some indications that it should indicate some sort of 'target' for the aliens to fire/destroy, namely from the terrains where it is present.

  • X-COM Base (EU) - XBASE02,03,04,05,06,09,10,11,12,13,14,15 (on the 2nd level, all with a 5 value)
  • Skyranger - 3 notes by the nose and the engines (10 value on all)
  • X-COM Base (TFTD) - the same pattern as Enemy Unknown.

More evidence is required to confirm it, namely reports of aliens destroying or firing at those nodes.

Other Interesting Information

  • After round 20 the location of all X-COM units becomes known to all the aliens and they automatically switch to Combat mode.
  • "We made sure that there was an element of unpredictability in the AI which often made it seem more intelligent than it actually was." - Julian Gollop. The quote comes from this interview.

See Also

ROUTES.DAT - the file that contains all route nodes on a saved tactical game.

UNITREF.DAT - Specially the discussion on the Talk page of Offset 0x4A.

Alien Inventory Use - what the AI does and does not use.

Alien movement patterns