Unit Behaviour

From StarCraft AI, the resource for custom StarCraft Brood War AIs
Jump to: navigation, search

Why do units run away?

Units will run away only if they are idle and attacked by an enemy unit that they can't attack back. This includes being damaged by the Irradiate ability. This list includes being attacked by undetected cloaked units, invincible units, undetected burrowed units, air units (when we have no air weapon), etc.

Why do units move to attack an enemy even when they are not in attack range?

Units will move when an enemy enters their "target acquisition range", or "Seek Range" in BWAPI.

What are the differences between Stop and Hold Position?

The difference will impact your unit's rate of fire. Hold position will make your unit's first shot faster, but consecutive shots will be slower, and Stop will make your unit's consecutive shots faster, but your first shot slower. When a unit is ordered to Hold Position, it runs a loop to acquire a target, perform the attack, and then stop moving, the additional command to stop moving requires additional frames, making your unit's consecutive attacks slower, but because Hold Position first acquires a target, its initial attack will be faster. Stop will order your unit to first stop doing everything immediately, which also stops it from acquiring a first target until it goes idle, increasing the time for a first attack, however it will not order your unit to stop moving after every attack, making consecutive attacks faster.

The above explanation may not represent the exact behaviour, but here is the short version:

  • Stop: Stop -Go to Idle -Acquire Target -Attack -Attack -...
  • Hold Position: Stop -Acquire Target -Attack -Stop -Attack -Stop -...

Which Worker Gathers the fastest?

All race's workers move the same. Their gathering speed is also the same. The only difference between the races is the size of their resource depot. Compare the sizes of Terran Command Center, Protoss Nexus, and Zerg Hatchery/Lair/Hive. Only the size of their resource depot impacts resource gathering time, with the exception of the Command Center, whose addon script possibly causes a pause for workers returning on the left and right sides. Buildings also seem to favor the top left more than the bottom right, but the difference is unnoticable.

What is the regeneration rate of Protoss Shields?

The regeneration rate of Protoss Shields is 7 points per frame internally. Visibly, this is 0.02734375 points per frame, or 0.651041666.. points per second on fastest speed.

What is the regeneration rate of Energy?

The regeneration rate of Energy (used for abilities) is 8 points per frame internally. Like Shields, this is visibly 0.03125 points per frame, or 0.744047619.. points per second on fastest speed.

What is the regeneration rate of Zerg Hit Points?

The regeneration rate of Zerg HP is 4 points per frame internally. Again, this is visibly 0.015625 points per frame, or 0.3720238095.. points per second on fastest speed.