Mixing Behaviour Trees with State Machine, is it possible?

I was watching this talk in GDC youtube channel about Behaviours Tree best practices and Bobby Anguelov gives this awesome idea of using behaviour trees inside a state machine, the problem is that I have no ideia how to achieve that in Unreal Engine, Anyone got any clues or tips on how or if that would possible?

Here is the link for the video and one screenshot of how would that work, the part im talking about starts at 33 minutes.

AI Arborist: Proper Cultivation and Care for Your Behavior Trees](AI Arborist: Proper Cultivation and Care for Your Behavior Trees - YouTube)

2 Likes

Hey, Im also interested in this, did you find a way how this works? I mean in the video they talk about to combine it and not to transition to other states in the BT , but does that mean that there should be a finite state machine in the character which transitions the different states and the BT just reads the states and does actions regarding those?

1 Like

I work with BTs, FSM, and Rules-based AI on a regular basis. I use rudimentary StateMachines (Name Datatype Variable and Switch_on_Name Selector) very often to control ā€˜non-blocking processingā€™ loops.

Although, I donā€™t see a huge advantage to using BTs with FSMs, Iā€™ve seen many UE4 BT implementations use a concept of a ā€˜Stateā€™ Blackboard Key. Even if you use a BT inside StateMachine, you just end up with a More Complex Hierarchal State Machine.

UE4 uses a State Machine in the Skeletal Mesh Animation Blueprint. It has its own Editor Nodes and Connection types (just as BT has its own). Theoretically you could use a dummy skeletal mesh/animation with the AnimBPā€™s to create a State Machine to control game logic. I have not tried this.

But it helps me visualize how you could use a BT within State Machine. My current thought on it would be to share the variables/values between the BT Blackboard and AnimBP State Machine Transition Rules. I think if the BT and SM had used the same Editing Nodes, it would even easier to do it.

3 Likes

Btw recently in UE 5.1 ā€œStateTreeā€ became production-ready and its literally FSM + BTH in one awesome tool

1 Like