BlaziumGoapGoal

Inherits: Node < Object

A goal that an agent attempts to satisfy using a sequence of actions.

Description

BlaziumGoapGoal defines a desired state that an AI agent wants to reach. When evaluated, the action planner attempts to find a path of BlaziumGoapAction sequences whose combined effects fulfill this goal's desired_state. The agent automatically prioritizes the goal with the highest priority.

Example usage:

class_name GoalSurvive extends BlaziumGoapGoal

var achieved := false

func _init():
    set_name("SurviveGoal")
    priority = 10
    desired_state = {"has_campfire": true}

func _on_goal_achieved():
    achieved = true

Properties

int

cost

0

bool

default_valid_state

true

Dictionary

desired_state

{}

bool

enabled

true

int

priority

0

Methods

void

_enter() virtual

void

_exit() virtual

int

_get_cost(blackboard: Dictionary) virtual const

int

_get_priority() virtual const

bool

_is_valid() virtual const

void

_on_goal_achieved() virtual

void

_on_goal_failed() virtual

void

_perform(delta: float) virtual

void

_prepare() virtual

void

enter()

void

exit()

StringName

get_action_name() const

BlaziumGoapAgent

get_agent() const

int

get_cost(blackboard: Dictionary) const

int

get_priority() const

void

init(actor: Node, world_state: BlaziumGoapWorldState)

bool

is_performing() const

bool

is_valid() const

void

on_goal_achieved()

void

on_goal_failed()

void

perform(delta: float)

void

prepare()


Property Descriptions

int cost = 0 🔗

  • void set_base_cost(value: int)

  • int get_base_cost()

A static cost modifier utilized by the A* calculation metric pathing.


bool default_valid_state = true 🔗

  • void set_default_valid_state(value: bool)

  • bool get_default_valid_state()

Determines baseline validity for tracking natively if no GDScript override acts upon the goal.


Dictionary desired_state = {} 🔗

The explicit dictionary requirements necessary to satisfy this goal natively through the action loop planner.


bool enabled = true 🔗

  • void set_enabled(value: bool)

  • bool is_enabled()

Flags whether the goal can natively be selected by the agent for processing.


int priority = 0 🔗

  • void set_base_priority(value: int)

  • int get_base_priority()

The raw priority used when calculating which goal assumes control. Higher priority takes precedent.


Method Descriptions

void _enter() virtual 🔗

Called natively right before the agent actively begins following the plan for this goal.


void _exit() virtual 🔗

Called natively right after the agent stops following the plan for this goal.


int _get_cost(blackboard: Dictionary) virtual const 🔗

Calculates dynamic cost evaluations. Used natively if the goal incorporates variable state weights.


int _get_priority() virtual const 🔗

Called conditionally when the Agent sorts goals. Returning a dynamic number here allows the goal to spike in priority dynamically based on health or real-time world events.


bool _is_valid() virtual const 🔗

Evaluated continuously while the goal is active or queued. Natively aborts the plan entirely if this suddenly returns false.


void _on_goal_achieved() virtual 🔗

Invoked securely exactly when all sequence actions finish cleanly natively matching the desired state organically.


void _on_goal_failed() virtual 🔗

Invoked securely when the A* planner cannot resolve a path, or an action breaks midway invalidating the sequence.


void _perform(delta: float) virtual 🔗

A tick function executing recursively inside the active Godot process frame while this specific goal manages the active plan natively.


void _prepare() virtual 🔗

Calculates variables linearly right before resolving dynamic traits in the agent loop natively.


void enter() 🔗

C++ wrapper triggering _enter().


void exit() 🔗

C++ wrapper 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 Goal.


int get_cost(blackboard: Dictionary) const 🔗

Evaluates the cost dynamically through _get_cost() and base cost.


int get_priority() const 🔗

Calculates final execution priority natively mapping _get_priority().


void init(actor: Node, world_state: BlaziumGoapWorldState) 🔗

Links references directly with the parent orchestration Agent.


bool is_performing() const 🔗

Returns true if this Goal currently holds control asynchronously.


bool is_valid() const 🔗

Internal validity checker wrapping _is_valid().


void on_goal_achieved() 🔗

C++ callback directly invoking _on_goal_achieved().


void on_goal_failed() 🔗

C++ callback directly invoking _on_goal_failed().


void perform(delta: float) 🔗

C++ frame loop invoking _perform().


void prepare() 🔗

Internal setup resolving _prepare().