Logic¶
A GOAP AI system doesn't do anything by itself. It requires one or multiple Goals, comes up with a plan to solve each of them and picks the most beneficial one.
Setting up Goals¶
The instruction Add Goal allows you to add a new one to a specific Processor component and Action Plan.
Specify Action Plan
The Action Plan asset must be specified because the AI system might contain multiple Action Plan assets running as sub graphs.

The Name field determines the Belief that will be required to satisfy (meaning it evaluates to True) in order to consider the Goal as completed.
The Weight is a value that determines how important this goal is when coming up with a plan that resolves it. The higher the weight, the higher the priority. This allows you to prioritize some goals higher than others.
Minimum Weight
The minimum value of a Weight is 1. Any lower value will be considered as 1.
Goal Priorities
Let's say we have two goals: Stay-Alive and Kill-Enemies and the AI system comes up with a plan for each with the following total costs:
Stay-Alivewith a total Cost of 5Kill-Enemieswith a total Cost of 3
If both goals have the default Weight of 1, each plan is scored by dividing the goal's weight by the plan's total cost:
Stay-Alivewith a score of (1 / 5) = 0.2Kill-Enemieswith a score of (1 / 3) = 0.33
In this case, because killing enemies has a lower cost, it would be picked up over staying alive. However this doesn't make sense, because a character should focus on self-preservation first.
In this case, we can give the Stay-Alive goal a Weight of 2, yielding the following new results:
Stay-Alivewith a score of (2 / 5) = 0.4Kill-Enemieswith a score of (1 / 3) = 0.33
Now staying alive will be prioritized unless killing an enemy comes at a very small cost.
Just like adding goals, to remove a Goal use the Remove Goal instruction.
Planning¶
Once an Action Plan has one or more Goals it can come up with a plan, which is only done if there's not an ongoing plan being executed.
The GOAP algorithm starts coming up with a plan for each Goal, and if there are multiple plans for the same goal, stores the one with the lowest cost.

Once it has zero or one plan for each Goal it scores each one using their Weight value (divided by the total cost of the plan) and picks the one with the highest score. After that it starts executing the chosen plan until it finishes or is aborted by a Condition.