Why does a behavior tree decorator not run during execution?

I’ve got a behavior tree with a movement task in it. I have a decorator on movement task node that aborts self if movement gets too far from a given point. problem is that decorator conditional test isn’t run until movement task is completed. So basically distance checking decorator isn’t being run while node its decorating IS being run.

point is, you can’t exit a node that is currently running, because decorators that wrap it aren’t being checked during execute cycle. What should (I think) happen, is that during execute update, decorators should be able to alter returned execute value (i.e. instead of running, it should return failed/complete or whatever).

Reproduction: Make a BT with a moveto node in a sequence, have a decorator that should exit that movement (I use a distance from a starting point check as my test) and watch as movement completes rather than stopping part-way through as expected.

Any advice welcome here.

Hi zoombapup,

I’m not seeing this behavior. Are you still experiencing this issue? Are you in 4.4.2? If so, could you post an image of your distance-from-starting-point decorator’s event graph? Thanks!

Hi ,

I’ve had a discussion with Mieszko about it and found an alternative. problem seems to be that decorator I’d written does not function same as Blackboard decorators. Essentially blackboard decorators are woken by observer on blackboard values they are using, so as values change blackboard decorator is allowed to run and thus can exit movement.

But my own decorators do not explicitly observe a blackboard value, but instead they read value during execution of condition. problem is that I cannot find a node that allows me to add an observer callback for my own decorators that are then executed when blackboard value I use changes.

So to reproduce, you would need to write your own decorator that checks a value in blackboard and simply breakpoint when it gets called. It would get called before node it decorates is run, and then when node it decorates completes and not “during” that node’s execution. Essentially I need some way of sayiing “when this node is executing, make sure to test my condition every time too”, which CAN happen with blackboard decorators because their observed values can run their conditions, but doesn’t work for standard decorators.

I hope that is clear.

Hi ,

I’m having same issues with trying to write a Decorator that can exit a currently running node like MoveTo. Is there a fix for this, or do we need to just limit ourselves to decorators that come by default?

What zoombapup (hi Phil!) said is accurate. Currently there’s no way to have a BP-implemented decorator that will be asked to evaluate it’s condition every frame. I’ve taken a note and will add this option soon-ish (4.6?). How about if a decorator has Observer Aborts to non-None then its ReceiveConditionCheck gets called every frame? I guess that’s what you expected up front, right? :smiley:

Cheers,

–mieszko

That would be fantastic, Thanks for reply!

Yeah, basically it seems right option is to be able to execute condition as an inline check if you aren’t observing something (i.e. its polled instead of observer-event based).

Does this work in 4.7? Can we have custom decorators that check every frame?

I seem to get that behavior, but wasn’t sure if maybe I made a mistake.

You need to overrider PerformConditionCheck or PerformConditionCheckAI and either have no BlackboardKeySelectors (which indicate you want to check condition on BB values’ changes) or have bCheckConditionOnlyBlackBoardChanges set to false.

Thank you very much, I overlooked checkbox and couldn’t find anything in documentation about it.

When I tried to use it, I ran into issues however…

I opened a new question for that.