Define a behavior tree with a typed blackboard.
The blackboard value serves as both the type source and the default initial state cloned for each entity via createBehaviorTree.
blackboard
createBehaviorTree
Unique identifier for this tree definition
{ blackboard, root } — default blackboard + root node
{ blackboard, root }
Frozen BehaviorTreeDefinition
const tree = defineBehaviorTree('patrol', { blackboard: { targetId: null as number | null, timer: 0 }, root: selector([ guard(ctx => ctx.blackboard.targetId !== null, action('chase', ...)), action('wander', ...), ]),}); Copy
const tree = defineBehaviorTree('patrol', { blackboard: { targetId: null as number | null, timer: 0 }, root: selector([ guard(ctx => ctx.blackboard.targetId !== null, action('chase', ...)), action('wander', ...), ]),});
Define a behavior tree with a typed blackboard.
The
blackboardvalue serves as both the type source and the default initial state cloned for each entity viacreateBehaviorTree.