GOAP, short for Goal-Oriented Action Planning, is a decision-making model where an agent does not follow one fixed behavior chain. Instead, it selects a desired goal, searches for a valid sequence of actions, and executes that sequence to transform the current world state into the target state. In this system, the planner works on boolean world facts stored in the Blackboard, compares them against goal conditions and action preconditions, and uses action effects to build a path toward the goal. In Flow Core, this planning process is centered around GoapRoot, GoapGoal, and GoapAction.
A GOAP setup in Flow Core is made of four core parts:
GoapRoot is the planner container. It owns all goals and actions under the same planning domain, runs the planning search, and executes the resulting plan. GoapGoal represents a desired state of the world. GoapAction represents one executable step the agent can take. Facts and effects are boolean Blackboard values that describe world state before and after actions. Goal priority is numeric, and lower values mean higher urgency. A priority of 0 is evaluated before a priority of 1.
GOAP is most useful when behavior should emerge from conditions and available actions rather than from a rigid, hand-authored branch structure. It fits well when:
Typical examples include patrol/chase/attack AI, multi-step resource gathering, emergency override goals, and dynamic replanning in changing combat or simulation scenarios.
At a high level, the runtime loop works like this:
The planner gathers all active goals, sorts them by ascending priority, and tries to build a plan for each goal. If a valid plan exists, it chooses the first plan found at the highest-priority tier, and within that tier prefers the one with the lowest total cost. It then subscribes to Blackboard facts used by that plan, executes actions in order, rechecks preconditions before each action, and replans when watched facts change or when an instruction explicitly requests replanning. If no valid plan exists, the No Plan output fires and the root waits for a future replan opportunity.
This means GOAP in Flow Core is not a one-shot offline planner. It is an active runtime system that reacts to Blackboard changes while actions are being executed.