HomeGame DevelopmentGame AI: Behavior Tree + A* Pathfinding

Game AI: Behavior Tree + A* Pathfinding

Interactive game-AI sandbox: an NPC agent runs a real behavior tree (Patrol / Chase / Attack / Flee) and paths around obstacles with A* on a visible grid navmesh, replanning every time you move.

Game Development3DModerate60 FPS
gaming-ai ↗ Open standalone

This sandbox visualizes the two workhorses of classic game NPC AI side by side. A priority-selector behavior tree decides what the enemy agent should be doing right now — patrol, chase, attack or flee — and the sidebar diagram lights up whichever node is currently active. Underneath, an A* search runs over a visible grid navmesh every time the target changes, so the highlighted path always reflects the shortest walkable route around the obstacle blocks. Move the player with WASD or a click and watch the NPC's state and path react in real time.

⚙ Under the hood

NPC agent driven by a real priority-selector behavior tree (Patrol/Chase/Attack/Flee) that replans a live A* route across a grid navmesh every time its target cell changes.

Three.jsGame AIBehavior TreeA* PathfindingNPC

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)