/game-ai:game-aifrom game-ai
Designs NPC and enemy decision-making in any engine - finite state machines, behavior trees, utility AI, steering and flocking, A*, flow fields and navmeshes, perception and difficulty knobs. Use for enemy AI, patrol/chase/flee logic, a behavior tree or blackboard, utility scoring, pathfinding, or "the enemy gets stuck".
Ships in game-ai. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Build NPC behavior from three separate layers: decide (what to do), path (how to route there) and steer (how to move along the route). A behavior tree picks a target, the pathfinder returns waypoints, steering follows them. Keep each layer swappable and testable on its own.
Not for: an engine's concrete navigation API (in Godot, NavigationRegion/NavigationAgent, baking, avoidance and layers live in the godot skill's navigation reference), addon APIs such as beehave or LimboAI (godot-addons), state-machine architecture for non-AI game state (game-architecture), movement and collision feel (game-feel, godot-physics), wave spawning and lanes (tower defense), procedural maps (level-design).
State base class. Extend what is there instead of adding a second framework.| Situation | Model |
|---|---|
| 2 to 5 named states with obvious transitions (idle, patrol, chase, attack, dead) | FSM |
| Many behaviors with priorities, interruption, reuse across enemy types | Behavior tree |
| "How much do I want each option right now": targets, needs, item or ability choice | Utility AI |
| Combat with a clear structure plus graded sub-choices | BT outside, utility inside one branch |
Start with an FSM. Promote a state to a behavior tree when its transition logic outgrows a few ifs. Many shipped games run an FSM for top-level mode (Idle, Combat, Dead) and a BT inside Combat. Name the rejected model in the design note so the next reader knows it was considered.
state.enter(agent); state.update(agent, dt) -> next_state or none; state.exit(agent)
tick(dt):
next = current.update(agent, dt)
if next: current.exit(agent); next.enter(agent); current = next
if state == X checks scattered across the codebase.enter/exit, not in whichever transition happens to fire.Read references/behavior-trees.md before writing or reviewing a BT runtime or tree: the status contract, memory versus reactive composites, Reset() on aborted branches, decorators, the blackboard, and tick cadence.
Read references/utility-ai.md before writing a utility scorer: response curves, the compensation factor, hysteresis, softmax selection, and the hybrid BT leaf.
Perception writes facts to the agent's memory (the blackboard); decisions read them. Never raycast inside a decision node.
Read references/pathfinding.md when implementing A* by hand, picking a heuristic, building a flow field, smoothing a grid path, or deciding between a grid and a navmesh.
Steering turns a desired direction into velocity changes, so agents accelerate, turn and stop smoothly.
seek(target): desired = normalize(target - pos) * max_speed
return clamp_length(desired - vel, max_force)
arrive(target): like seek, but desired speed = max_speed * min(dist / slow_radius, 1)
and when dist is near zero return -vel to cancel drift
integrate: vel += steering * dt; vel = clamp_length(vel, max_speed); pos += vel * dt
Tune difficulty through what the AI perceives and how fast it acts, not by inflating health or damage.
| Knob | Easier | Harder |
|---|---|---|
| Reaction delay | 0.6 s | 0.2 s |
| Aim error (cone or offset) | wide, narrowing over a burst | tight from the first shot |
| Sight range and cone | short, narrow | long, wide |
| Memory of last-known position | forgets fast | searches thoroughly |
| Attack tokens (how many attack at once) | 1 to 2 | 3 to 4 |
| Flanking and grenades | off | on |
godot (navigation reference), godot-addons (beehave, LimboAI): engine and addon APIs.game-architecture: state machines for non-AI game state, event buses, data-driven design.game-performance: profiling when AI shows up in the frame budget.level-design: the generated or authored spaces agents navigate.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub adminhead/claude-plugins --plugin game-ai