[Unexpected Behaviour] ConditionTask and BT

NodeCanvas Forums Support [Unexpected Behaviour] ConditionTask and BT

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #14480
    Driiade
    Participant

    Hello,

    I found an unexpected behaviour when ConditionTask and BT. BT never trigger OnEnable/OnDisable for ConditionTask.
    And For specific condition, like checking time, we can’t rely on conditionTask for Decorator.

    See the linked screenshot to see the problem, with, for example, Timeout.

    Attachments:
    You must be logged in to view attached files.
    #14498
    Gavalakis
    Keymaster

    Hey,

    Indeed, the OnEnable and OnDisable methods are not used in Behaviour Trees but rather only in StateMachines, because there is not a very specific timing where a condition task is considered Enabled or Disabled in the context of a BT. With that said, other people have suggested that OnEnable is called once when the BT starts, and OnDisable be called once when the BT Stops, and this is something I am actually going to add. This however does not really solve the issue with Timeout, but I believe that Timeout could be implemented differently to avoid the requirement of OnEnable and OnDisable (I will need to think about how though).

    Once again the issue here, is determining when OnEnable and OnDisable actually take place in the context of BTs for condition tasks. For FSMs it’s easy to determine the timing, but not as such in BT. If you have any suggestions at all in this matter, by all means, please do let me know!

    Thank you in advance!

    Join us on Discord: https://discord.gg/97q2Rjh

    #14505
    Driiade
    Participant

    I think it’s logic to call OnEnable in this case :
    -Condition was not checked last graph update and now we check it.

    For OnDisable : Condition was checked last graph update but not anymore. It happen if the current running Leaf change in various way : a Decorator not anymore running, a conditionTask not anymore running etc.

    It’s very hard to implement timeout without this because when BehaviourTree pause for example I had trouble to fix this.

    #14527
    Gavalakis
    Keymaster

    Hello again,

    So, I’ve made the changes so that OnEnable and OnDisable are called in Behaviour Tree nodes.
    For your information, OnEnable is called when the BT node was Resting and is now active.
    OnDisable is called when the BT node is reset back to Resting.

    This handles correctly the Timeout example, as well as other cases other people have pointed out.
    It will be part of the next update. 🙂

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #14536
    Driiade
    Participant

    You a king 😮
    I will check this as soon update is available =)

    #14538
    Driiade
    Participant

    Hello,

    On the same way, ConditionTask don’t have OnPause call back.

    And Same things, there is no OnResume call back at all. Will be cool to have these states on ActionTask/ConditionTask =)

    #14549
    Gavalakis
    Keymaster

    Hey,

    Noted 🙂
    I was about to send the new version tomorrow. I will see if I can squeeze that in. It is not as straightforward as it may seem. OnPause and OnResume for ActionTasks, are part of their own execution and for example OnPause in ActionTask, is called only if it is currently Running and the graph pauses. Since ConditionTasks do not have a “Running” state, OnPause and OnResume for them respectively, will need to be called whenever the graph pauses and resumes regardless of whether or not the ConditionTask was currently being evaluated (there is no “state” tracking that).

    As such, I was planning to add callbacks in Tasks (for both Action and Condition) related to Graph state changes (OnGraphStarted, OnGraphStopped, OnGraphPaused and OnGraphResumed). These however are differnt (and called in different times) from the existing ActionTask OnPause and OnResume.

    I hope this makes sense :). In any case, I will try to add these in the tomorrow version, or otherwise in the one right after that!

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #15049
    karolstola
    Participant

    Hi!

    I’d like to ask if those OnResume methods made it to any release? I’d also love to use, but can’t see them 🙂

    #15062
    Gavalakis
    Keymaster

    Hello,
    I have attached for you here the modified version of ActionTask that has the OnResume virtual method implemented.
    For ConditionTasks it is not really possible as explained in my previous post unfortunately, unless you mean a GraphPaused and GraphResume callback (which is something that I will add but need more changes all around).

    Let me know!
    Thanks 🙂

    Join us on Discord: https://discord.gg/97q2Rjh

    Attachments:
    You must be logged in to view attached files.
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.