Behavior tree ensure throwing intermiddently

ensure(RelativePriority >= EBTNodeRelativePriority::Same) line 516 BehaviorTreeComponent.cpp

I’ve had this ensure fail periodically within a KeepInCone decorator on a single task as well as a few different selectors observing a bool blackboard entry where that bool is updated in code from a function called by a custom Service. I can not reliably get it to occur. It probably fails in like 5% of my playthroughs. I have a pretty large tree with many custom nodes, but they all follow the standard API. This isn’t a big issue since the game recovers, but I would still like to resolve the issue.
The tree plays and behaves “normally” otherwise.
I’m using a modified post 4.7 pre 4.8 promoted build from source.

I can’t provide a sample project to reproduce this issue as it would require too much of our custom code at this point. I’m seeking guidance on where to debug. I’m not sure if the tree is being instanced incorrectly or some other issue that leads to the lower priority node requesting execution.

This ensure has been put in place to detect a erroneous situation we were running into ourselves. The issue, in short, was resulting in lower-priority BT decorators aborting currently running higher priority tasks, which of course is undesired. We think we’ve fixed that, but I can’t really point you at a change that addressed the issue since fixing it was a process. I’d love to know if you get that in 4.8 (or later). Please let me know. If this still happens then it’s terrible news, but I need to know :slight_smile:

Cheers,

–mieszko

I’ll have to wait until we can merge in latest than. Thanks for the reply.

After update to the newest version of engine (4.12) this ensure have started occur frequently. On previous version of the engine there were no problems with this ensure. This issue occurs on the different trees. While decorator is executed variable “InstanceStack” (BehaviourTreeComponent.cpp, line: 564) has the active task from higher ramification. Is an issue in the engine?

Best regards!

Hey luke27,

  • Have you been able to reproduce this issue in a clean project?
  • If so, do you have any steps we can follow to reproduce the issue on our end?
  • Could you provide your full output log from your project’s Saved->Logs folder after the ensure occurs again?

Hi, the issue still persists in 4.18.
I have traced the issue to appear in BTDecorator.cpp line 116 where the decorator as an observer recieves information on changed result of his check (blackboard value check). It is notified on ResultChanged. The flag bIsExecutingBranch is set to false as he is not a part of a branch that is currently being executed. But he does call the OwnerComp.RequestExecution(this); function becouse bPass is set to true.

I find the if in line 114 weird as bPass is set from WrappedCanExecute() which basicly checks the condition of the decorator, so if it passes and is outside of the executing branch it should execute?