-
Notifications
You must be signed in to change notification settings - Fork 62
DEV GOAP AI Framework
For a basic overview see GOAP (basic)
Goals and Actions use the same format for parameters.
Parameters is an array of [_tag, _value]
where _tag can be a string or number.
Goals are static classes. You DO NOT create a Goal object.
Goals have effects, relevance, predefined action and parameters.
Parameters typically come from a higher entity which gave this goal to an agent.
Goal Effects is the desired world state when goal has been reached. Effects are only required if the predefined action is not set. Effects can be static, derived from parameters and procedural.
-
Setting static effects: Code
-
Setting effects from parameters: Code (note the
true
passed as an argument, which indicates that it's derived from parameter) Framework will try to find a parameter with given tag and copy its value to specified world state property. -
Setting procedural effects: override Goal's ""getEffects" method. Do this when you can't just copy a parameter value into the Effects world state, but must use code to get it. For instance, getting a position of an object which is passed as parameter.
Calculate relevance in "calculateRelevance" static method.
If you don't need the planner to find an action plan for a goal, set its predefined action like this: code. If predefined action is not set, the planner will be run to find a plan to satisfy goal's effects.
Actions have preconditions, parameters, effects and cost.
Parameters are passed to an action from its effects or from the goal parameters. Action parameters are resolved in following order:
- Goal parameters are propagated into action parameters, if action has a parameter with given tag and is set to accept a goal parameter with this tag. Set an action's parameter from goal this way: code.
- Effects are propagated into corresponding action parameters. See below how to specify affect that are propagated into parameters. NOTE Currently you can't make an action's that has parameters from goal and from effects with the same tag!
Cost can be static or procedural. Set static cost: code. For procedural cost override "getCost" method of your action class.
Effects can be static or depend on a parameter.
-
Setting static effects: code.
-
Setting effects from parameters: code. Parametric effects are defined in a similar way to Goal parametric effects. Framework will pass the value to parameter with specified tag of the Action.
Preconditions can be static or procedural.
- Setting static preconditions: code.
- Setting procedural preconditions: override your action's "getPreconditions" method.
WIP
WIP
WIP
By Sparker, Jeroen, Sen, Marvis, BillW, Sebastian