Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 21

Thread: Interrupting vs Queueing vs Pushing

  1. #1
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,704

    Interrupting vs Queueing vs Pushing

    I've rewritten a bunch of how bot actions are managed internally to better support action queueing, and it leaves me with a bit of a question on how you best think the API should work.

    Right now, when you call an Action_*() function, it interrupts and destroys the current entirely. Unless you have called SetActionQueueing( true ), in which case it should add the action onto your queue, though this is currently not really working correctly.

    With the new code (not yet shipped), queueing should work correctly, but you also have the ability to push an action, so, for example, you could have a MoveTo action going, then decide to use Arcane Boots, and just push that action so that it executes to completion and then you return to the MoveTo you previously were executing. This seems really useful for things like item/ability usage which are often pretty instantaneous, so I'd like to expose to the script layer. (Under the hood it's still a queue, it just moves your current action to the head of the queue and makes the pushed action active)

    However, I'm waffling a little on what that the API for this looks like. I'd rather not add a SetActionPushing() because it seems ugly to have to do SetActionPushing( true ) Action_*() SetActionPushing( false ) every time you just wanted to push an action. So I'm thinking of breaking the Action_ calls into more specific variants depending on whether you want them queued or pushed, so there would be, for example:

    Action_MoveToLocation( vLocation )
    ActionQueue_MoveToLocation( vLocation )
    ActionPush_MoveToLocation( vLocation )

    and so on for all the Action_*() functions. I'd leave the existing Action_*() functions as-is, and they would retain the same functionality, and I'd remove the SetActionQueueing() function.

    Thoughts?

  2. #2
    Basic Member
    Join Date
    Dec 2016
    Posts
    731
    Works for me. Will "push" break Channelled abilities though? It shouldn't for things like using Glimmer Cape on Crystal Maiden during her Ultimate, but depending on the implementation it might. Please check.

    But please, pretty please, give us a "GetQueueSize()" API and probably a "GetQueueList()" so we can review/debug code knowing what's on the queue.

    Related but un-related:
    when does the bot-difficulty-based action delay happen?

  3. #3
    Basic Member
    Join Date
    Dec 2016
    Posts
    731
    Also, what happens if I do a bunch of ActionQueue_*() and then suddenly an Action_*()... does the Action_*() clear the action queue and reset to the action called?

    I guess it really comes down to the question of what is the use of Action_*() API if ActionQueue_*() and ActionPush_*() exist. Seems just like legacy support...

  4. #4
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,704
    Basically under the hood there are three things:

    1) The currently active action -- this always exists, and by default is the Idle action.
    2) The pending action. May be empty.
    3) Everything in the action queue. May be empty.

    The pending action in #2 is basically an action that's been pulled off the queue, but in its difficulty-based-delay, prior to actually activating. As soon as its delay is done, it becomes active and replaces the existing active action. So the delay always happens as actions come off the queue. Actions won't come off the queue unless the current action is Idle.

    And yeah, I'd also add better functions for inspecting the queue.

  5. #5
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,704
    Yes, Action_*() nukes the queue (and the pending action) and just becomes the only thing that the bot is doing. In general it's the simplest thing to do, and there are definitely times where you want to say "Stop whatever you were doing before, you're doing this now" and not have to worry about any old actions lingering around.

  6. #6
    Basic Member
    Join Date
    Dec 2016
    Posts
    731
    Quote Originally Posted by ChrisC View Post
    Yes, Action_*() nukes the queue (and the pending action) and just becomes the only thing that the bot is doing. In general it's the simplest thing to do, and there are definitely times where you want to say "Stop whatever you were doing before, you're doing this now" and not have to worry about any old actions lingering around.
    So the equivalent of Action_ClearActions(true) followed by ActionPush_*() (or even ActionQueue_*() since queue is empty so it will get executed immediately). I'm just pointing this out to show the redundancy.

  7. #7
    Basic Member
    Join Date
    Jun 2013
    Posts
    274
    What will happen if you have 2 ActionPush_*'s added? Will the first one added (ActionPush_1) stay as the current action and the second added (ActionPush_2) becomes first in queue or or will ActionPush_1 get bumped to the front of the queue while ActionPush_2 becomes the current action?

  8. #8
    Basic Member
    Join Date
    Jun 2013
    Posts
    274
    Quote Originally Posted by nostrademous View Post
    So the equivalent of Action_ClearActions(true) followed by ActionPush_*() (or even ActionQueue_*() since queue is empty so it will get executed immediately). I'm just pointing this out to show the redundancy.
    I wouldn't call it completely redundant since one may want to cease all actions without any immediate follow-ups.

  9. #9
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,704
    Quote Originally Posted by nostrademous View Post
    So the equivalent of Action_ClearActions(true) followed by ActionPush_*() (or even ActionQueue_*() since queue is empty so it will get executed immediately). I'm just pointing this out to show the redundancy.
    True, though I'd expect most people to just use ActionClearActions(true) to make a bot stop in place and that's about it.

  10. #10
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,704
    Quote Originally Posted by Cornbane View Post
    What will happen if you have 2 ActionPush_*'s added? Will the first one added (ActionPush_1) stay as the current action and the second added (ActionPush_2) becomes first in queue or or will ActionPush_1 get bumped to the front of the queue while ActionPush_2 becomes the current action?
    If you did this:

    Action_MoveTo( X )
    ActionPush_UseAbility( A )
    ActionPush_UseAbility( B )

    the bot would execute Ability B, then execute Ability A, then go back to the original Move command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •