Using the GoToAction as an example.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cfd794b0-82b5-4e16-978c-9391fd79c2f8/Untitled.png

Name: The name of the action that appears in the planner and debugger

Cost:

The planner use this value to rank and pick a set of actions that is the cheapest.

Default: The number here is a static value that is used by the planner to prioritize which action is cheaper to execute.

Evaluator: A cost evaluator can be placed here, allowing you to dynamically set the cost at runtime achieving Fuizziness AI. A new class need to inherit CostEvaluator.

public class FooCostEvaluator : CostEvaluator
{
    public override float Evaluate(IContext context)
    {
      return Random.Range(0,15);
    }
}

Usable Evaluator

This is called at the very beginning of the plan, so if this returns false, it won't even be considered part of the plan. An action may not be usable if it is not ready. Such as a charged attack will need to be 'fully charged' and this is often easier to be done via code. Wand.IsFullyCharged.

Default: Uses the cooldown by default and let your code handles most of it. Evaluator: Very similar to CostEvaluator, this allows you to dynamically and reuse evaluators, such as the WithinRangeEvaluator component.

public class Foo : UsableEvaluator
{
  public override bool Evaluate(IContext context)
  {
    return PlayerIsWithinRange;
  }
}

States

When adding or removing a state to an agent, the most important thing to consider is the condition.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d319893a-b5ca-4fef-a415-ac08ffd26929/Untitled.png

Below are the conditions and what they mean.

== EQUALS

< LESS THAN

GREATER THAN

! = DOES NOT EQUAL

Preconditions

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d2af6cac-6571-4bc4-ac15-b62ead33ffac/Untitled.png

A precondition is a state at which the GOAP Planner expects to be true before it puts the action in the plan. In the example above, there are two preconditions to start the action.