Squirrel · C++ · Godot · PPO
NPC behavior that stays portable.
A deterministic finite-state machine for game characters, separated from the engine by one small world adapter.
=== SQUIRREL NPC BEHAVIOR DEMO ===
[t= 0.0] Guard PATROL
[t= 3.0] suspicion rising...
[t= 5.0] Guard CHASE
[t= 8.0] Guard ATTACK
[t=12.0] target escaped
[t=12.5] Guard SEARCH
[t=17.0] Guard RETURN
▸ deterministic behavior, engine-independent
See it in motion
From patrol to pursuit.
The real Squirrel demo runs the guard through patrol, detection, chase, attack, search, and return.
The idea
Keep decisions separate from the world.
The guard decides what to do. Your engine decides how the world responds.
Game engine
Physics, raycasts, navmesh, animation, combat, and rendering stay in your engine.
raycast()navigate()play_animation()World adapter
One small seam translates engine services into a stable contract.
world.canSee()world.moveToward()world.emit()Guard FSM
Predictable, testable decisions that run anywhere Squirrel can run.
Plug it in
One behavior. Many worlds.
Start with the demos, then replace each adapter callback with your engine's systems.
Native C++
Embed the Squirrel VM and bind perception, movement, and events.
Embedding guide ↗Godot 4
FOV, raycast occlusion, NavigationAgent2D, target mapping, and event signals.
Godot example ↗Perception
Configurable facing cone with an optional occlusion hook for real visibility.
See perception.nut ↗Experimental ML
Learn tactics. Keep control.
The deterministic FSM remains the safety layer. A PyTorch PPO policy learns tactical recommendations in a synthetic Gymnasium world, ready for evaluation in Kaggle.
Run training on Kaggle →Open source · v0.2.0
Build behavior, not a black box.
Read the code, run the demos, and bring the adapter to your game.