I’m trying to figure out the best option for communicating between two different behavior trees. It seems that events are global to a particular tree only. Other trees (including subtrees) don’t see events generated by a tree.
I found the blackboard, which seems to be truly global across all the behavior trees from the root on down. This is currently what I’m using, but it’s not really documented, and doesn’t appear in sample code, which makes me wonder if it’s going away at some point.
Here’s my main use case for this kind of thing:
I set off the “idle.bt” from the sample code in parallel with some of my skill, so Jibo looks around at random while doing stuff, and isn’t static. I control the parameters of the looking (how wide the gaze is), by placing the functions the idle bt uses to randomly pick the look point on the blackboard, and changing those functions in other behavior trees. (That’s the first use.)
The other use is when I want to play an animation from another behavior tree. If I just play it, the idle behavior tree takes over and starts looking around partway through the animation. So I set a flag variable on the blackboard that the idle can use, and skip its normal motions if another behavior tree set the flag.
Are there other ways of doing this? I don’t really want to stick everything in one big behavior tree - it would get unwieldy. Are there ways of sending events between behavior trees? Will the blackboard always be around?