Warcraft III’s default attack behavior is not enough for Zombie Defense. Targets need to be distributed across a large base, and the AI must react when players add walls, open gates, or create a breach.
A base with one small opening illustrates the problem. A tower deep inside may be reachable only by walking around half the perimeter. Choosing it by path distance alone can make zombies abandon the wall directly in front of them.
Reachability and surface pressure
The map floods its pathing grid from the outside and tracks how deeply each target sits behind the player’s defenses. Exposed perimeter targets remain available, while a building reachable only through a long detour is treated as sheltered.
When a wall falls, nearby structures are re-evaluated immediately. Zombies at the breach can select newly exposed towers and units. Zombies elsewhere continue applying pressure to the perimeter.
Structures are targeted through standable approach points around their footprint. The AI chooses a reachable face near the zombie instead of issuing an order to the opposite side of the structure.
Roles
Zombie types use different priorities:
- Tanks and exploders strongly prefer barriers, creating reliable perimeter pressure.
- Fast or fragile melee zombies look for shallow living targets without being drawn deep into a base.
- Ranged zombies search for firing positions that let them shoot over a wall without pathing around it.
- Flying zombies ignore ground reachability, but still spread their attention across targets.
- Casters prefer living spell targets and preserve active cast orders.
Target scores blend distance, actual weapon threat, and toughness. Threat helps a nearby tower matter, but the value is capped so a powerful unit cannot pull the horde past every closer target.
Kiting and performance
Mobile targets are watched for real chase progress. If a worker or hero keeps pulling zombies away from useful pressure without being caught, those zombies eventually reacquire. Bosses use a stricter version of the same rule.
Reachability is cached and invalidated near pathing changes. Nearby zombies are looked up through a spatial index, and rotating target pools avoid a full scan for every unit on every update.
The decisions run in synced game state. Far openings, fresh breaches, ranged pressure, and moving bait are covered by scenario tests and replay diagnostics.
Browse the Zombie Defense AI source and its behavior contracts.