Instinct GOAP Framework
Two APIs over the same planner. The Flow API is one domain file plus action classes, ... The four ... Fully customizable in the sense that matters for a planner: facts, actions, goals,
by Azen
Price History +
• Free, MIT-licensed, full C# source — no DLLs, no attribution required, usable in commercial projects
• Forward A* planner over a dense, typed world state
• Utility-based goal selection — each replan scores goals as priority minus plan cost, with exact pruning that skips goals which cannot win
• Typed facts and keys: Fact<bool>, Fact<int>, Fact<float> and enum-backed facts, no magic strings
• Engine-free core assembly with no UnityEngine reference — unit-testable outside Unity
• Two entry points: GoapBrain<TCtx> (Flow API) and GoapAgent<TCommand> + GoapAgentHost (Command API)
• Async actions via UniTask, or IStep composition with no dependency at all
• Domain validation catches unreachable goals, dead actions and broken effects before Play Mode
• GoapExplain answers "why this goal", "why no plan", "why is this action never used"
• GOAP Graph window (Window → Analysis → GOAP Graph) draws the domain and highlights the running plan
• Four sample scenes with source: Chef, Farmer, Guard, Stalker A-Life
• Full EditMode test suite included, plus per-sample tests
• Unity 2022.3 LTS or newer, Mono and IL2CPP, all render pipelines
• Optional: UniTask 2.5+ for the async action layer (not bundled, assembly is skipped without it)
• Sample scenes use TMP labels — import Window → TextMeshPro → Import TMP Essential Resources once
You describe facts, actions and goals. Instinct GOAP decides what the agent does
next — and tells you exactly why it decided that.
Behaviour trees and state machines make you author the transitions. GOAP makes you
author the world instead: what is true, what each action needs and changes, what the
agent wants. The planner finds the path. Add an action and every goal that can reach
it starts using it, with no graph to rewire.
Two APIs over the same planner. The Flow API is one domain file plus action classes,
for new agents and gameplay code you own. The Command API emits a command enum you
translate yourself, for slotting the planner into an existing state machine or
command bus without rewriting it. Pick one per agent.
Genre-agnostic, because it plans over your data, not over a scene format. The four
sample scenes are deliberately different shapes: a chef running a kitchen queue, a
farmer with an energy economy, a guard on patrol with alert states, and a stalker
A-Life agent with survival drives.
Fully customizable in the sense that matters for a planner: facts, actions, goals,
costs and goal-selection policy are all your own C# — there is no visual graph to
fight and no asset format to conform to. Action behaviour is either an async method
or composed steps.
Honest about scale: every replan clones world state, roughly 34 KB per replan and
750 B per agent per tick on a 57-fact domain. Comfortable for dozens of agents.
Not built for hundreds on mobile, and the Performance page in the docs says so with
numbers rather than promises.
Documentation is a nine-page handbook, also shipped as one offline HTML page, plus a
Ukrainian guide. Every sample has tests you can read as executable documentation.