Queue Graph Events (SendEvent) When Graph Is Paused

NodeCanvas Forums General Discussion Queue Graph Events (SendEvent) When Graph Is Paused

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13836
    meatloaf
    Participant

      Currently it looks as though when the graph is paused and a SendEvent call occurs it is completely ignored. This makes sense however I think it would be really helpful if we had the ability to queue send events on pause instead of having them ignored.

      For example here is a use case where this would be beneficial.

      Current Method
      1. Call Async method FindPlayer(When player is found SendEvent("Found Player") will be called)
      2. Pause graph before FindPlayer returns.
      3. FindPlayer returns but SendEvent("Found Player") never gets sent because graph is paused.
      4. Unpause graph.
      5. Due to missed event graph is unable to move forward.

      Proposed Method
      1. Call Async method FindPlayer(When player is found SendEvent("Found Player") will be called)
      2. Pause graph before FindPlayerreturns.
      3. FindPlayer returns, graph is paused so SendEvent("Found Player") is queued to occur when graph is unpaused.
      4. Unpause graph.
      5. SendEvent("Found Player") is sent and graph progresses normally.

      Hope this makes sense. Thanks in advance!

      #13842
      Gavalakis
      Keymaster

        Hello again,

        Yep, that makes sense 🙂
        Since the when the graph is paused nothing is really updated, I think that this could simply be achieved by changing the early return evaluation in Graph.SendEvent method to this, thus the event will be “catched” whether the graph is running or paused regardless:

        Can you please confirm that this change brings the same behaviour you are suggesting?
        Thanks!

        #13897
        meatloaf
        Participant

          Sorry to be completely honest I’m not entirely sure. Can you direct me to where that code would be input?

          Would it replace this line in Graph.cs ?

          I’m not entirely sure this would be the change i’m after though. I believe that when the graph is paused isRunning is already marked as false so your code would have the same effect as what it does now.

          I’m talking about adding the event to a queue when the graph is paused so that when the graph is unpaused all the event’s that occurred during pause would be executed.

          Hope that makes sense 🙂

          #13917
          Gavalakis
          Keymaster

            Hello again,

            I misunderstood your question/suggestion in your previous post (guess I was a bit asleed as well :), but I do understand better now.
            The problem with this, is in the way the events work. Right now, events received (eg by a condition task), would make the condition immediately return ‘true’ for one frame. In some other frameworks (and I think in Unity’s Mecanim as far as Triggers go), events would rather mark a boolean like “received” as true, and be “consumed” the next time the condition is evaluated, something like this:

            NodeCanvas ConditionTasks do not work thi way though and for your suggestion to take place, they would need to actually work this way, which is something I was already thinking of changing. Alternatively I could make a ‘Queue’ and Enque event calls when the graph is paused, but I don’t really like the complexity added here, thus the first solution might be better.
            I will need to investigate a bit further into this though before giving some solid answer 🙂

            Thanks!

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.