Automatic Targeting

From Liquipedia StarCraft 2 Wiki

Automatic Targeting is the part of the Tactical AI that chooses the targets for regular attacks when there are targets in range but the player has not explicitly specified a target. It governs the target choice for the weapons of all units and buildings carrying out one of these commands:

  • Stop (also known as "idling")
  • Hold Position
  • Patrol
  • Attack Move
  • Follow Ally


It does not concern units carrying out one of these commands:

  • Move
  • Attack Target
  • Any spell or ability


Once a target is chosen, it will remain the target until it ceases being a valid target (e.g., dies, becomes invisible, or goes up a ramp), leaves the weapon range or a higher-priority target enters the weapon range.

Priority Criteria[edit]

A unit (or building) considers all valid targets within the Scan Range of its weapons. The criteria for selection are, from most to least important:

  1. Which targets are threats to me?
  2. Which targets have the highest Attack Target Priority (ATP) values?
  3. Which targets allow me to use my primary weapon?
  4. Which target is the closest?


The four following sections elaborate on each of the criteria. The later criteria are only taken into account if there are multiple best targets for each of the previous criteria.

1. Threats[edit]

There are two possible reasons for a target to be considered a threat:

  1. They have a weapon that can return fire, i.e., the attacker is a legal target for the weapon.
  2. The unit type is one that has the "Always a Threat to Attackers" flag set:

2. Attack Target Priority[edit]

Every unit and building type has a fixed Attack Target Priority (ATP) value. Higher values make a target more attractive. With only few exceptions, all units and defensive buildings share an ATP of 20, while all other buildings share an ATP of 11. A comprehensive listing is given below.

Unit Attack Target Priority
Infested Terran Egg 0
All Cocoons, Larva 10
Widow Mine (only unburrowed) 19
All other units 20
Building Attack Target Priority
Photon Cannon 20
Photon Overcharged Pylon
(removed from the game)
20
Filled Bunker 20
Planetary Fortress 20
Raven Auto-Turret 20
Spine Crawler (rooted) 20
Spine Crawler (uprooted) 19
Spore Crawler 19
Missile Turret 19
Empty Bunker 19
Oracle Stasis Ward 10
All other buildings 11

3. Multiple Weapons[edit]

A few units have two weapons: one for Ground targets and one for Air targets. These units are:


In case of equal threat and ATP value criteria, these units will prefer to use their primary weapon over their secondary weapon. With the exception of the Battlecruiser, all these units' primary weapons are their anti-air weapons.

4. Closest Target[edit]

Once reaching this step, most units and buildings simply choose the target closest to themselves amongst the remaining candidates. The exceptions are as follows.

Closest Angle[edit]

The following units pick the target candidate which requires the least amount of turning to fire at:


This method of target choice gives the units a more slow and inert feeling. For the Melee units the impact on gameplay is minimal, while Thors and Battlecruisers may behave differently from what one would expect.

Distance from Target[edit]

The Colossus is the only unit that picks the target candidate closest to its previous target. This, too, is likely done to give it a less agile and more vulnerable feeling. Depending on the situation, this method of target choice can be an advantage (automatically keeping focus on the ranks of Hydralisks or Marines where Colossuses inflict most damage) or a disadvantage (not switching to Zerglings nibbling at the Colossus's feet).

Examples[edit]

  • Void Rays target Marines over Marauders, because they consider Marines threats but Marauders not.
  • Void Rays target Overlords, Roaches and Drones all exactly the same, as none of them are considered threats and they all have an ATP value of 20. The sole criterion is which target is closest.
  • Queens target Oracles over Phoenixes, because they don't consider Phoenixes threats (their weapon can't shoot ground units) and Oracles are flagged to always be threats (even if their weapon is disabled).
  • Zerglings target filled Bunkers over Supply Depots, because they consider filled Bunkers threats and Supply Depots not.
    • If the Bunkers were empty, they would not be considered threats but would still be targeted first as their ATP value (19) is higher than that of Supply Depots (11).
  • Zerglings target Marines over empty Bunkers, because they consider Marines threats but empty Bunkers not.
  • Mutalisks target Marines over Missile Turrets, because both are threats, but Marines have a higher ATP value (20 vs. 19).
  • Thors and Queens target Mutalisks over Zerglings, because both are considered threats with an ATP value of 20, but Mutalisks allow them to use their primary (anti-air) weapons.
  • Thors and Queens target Roaches over Overlords if the Roaches are in range of their secondary (anti-ground) weapons, because they consider Roaches a threat but Overlords not.
  • Thors and Queens target Overlords hovering directly over Roaches if they are not in range of their secondary (anti-ground) weapons but in range of their primary (anti-air) weapons.
    • Corollary: Attack moving Thors or Queens towards Roaches sitting under an Overlord will cause them to stop approaching once the Overlord gets into range and attack the Overlord.

Notes[edit]

  • Workers (including MULEs) have a "Default Acquire Level" of defensive. It is raised to offensive (the default for all other units and buildings) only when they are attack moving. The following rules apply:
    • Units with a defensive acquire level do not automatically acquire targets for their weapons.
    • Units with a defensive acquire level are not classified as threats by other units.
  • An exception to the above rule applies when an SCV or a MULE repairs a threatening target: the repairing unit inherits the target's threat and ATP value, making it the preferred target if it is closer than the threatening target.
    • Example: In the eyes of a Mutalisk, an SCV repairing a Missile Turret has the same priority as the Turret (threat + 19 ATP). If the SCV is between the Turret and the Mutalisk, the Mutalisk will target the SCV over the Turret.
  • Ghosts and Lurkers can toggle the automatic target acquisition of their weapons on and off using a button on their command card. This option is intended to help keep them undetected.
  • When a unit or building is attacking a target with the highest priority while carrying out an explicit "attack target" command, issuing a "stop" command will not cause the attacking to stop nor the target to switch. One particular use case for this behavior can be found in cannon rushing: a certain enemy building can be prioritized while still immediately responding to nearing units.[1]
  • The "Always a Threat to Attackers" flag was likely introduced to alleviate the frustration of juicy targets such as spellcasters and units with special attacks only being targeted very late in fights. However, in some situations the effects of the flag can be unintuitive. For example, air-to-ground units may prioritize closer ground-to-ground units (Disruptors, Lurkers, Swarm Hosts) over potentially more dangerous ground-to-air units and buildings (Hydralisks, Spore Crawlers, Stalkers, Photon Cannons).
  • AI players treat workers (including MULEs) as if they had an ATP value of 10, which gives them a lower priority than buildings. This feature is called "Override Target Priority" and is likely meant as a favor to human opponents.

References[edit]