Should the Behavior Tree Task or Decorator Break out of a Task that Runs Over Several Frames?

Hello! Unreal newbie here.

berries
I’m making a game like the classic Mario Party Bumper Balls - each player or AI agent controls a berry and tries to push the other ones off the plate.


I have a simple Behavior Tree controlling the AI. First the berries select a target. Then, if they’re near the edge of the plate, they roll closer to the center. Once they’re away from the edge of the plate, they chase down their target.

Some details: I’ve elected to use custom Behavior Tree Tasks to move the berries. I’m not using the NavMesh system - the AI just uses AddMovementInput, the same as the PlayerController.

In following the Behavior Tree Quick Start Guide, I used the Event Receive Execute AI and Finish Execute nodes in my custom blueprint tasks. However, I noticed my AI opponents were rolling slower than my player controlled berry. I believe using those two nodes are slower than running code on the Tick event.


Following the advice in this thread, I’ve swapped the event for Receive Tick AI and removed Finish Execute. This has fixed the slow AI issue.

However, now I’m not sure how to have the Behavior Tree correctly break out of the BTT_AvoidEdge node, since I’m not calling FinishExecute anymore.


It would be logically clean if the BTD_CheckNearEdge decorator could return fail once the berry was away from the edge. But when I add a print statement to its Event Receive Tick AI, it never runs. This makes me think decorators may only run initially - or at least as I have them set up.

What’s the best way to get the system to move on from the BTT_AvoidEdge task once the berry is away from the edge of the plate?

Figured it out.

Looking at this post and Mathew Wadstein’s video on decorators, I hadn’t set the “Observer aborts” setting.


Now the decorator will continue to run when its task, or any lower priority task, is run.