Hello.
I am setting up a framework for AI. Goal oriented planning goes in Blueprints. And low level compact reusable tasks are in Behavior Trees. To achieve that I need to dynamically switch between Behavior Trees.
After spending a good amount of time on research, it seems that Blueprint implementation for Behavior Trees doesn’t allow me to structure the system properly.
- There is no way to swap full Behavior Trees. Unreal assumes there’s one BT for one AIController or BehaviorTreeComponent. But there’s Dynamic BT nodes!
- Dynamic BT nodes can only be assigned with SetDynamicSubtree function of BehaviorTreeComponent, there’s no way to use a variable from Blackboard
- Unfortunately, BehaviorTreeComponent does not have any way to extract its Blackboard. Which is required to control the execution of BT from Blueprint (Abort it gracefully).
- There is BlackboardComponent, the purpose of which is rather mysterious. Is there any way to make them friends with BehaviorTreeComponent?
- Having a BehaviorTreeComponent on an AIController is itself a questionable move, because AIController can play BTrees without additional components through RunBehaviorTree node. Why there’s 2 entities that both can play BTs?
- Additionally, AIController has a useful local Blackboard variable, which is assigned with BT’s blackboard when it starts to play
- There is one huge downside of AIController though: RunBehaviorTree is the only public function of AIController regarding BTs, so there’s no way to control the execution or use dynamic BTs
Vicious circle.
I am either missing some key knowledge, or the Blueprint implementation is indeed rather limited, scattered and unfinished?
I would very much appreciate a developer with a deeper understanding to guide me and shed some light on how to implement this.
A bonus question: is it easier to work with BTs using C++?