BlaziumGoapAction

Inherits: Node < Object

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

int

cost

1

Dictionary

effects

{}

bool

enabled

true

Dictionary

preconditions

{}

Methods

void

_enter() virtual

void

_exit() virtual

int

_get_cost(blackboard: Dictionary) virtual const

bool

_is_valid() virtual const

bool

_perform(delta: float) virtual

void

_prepare_action() virtual

void

apply_effects()

void

enter()

void

exit()

StringName

get_action_name() const

BlaziumGoapAgent

get_agent() const

int

get_cost(blackboard: Dictionary) const

BlaziumGoapGoal

get_goal() const

Variant

get_state(key: StringName, default: Variant = null) const

void

init(actor: Node, world_state: BlaziumGoapWorldState)

bool

is_valid() const

bool

perform(delta: float)

void

prepare_action()

void

set_state(key: StringName, value: Variant)


Property Descriptions

int cost = 1 🔗

  • void set_base_cost(value: int)

  • int get_base_cost()

Static execution path cost calculated by the AStar planner logic.


Dictionary effects = {} 🔗

Output property variables mapped automatically backward through the plan tracking into preconditions or goal state desires.


bool enabled = true 🔗

  • void set_enabled(value: bool)

  • bool is_enabled()

Determines cleanly whether this node is passed natively into the ActionPlanner's iteration tree graph!


Dictionary 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.


bool is_valid() const 🔗

Internal C++ valid checker tying into _is_valid().


bool perform(delta: float) 🔗

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.