[Closed] GetNodeInstance returns the wrong node for TimeLimit decorator
We've been having problems with decorators not aborting lower priority tasks when they should. After an extensive debugging session we think we've found the issue, but are unsure of the solution. We'll try to describe the the consequence and the source of the problem:
In BehaviorTreeInstance::Initialize the line (BehaviorTreeTypes.cpp)
returns a wrong pointer when DecoratorOb is TimeLimit decorator. Subsequently the child index for this InstancedDecoratorOb is incorrectly overwritten on the next line: (BehaviorTreeTypes.cpp)
When the instanced decorator with the incorrect child index then triggers and requests execution the line
in (BehaviorTreeComponent.cpp) then checks the decorators on a different node than the one triggering this check because RequestedByChildIndex is wrong.
UBTNode::GetNodeInstance seems to make the assumption that if GetSpecialNodeMemory returns a valid pointer that the node itself is instanced. Looking at the implementation of UBTNode::GetSpecialMemorySize() this seems to be a valid assumption, but this method is overridden in UBTAuxiliaryNode in the following manner:
which invalidates the assumption for AuxiliaryNodes that have bTickIntervals set to true (e.g. BTDecorator_TimeLimit).
Could you confirm this bug? And do you have a suggested fix for this? We are unsure if the caller of GetNodeInstance should be responsible for checking if the node is actually instanced, or that GetNodeInstance should just return nullptr if it is not instanced. Or perhaps we are misreading the intentions of this code?
Best regards, Steijn
The question has been closed Sep 07 '16 at 08:26 PM by AndrewHurley for the following reason:
The question is answered, right answer was accepted
I'd say that best place for change would be inside
For now, I'll enter new bug report, but fix will probably look as described above.
answered Sep 07 '16 at 08:25 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here