BlaziumGoapAction
An action that an agent can perform to satisfy preconditions and apply effects to the world state.
Description
BlaziumGoapAction represents a single capability of an AI entity. The planner chains actions together if their effects satisfy another action's preconditions in order to reach the current goal. Action validity and costs can be modified dynamically via GDScript overrides.
Example usage:
class_name GatherWood extends BlaziumGoapAction
func _init():
set_name("GatherWood")
cost = 1
effects = {"has_wood": true}
func _perform(_delta: float) -> bool:
# Returning true indicates the action completed successfully.
return true
class_name BuildCampfire extends BlaziumGoapAction
func _init():
set_name("BuildCampfire")
cost = 2
preconditions = {"has_wood": true}
effects = {"has_campfire": true}
func _perform(_delta: float) -> bool:
return true
Properties
|
||
|
||
|
||
|
Methods
void |
_enter() virtual |
void |
_exit() virtual |
_get_cost(blackboard: Dictionary) virtual const |
|
_is_valid() virtual const |
|
void |
_prepare_action() virtual |
void |
|
void |
enter() |
void |
exit() |
get_action_name() const |
|
get_agent() const |
|
get_cost(blackboard: Dictionary) const |
|
get_goal() const |
|
get_state(key: StringName, default: Variant = null) const |
|
void |
init(actor: Node, world_state: BlaziumGoapWorldState) |
is_valid() const |
|
void |
|
void |
set_state(key: StringName, value: Variant) |
Property Descriptions
Static execution path cost calculated by the AStar planner logic.
Dictionary effects = {} 🔗
void set_effects_dict(value: Dictionary)
Dictionary get_effects()
Output property variables mapped automatically backward through the plan tracking into preconditions or goal state desires.
Determines cleanly whether this node is passed natively into the ActionPlanner's iteration tree graph!
Dictionary preconditions = {} 🔗
void set_preconditions(value: Dictionary)
Dictionary get_preconditions()
Required state values natively expected to exist before this Action can actually execute natively.
Method Descriptions
void _enter() virtual 🔗
Called securely by the Agent right before this action starts executing its _perform() loop natively. Use this to prepare state cleanly.
void _exit() virtual 🔗
Called securely by the Agent immediately after the action finishes or aborts. Use this to clean up dynamically managed objects.
int _get_cost(blackboard: Dictionary) virtual const 🔗
Calculates and returns the pathing cost. Override this to calculate dynamically contextual cost paths based on the simulated blackboard.
bool _is_valid() virtual const 🔗
Called constantly on every process frame directly from the Agent's traversal monitor. If this returns false dynamically, the current Goap plan natively breaks and forces a complete replan instantly.
bool _perform(delta: float) virtual 🔗
Executes the action logic per process tick. Return true when the action resolves its purpose cleanly.
void _prepare_action() virtual 🔗
Evaluated exactly once linearly BEFORE the A* planner actively generates branches. Use this to bind calculated preconditions/effects dynamically instead of processing them iteratively inside the planner's engine loop.
void apply_effects() 🔗
Writes the effects statically directly into the Agent's configured BlaziumGoapWorldState.
void enter() 🔗
Internal C++ binding triggering _enter().
void exit() 🔗
Internal C++ binding triggering _exit().
StringName get_action_name() const 🔗
Returns the object's configured node name natively.
BlaziumGoapAgent get_agent() const 🔗
Returns the BlaziumGoapAgent natively resolving this action.
int get_cost(blackboard: Dictionary) const 🔗
Internal C++ cost evaluator wrapping around _get_cost() and base cost.
BlaziumGoapGoal get_goal() const 🔗
Returns the exact goal currently orchestrating this instantiated process.
Variant get_state(key: StringName, default: Variant = null) const 🔗
Reads values natively from the Agent's linked BlaziumGoapWorldState.
void init(actor: Node, world_state: BlaziumGoapWorldState) 🔗
Registers internal pointers explicitly tying the agent bounds together natively.
Internal C++ valid checker tying into _is_valid().
Internal C++ wrapper signaling _perform().
void prepare_action() 🔗
Internal C++ wrapper signaling _prepare_action().
void set_state(key: StringName, value: Variant) 🔗
Writes values natively mapping down directly into the Agent's linked BlaziumGoapWorldState.