Behavior Tree: node memory - How does it works

Hello,

I’m using behavior tree for my AI but I can’t find any information on how to use node memory.

I want to have a sequence node remembering the state of a In Progress node. For the moment I use a Move To node but my behavior tree stuck on it when the node result is In Progress instead of just my sequence parent.

The behavior I want is to flee player if in range, else move to a location. But if my behavior tree stuck on move to while it is not finished I cannot flee.

Thanks for your help.

I have a sort of workaround (maybe I misundestood unreal BT implementation and it is the correct way to do it), I added a decorator checking player is not in range and added an abort rule set to self. So the task seem to be aborted when player is in range.

96922-bt.png

But It can be very confusing to add these kind of decorators at different place, is it the correct way to do this kind of behavior ?

Node memory is available from C++ only. It is a dynamic allocated structure specified by programmer. You can use a service node and blackboard based decorators with enum (or other type) for simple scheduling behaviors.

Thanks for your answer.

Yes in C++ you can use a structure to keep data for your task, but I have no idea on how making a sequence returning to in progress node instead of all behavior tree. The root node goes directly to last in progress node, I want to do it locally, from direct parent as a sequence for instance, it avoids to skip a more important behavior in all the tree.

Do you know if this approach is possible with unreal BT ?

96956-service.jpg

Service is a dispatcher of behaviors. Decorator is a direct node which performs switching. Service contains logic and writes to blackboard variable. Decorator does switching.