Enemy AI Framework
High-Level Overview: Every enemy in the game is assembled from one shared behaviour core plus its own decision graph. The core owns everything enemies have in common (noticing, chasing, attacking, taking damage, dying, respawning), so an individual enemy is defined entirely by how it decides what to do next. Designing a new enemy means designing a decision, not designing an enemy from scratch.
The Shared Core
These behaviours are true of every enemy without being specified per enemy:
- Sleep and wake. Enemies think only when a player is nearby, waking at 35m and sleeping again at 45m. Enemies are cheap to place in bulk.
- Damage. Hit points are counted in hits, not chip damage. A short invulnerability window after each hit (0.2s) stops one sustained attack draining a whole bar in a single pass, and every hit plays a colour flash.
- Death. A poof effect, an optional pickup dropped onto the ground beneath where the enemy died (so an enemy killed in mid-air still drops something reachable), and a respawn after a long delay.
- Death feel. A killing blow applies only half the normal knockback, so a defeated enemy pops back and dies snappily instead of sailing off screen.
- Alerts. A
!popup the moment an enemy first notices a player, and a second popup when it commits to an attack.
The Shared Tuning Vocabulary
Every enemy is tuned with the same six numbers, so these words mean the same thing across the whole roster.
| Term | Typical | Meaning |
|---|---|---|
| Aggro range | 10m | Distance at which the enemy notices a player and gives chase. |
| Attack range | 1.5m | Distance at which it commits to an attack. |
| Leash range | 10m | Distance from home past which it gives up and walks back. |
| Windup | 0.6s | The telegraph. The player's window to read the attack. |
| Active | 0.5s | The hit frames. |
| Recovery | 1.9s | The punish window. The player's window to hit back. |
Windup and recovery are the two numbers that decide whether an enemy is fair. Windup is what the player reads; recovery is what they are rewarded with. Everything else is pacing.
The Standard Loop
Most enemies run the melee graph:
Idle or Patrol → Chase → Windup → Attack → Recover → Chase
↓ (leashed)
Return Home → Idle or Patrol
Enemies that fight at range replace the middle of this with a decision step that picks between two or more attacks by distance and cooldown.
Patrols are optional and come in two shapes: ping-ponging between placed points, or wandering at random around the spawn. An enemy with no patrol simply idles where it stands.
How Enemies Answer the Duo's Abilities
An enemy opts into each of the duo's tools individually. This is the main lever for making an enemy feel like part of the combat system rather than an obstacle sitting beside it.
| Ability | Effect on an enemy that accepts it |
|---|---|
| Koopa's bubble | Traps the enemy. A bubbled enemy is a homing target for Koopa's spin: trap, then pop. |
| Kiko's tornado | Sweeps the enemy up. The tornado is always the kill: the enemy dies inside the funnel and the corpse is flung clear. |
| Melee and projectiles | Received through a single hurtbox. Kiko's peck is granted extra reach, because his beak strikes ahead of his body. |
Related
- Systems - Koopa Abilities and States · Systems - Kiko Abilities and States
- Systems - Collectables: enemies drop pickups on death
Linked from
- Bud
- Collectables
- Kiko: Abilities and States
- King Kragg
- Koopa: Abilities and States
- Medium Crab
- Out of Water
- Small Crab
- Snakelet