Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

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 the movement task node that aborts self if the movement gets too far from a given point. The problem is that the decorator conditional test isn't run until the movement task is completed. So basically the distance checking decorator isn't being run while the node its decorating IS being run.

The point is, you can't exit a node that is currently running, because the decorators that wrap it aren't being checked during the execute cycle. What should (I think) happen, is that during the execute update, decorators should be able to alter the 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 the movement completes rather than stopping part-way through as expected.

Any advice welcome here.

Product Version: Not Selected
more ▼

asked Sep 10 '14 at 04:13 PM in Bug Reports

avatar image

198 28 31 46

avatar image Ben Halliday STAFF Sep 15 '14 at 06:47 PM

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!

avatar image zoombapup Sep 15 '14 at 07:18 PM

Hi Ben,

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

But my own decorators do not explicitly observe a blackboard value, but instead they read the value during execution of the condition. The 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 the blackboard value I use changes.

So to reproduce, you would need to write your own decorator that checks a value in the blackboard and simply breakpoint when it gets called. It would get called before the node it decorates is run, and then when the 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 the blackboard decorators because their observed values can run their conditions, but doesn't work for standard decorators.

I hope that is clear.

avatar image swiftwords Oct 20 '14 at 11:49 PM

Hi zoombapup and Ben,

I'm having the 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 the decorators that come by default?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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? :D



more ▼

answered Oct 21 '14 at 08:32 PM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image swiftwords Oct 21 '14 at 11:00 PM

That would be fantastic, Thanks for the reply!

avatar image zoombapup Oct 22 '14 at 08:25 PM

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

avatar image Deventico Mar 11 '15 at 10:07 PM

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.

avatar image MieszkoZ STAFF Mar 12 '15 at 10:53 AM

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.

avatar image Deventico Mar 12 '15 at 06:07 PM

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

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

I opened a new question for that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question