Need Help Understanding Sequencer

magique

Active member
I've tried BD many times in the past, but I can never seem to get my head around how to get the correct logic flow. I recently tried NodeCanvas and had no problem creating the kind of logic I need, but when I try to replicate the same thing in BD, it doesn't function as expected. I'm attaching a simple Behavior Tree to control a Motion Controller NPC. The logic is that I increase the Hunger every tick using the Modify Attribute Float node. Under the Selector I have 2 Sequences. Each sequence starts by checking the Hunger attribute float. The first one compares to <= 39 and if true will perform Navigate To waypoint #1. The second sequence compares Hunger to >= 40 and if true will navigate to waypoint #2. However, what I see is that the first sequence kicks off and the NPC moves to waypoint 1, but once there, the Selector with both sequences never runs again. So even though the first sequence should fail when the Hunger gets to 40, it never runs that check again. I tried making the Selector into a Selector Evaluator instead, but the same thing happens. The entire right side of the Parallel node never lights up green once the first Sequence Navigate To is completed. If

I could just understand why this sort of tree doesn't operate as expected, I might be able to finally get a grasp on how BD works. Attached is my behavior tree.
 

Attachments

  • BehaviorScreenshot.png
    BehaviorScreenshot.png
    50.1 KB · Views: 10
I finally got the desired result by changing to Selector Evaluator and having a Repeater above it. But I have no idea why I need a Repeater. Is there no other way to get the right side of the Parallel node to re-evaluate without a repeater?
 

Attachments

  • BehaviorScreenshot2.png
    BehaviorScreenshot2.png
    65.8 KB · Views: 10
Both Behavior Designer and NodeCanvas follow the standard behavior tree logic so if you have an understanding of how Node Canvas works it should be no problem to switch :)

When the waypoint #1 completes I'm guessing that it returns a status of success? This will cause the right branch to end with the parallel task still active because the left one is being repeated (forever?). Because the left branch never ends the right branch will never rerun.

For this type of situation I recommend using conditional aborts. You should keep the left repeating branch, but then for the right branch you should use a lower priority abort to continuously check the float value. This video has a good overview for a similar setup that you'd take:


I finally got the desired result by changing to Selector Evaluator and having a Repeater above it. But I have no idea why I need a Repeater. Is there no other way to get the right side of the Parallel node to re-evaluate without a repeater?
The reason this works is because the selector evaluator is reevaluating that branch even after the first navigate to returns success. The approach above using conditional aborts is a lot cleaner so I recommend going that route.
 
Top