Blackboard

Inherits:

A key/value storage for sharing among LimboHSM states and BehaviorTree tasks.

Description

Blackboard is where data is stored and shared between states in the LimboHSM system and tasks in a BehaviorTree. Each state and task in the BehaviorTree can access this Blackboard, allowing them to read and write data. This makes it easy to share information between different actions and behaviors.

Blackboard can also act as a parent scope for another Blackboard. If a specific variable is not found in the active scope, it looks in the parent Blackboard to find it. A parent Blackboard can itself have its own parent scope, forming what we call a “blackboard scope chain.” Importantly, there is no limit to how many Blackboards can be in this chain, and the Blackboard doesn’t modify values in the parent scopes.

New scopes can be created using the BTNewScope and BTSubtree decorators. Additionally, a new scope is automatically created for any LimboState that has defined non-empty Blackboard data or for any root-level LimboHSM node.

Methods

void

bind_var_to_property ( StringName var_name, Object object, StringName property, bool create=false )

void

erase_var ( StringName var_name )

Blackboard

get_parent ( ) const

Variant

get_var ( StringName var_name, Variant default=null, bool complain=true ) const

bool

has_var ( StringName var_name ) const

void

link_var ( StringName var_name, Blackboard target_blackboard, StringName target_var, bool create=false )

void

set_parent ( Blackboard blackboard )

void

set_var ( StringName var_name, Variant value )

Blackboard

top ( ) const

void

unbind_var ( StringName var_name )


Method Descriptions

void bind_var_to_property ( StringName var_name, Object object, StringName property, bool create=false )

Establish a binding between a variable and the object’s property specified by property and object. Changes to the variable update the property, and vice versa. If create is true, the variable will be created if it doesn’t exist.


void erase_var ( StringName var_name )

Removes a variable by its name.


Blackboard get_parent ( ) const

Returns a Blackboard that serves as the parent scope for this instance.


Variant get_var ( StringName var_name, Variant default=null, bool complain=true ) const

Returns variable value or default if variable doesn’t exist. If complain is true, an error will be printed if variable doesn’t exist.


bool has_var ( StringName var_name ) const

Returns true if the Blackboard contains the var_name variable, including the parent scopes.


Links a variable to another Blackboard variable. If a variable is linked to another variable, their state will always be identical, and any change to one will be reflected in the other. If create is true, the variable will be created if it doesn’t exist.

You can use this method to link a variable in the current scope to a variable in another scope, or in another Blackboard instance. A variable can only be linked to one other variable. Calling this method again will overwrite the previous link. However, it is possible to link to the same variable from multiple different variables.


void set_parent ( Blackboard blackboard )

Assigns the parent scope. If a value isn’t in the current Blackboard scope, it will look in the parent scope Blackboard to find it.


void set_var ( StringName var_name, Variant value )

Assigns a value to a Blackboard variable.


Blackboard top ( ) const

Returns the topmost Blackboard in the scope chain.


void unbind_var ( StringName var_name )

Remove binding from a variable.