WASD / arrows to move · click floor to walk there
Player NPC A* path Obstacle
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Game AI: Behavior Tree + A* Pathfinding

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.