system

Use when

A design needs enemies that move and decide, and you want them to feel intelligent without being unfair or opaque.

Enemy AI

What it is. The decision + movement an enemy runs each tick: who to target, whether to press or retreat, and how to get there without walking into a wall. Good enemy AI is not smart — it is legible. The player must be able to read its intent, predict its next move, and beat it with position and timing.

Player fantasy / why it’s fun. The fantasy is outwitting a mind. That only lands if the mind is knowable: a shark that telegraphs its lunge is thrilling; one that teleports behind you is cheap. The skill the player buys is reading and routing — FUN.md §4’s kiting bot exists because “the enemy is beatable by positioning” is a provable claim.

When to use / when NOT

Use it whenSkip it / go simpler when
Enemies must chase, flank, or hold groundBullet-hell foes: they emit patterns, not decisions (§7) — script the pattern, not a brain
The player’s skill is spacing & threat-readingPure puzzle enemies: they’re rules, deterministic and solver-legible (§1, §12)
You want emergent pressure from a few archetypesA single scripted boss: hand-author phases (system-boss-design), don’t build a general AI
Mass units under command (RTS)One enemy, one behavior: a state flag beats a behavior tree

Never build a mind the player can’t read. Perfect aim, wall-hacks, and reaction-time-zero are the difficulty of a slot machine. Difficulty comes from count, geometry, and telegraph windows — not from the AI cheating.

Variants

VariantThe mindReads asBest for
Direct seekersteer straight at the target”it wants me”swarms, zombies (§6)
Flow-field massone BFS per goal, every unit follows the field”the tide is coming”RTS-lite, hordes (§9)
Kiter / spacerhold a preferred range, back off when close”keep your distance”archers, ranged skirmishers (§4)
Ambusherwait in a state until a trigger, then commit”don’t step there”stealth, traps (§5)
State-machine bruiseridle → aggro → windup → attack → recover”here comes the swing”melee bosses, mini-bosses (§4)
Threat-drivenpick target by an aggro/threat score, not proximity”I pulled it”party fights, taunt play

Tuning levers

LeverTurns up…Watch for
Aggro radiuswhen the enemy notices youtoo large = no safe pockets (system-encounter-design)
Threat weightswho it targets (damage dealt, distance, taunt)must be deterministic & ordered — ties break by entity id, never by iteration order
Preferred range (kiters)the spacing the fight settles atrange < player reach = it’s just a melee foe
Windup / telegraph framesthe reaction window before a hittoo short = unreadable; own this in system-telegraphs
Steering deadzonejitter vs. commitment near the targettoo tight = enemies vibrate on the spot
Repath cadencehow fast it reacts to you movingevery frame = twitchy & expensive; every N frames = readable

How it wires to Hayao

Fails when…

Verify

Composes with

See also

This module rendersthe repo's markdowndirectly — edit it there, it changes here.