Game AI: FSM, Behavior Trees & Pathfinding
/game-ai
NPC and enemy decision-making with state machines, behavior trees, steering and A* pathfinding, paired with your engine's navigation API.
- License
- Apache-2.0
- By
- By GameSkill
Part of
Awesome Gamedev Agent Skills
77 portable SKILL.md skills across 12 engines (Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox, Defold, Ebitengine), with a router.
Tested by GameSkill
34/34 checks passed on Godot 4.7.2 (2026-10-30): trigger, a runnable example, a screenshot and self-check, one job per skill, and English + Chinese docs. Trigger checks match prompts against skill descriptions; they are not a live agent run.
Test reportWhat this skill does
When it triggers
Design NPC and enemy decision-making with finite state machines, behavior trees, steering behaviors, and A* pathfinding — engine-neutral algorithms that pair with the detected engine's navigation API. …
GameSkill's tested copy
GameSkill's tuned build of this skill: the skill files from commit 19d93f97c9c1, plus our runnable example, test report, self-check list and Chinese guide, put through our skill process.
License: based on gamedev-skills/awesome-gamedev-agent-skills by gamedev-skills, under Apache-2.0. The ZIP keeps the license files (LICENSE, NOTICE) and lists everything GameSkill added in CHANGES.md.

Self-check
- 启发值要匹配移动方式:4 方向用曼哈顿,8 方向用 octile,不能高估 / Match the heuristic to allowed moves; never overestimate.
- 转向要朝下一个路点,不是直接朝目标 / Steer to the next waypoint, not straight to the goal.
- 路径按计时器或目标换格时重算,不要每帧算 / Repath on a timer or when the goal changes tile, not every frame.
- 状态转换写在状态里,不要到处散 if state == / Keep transitions inside states, not scattered if checks.
- 多帧动作的行为树叶子要返回 RUNNING,否则每帧重来 / Multi-frame BT leaves must return RUNNING.
Pairs well with
Install
Tell your AI
Install the skill from https://gameskill.dev/skills/game-ai/install.md
GameSkill's tested copy
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/game-ai.zip -o /tmp/gameskill-game-ai.zip
unzip -oq /tmp/gameskill-game-ai.zip -d .claude/skills
rm /tmp/gameskill-game-ai.zipWhat you get
- Worked steps: Finite state machine; Behavior tree tick; Steering: seek and arrive; A* heuristic must not overestimate
- A pitfalls section with the mistakes to avoid
- Bundled 2 reference docs the agent reads when needed
Good fit
- Building enemy AI, an FSM or behavior tree, steering/flocking, or pathfinding
Try this prompt
Make my enemies patrol, spot the player and chase them with A* pathfinding.About this skill
Design NPC and enemy decision-making with finite state machines, behavior trees, steering behaviors, and A* pathfinding — engine-neutral algorithms that pair with the detected engine's navigation API. Use when building enemy AI, an FSM or behavior tree, steering/flocking, or pathfinding, or when the user mentions state machine, behavior tree, blackboard, A*, navmesh, seek, or patrol/chase.
From the game-ai SKILL.md in gamedev-skills/awesome-gamedev-agent-skills.
What's inside
- Finite state machine (one state object, explicit transitions)
- Behavior tree tick (composite nodes return a status)
- Steering: seek and arrive (smooth, frame-rate independent)
- A* heuristic must not overestimate (or paths stop being shortest)
FAQ
Roguelike Combat & Boss Kit
6 production combat engines extracted from Zhaoshi Wulin in JS/TS, Godot 4 (.gd) & Unity (.cs): Boss Half-HP Hard Lock (100-70 -> 45 HP, shield never heal), Defense-Graded Rage, Dual-Channel Deterministic Crit, Clutch 1-HP Curve, Stagger AI & Priority Relic Bus.
- EP28 Boss Phase Lock: one-shot gate, 45 HP hard clamp, Shield-only (0 heal) + moveset upgrade
- EP27 Graded Rage + EP26 Deterministic Crit (17x1.5=25, zero 5-miss dry streaks)
Based on gamedev-skills/awesome-gamedev-agent-skills by gamedev-skills (Apache-2.0). The author's LICENSE and NOTICE files ship in the ZIP; ATTRIBUTION.md and CHANGES.md list the source commit and what GameSkill added.
Works well with
Skills the author points to as related or as the better fit for neighbouring tasks.
Game Physics Tuning
Stable, good-feeling physics: fixed timestep with interpolation, mass and drag, CCD against tunneling, jitter fixes and collision layers.
Procedural Generation
Procedural content with seeded RNG: Perlin and Simplex noise terrain, rooms-and-corridors dungeons and weighted loot tables.
Tower Defense
Build a tower defense: enemies pathing along lanes, wave spawning, towers that auto-target and fire, an economy, and lives.
FPS Shooter
Build a first-person shooter: move+mouse-look controller, hitscan or projectile shooting, weapons, health, and enemy AI.
More from Awesome Gamedev Agent Skills
See all 442D Platformer
Build a 2D platformer: run/jump control with coyote time, jump buffering, and variable jump height, plus tiled levels and hazards.
Behavior Trees & Utility AI
Build a behavior-tree runtime and a Utility AI system with response curves, plus hybrid agents where the behavior tree drives utility scoring.
Bevy ECS
Structure a Bevy app around ECS: plugins, components and resources, systems with Query and Commands, system ordering and Time.
Card Game
Build a card game: card data, deck/hand/discard zones, draw/shuffle/reshuffle, a turn structure, costs, and effect resolution.
Similar skills
Agent Sprite Forge
Five agent skills that turn one approved character still into a game-ready sprite set: one image-to-video clip per action, then deterministic Python tools key, register, loop, retime, palette-lock and export it for Godot, Aseprite and the web. Also maps, tiles and code-drawn art.
earshot: ears for coding agents (judge, find, time-align and make game sound on CPU)
Let an agent hear: rank sound-effect candidates against a description, find the clean trim in a long recording, tell real recordings from code-synthesised sound, check that every hit lands on its picture cut, and render effects from a bank of 252 code-made sounds. Runs locally on CPU with two open audio models (~1.1 GB, downloaded once); no API key needed.
One Sentence to Game (prompt, iterate, check)
A GameSkill original for any model: a round-1 prompt that turns one sentence into a small finished browser game, a one-change-per-round loop with a creation log, a reusable spec template, and a headless checker that reports console errors, blank frames and dead controls as PASS or FAIL. It does not promise one-shot.
Playtest Report (Claude Code Game Studios)
Structured playtest report template, or turn existing playtest notes into structured feedback.