The reader who types game ai development into Google in 2026 is building a game — not shopping for a code assistant. They want the AI that runs inside the game: the goblin that patrols a corridor, the boss that decides whether to heal or press the attack, the shopkeeper NPC that remembers the player picked a fight last chapter. This article is the honest 2026 pattern set — finite-state machines, behavior trees, A* pathfinding, and the newest arrival, LLM-driven NPCs — plus the exact way to prompt WizardGenie to generate the full stack from plain English. Every concept here is live-verified against the authoritative source (Wikipedia's behavior tree, A*, and FSM articles; Phaser's own docs; MDN's game-dev tree) on 2026-10-06.
What people typing game ai development actually want
DataForSEO lists game ai development at 720 monthly searches, keyword difficulty 29, competition 0.30, intent commercial (verified 2026-10-06 against tools/research-output.md, AI Game Dev umbrella cluster). The important thing about this query is what it is not. The reversed-word-order phrase ai game development — also 720/mo — targets AI-assisted tooling: code assistants, asset generators, playtest bots. game ai development targets the opposite: the AI that runs inside the shipped game. Same two words, opposite intent. A reader who conflates the two picks the wrong article and bounces, which Google notices.
What changed in 2026 is not the patterns — FSM, behavior tree, A*, utility AI have all been stable since the mid-2000s. What changed is that an LLM can now plausibly handle the "dialogue and personality" slot that used to be hand-scripted dialogue trees, and a dual-agent coding flow can write every FSM and behavior tree in your project from a plain-English brief. The rest of this article walks the four patterns, when to pick each, and the exact prompt shapes that produce shippable enemy AI code on WizardGenie.
The four patterns every indie needs in 2026
Not every game needs every pattern. The honest decision tree:
- Finite-state machines (FSM) — three to seven states, clean transitions, one state active at a time. The right pick for jam games, platformers, shoot-'em-ups, and anything where enemies have 3-5 distinct behaviors. Cheap per tick, trivial to debug, the first thing anyone writing a game loop ends up with.
- Behavior trees (BT) — hierarchical trees of tasks the engine ticks each frame, with fallback and sequence nodes composing complex behavior out of simple building blocks. The right pick when the cast grows past a handful of enemy types, when a single enemy layers behaviors (patrol while scanning while listening), or when designers want to tweak behavior in a visual editor instead of reading code. The Wikipedia Behavior tree article (verified 2026-10-06) lists Halo 2, BioShock, and Spore as the games that drove behavior trees into mainstream game AI; both Unity and Unreal ship them as first-class systems today.
- Utility AI — each possible action gets a score from a weighted set of considerations (how hungry? how injured? how close is the player?), and the NPC picks the highest-scoring action each tick. The right pick for strategy games, sims, and sandbox worlds where behavior should feel driven by shifting internal state. Rarely needed for action games.
- LLM-driven NPCs — a language model generates dialogue, remembers the player across sessions, and (optionally) picks high-level goals the FSM or behavior tree then executes. The 2026-specific addition. Pairs with the other three patterns, not in place of them — the LLM handles dialogue and planning, the FSM handles the actual tick-by-tick behavior, because running a model every frame is wasted budget.
Pick FSM first. Graduate to behavior trees when the FSM state count passes about seven. Add A* the moment enemies navigate around obstacles. Add LLM-driven NPCs only when the game has dialogue worth generating. Most indie projects ship FSM + A*; most RPG-shaped projects ship all four.
Finite-state machines for small casts
Verified 2026-10-06 against the Wikipedia Finite-state machine article: an FSM is an abstract machine that is exactly one of a finite set of states at a time, with transitions between states triggered by inputs. In game AI, the "input" is usually something the NPC can sense (line-of-sight to the player, distance to a waypoint, elapsed time) and the "state" is the current behavior (idle, patrol, chase, attack, flee).
A goblin FSM for a 2D platformer, in the shape the Executor actually writes:
class Goblin {
constructor() {
this.state = 'patrol';
this.chaseTimer = 0;
}
update(dt, player) {
switch (this.state) {
case 'patrol':
this.walkTowardWaypoint();
if (this.canSee(player)) this.state = 'chase';
break;
case 'chase':
this.walkToward(player);
if (!this.canSee(player)) {
this.chaseTimer += dt;
if (this.chaseTimer > 5) {
this.state = 'patrol';
this.chaseTimer = 0;
}
} else if (this.distanceTo(player) < 1) {
this.state = 'attack';
}
break;
case 'attack':
this.swingSword();
if (this.distanceTo(player) > 2) this.state = 'chase';
break;
}
}
}
Three states, three transitions, under 30 lines. This is the entire budget for most jam-grade enemies. Constant time per tick, trivial to debug (print the current state), maps 1:1 onto every mainstream engine. The honest FSM ceiling in practice is seven to ten states — past that, you spend more time maintaining the transition table than writing new behavior, and transitions start stealing priority from each other. That is the signal to graduate.
Behavior trees when the cast grows
Verified 2026-10-06 against the Wikipedia Behavior tree article: a behavior tree is a directed tree where the root ticks its single child, which ticks its children, and so on down to leaves. Each node returns one of three statuses — Running, Success, or Failure — and the control-flow nodes above decide what to tick next. The two primary control-flow nodes are Selector (fallback), which ticks children left-to-right until one returns Success or Running, and Sequence, which ticks children left-to-right until one returns Failure or Running.
A behavior tree for the same goblin, grown with a "scan for cover" layer that an FSM would struggle with:
root (selector)
├── sequence: ATTACK
│ ├── canSee(player)?
│ ├── inRange(player, 1)?
│ └── swingSword()
├── sequence: CHASE
│ ├── canSee(player)?
│ └── walkToward(player)
├── sequence: SCAN
│ ├── heardSound()?
│ └── turnToward(sound)
└── sequence: PATROL
└── walkTowardWaypoint()
The root is a Selector, so it ticks top-to-bottom and runs whichever branch succeeds first. Adding "flee if low HP" is one more branch above ATTACK. Adding "call for backup" is one more branch below CHASE. The tree composes without rewiring — the exact property FSMs lack past seven states. The Wikipedia Behavior tree article names Halo 2 as the first high-profile shipping behavior tree (Damian Isla's GDC 2005 talk is the canonical reference), followed by BioShock and Spore. Both Unity and Unreal ship behavior-tree systems today. The pattern is mature, well-understood, and heavily documented.