• Visit Rebornbuddy
  • Possible to make the "play action" faster? (hence bot playing cards faster)

    Discussion in 'Hearthbuddy Forum' started by alvinma, Jan 10, 2015.

    1. alvinma

      alvinma New Member

      Joined:
      Sep 12, 2014
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      Hi first of all the new GvG release is great Thx!

      What I have noticed is that when the bot is done calculating moves and starts to play actions, the delay of each action is really too long. For example, we don't need to wait 1 second for the bot to start clicking on the next minion to attack the opponent's face?

      Plus, the bot is also slow on pointing the attack(i.e. mouse trace) if you know what I mean. Clicking the minion --> pointing to the target --> attack. The pointing is kinda slow compare to normal human actions.

      Now I don't really know how the bot is coded, but it really looks like the delay is hard coded instead of a necessary time for calculation. If it's possible would it be able to at least make the delays be adjustable? Or simply shorten the delay time in the code?

      Also in each turn the bot waits 3 seconds to start calculating....
      GameplayScene_MAIN_ACTION_Friendly] Waiting to be in this state longer: 00:00:02.9908025.
      Is it possible to shorten this too?
      Ideally, we mark the time as A when the turn starts, then calculate, then roll a random number between 1 ~ 2.5, as the time duration B we wants to wait, then wait till A+B to start play action?
       
    2. Raikzun

      Raikzun New Member

      Joined:
      May 17, 2014
      Messages:
      22
      Likes Received:
      0
      Trophy Points:
      1
      Yea thats the 1 thing that annoys me..
      The slowmotion gameplay xD
       
    3. Lelepere

      Lelepere New Member

      Joined:
      Nov 28, 2014
      Messages:
      45
      Likes Received:
      0
      Trophy Points:
      0
    4. pushedx

      pushedx Moderator Moderator Buddy Core Dev

      Joined:
      Sep 24, 2013
      Messages:
      4,252
      Likes Received:
      290
      Trophy Points:
      83
      You have to understand the implementation mechanics of the game itself first to understand the delay issues. A lot of things are done in this game to provide a rich, smooth playing experience for normal users,but the systems in place present some interesting challenges to overcome for bots. This is a networked game; it's not a single player game where everything is ran locally and you know all the data.

      Look at the cards you can play the next turn, in terms of mana cost, and watch carefully at the start of your turn. You should notice they don't have a green border and are not interactable until roughly 1-2s later when the card you're drawing is 1/2 way to your hand. If you play a bunch of practice games, you should be able to notice the difference in when the "your turn" banner shows. Sometimes it's after the card is draw, sometimes it's way before. I assume a certain randomness is added to the game to make it less predictable for anti-automation purposes.

      The routine waits that extra ~1s for the card to get fully in your hand, because trying to play a card when it's moving from your deck display to your hand is not something realistic, or reliably doable with human actions. Waiting for the card to be fully in your hand first, makes the most sense. Due to possible start of turn mechanics that need to be waited before they are triggered by the server, the additional wait is also helpful to avoid the case of the AI updating too soon.

      When it comes to picking up a card to attack with or use the targeting arrow, that can be sped up slightly, but it still is based around a server response. Say you have multiple cards to attack with. Notice the green outline around them? Now pick one up, you'll notice the other goes away, and the enemies you can attack now have a golden border around them. When you do attack, the client does not know of the result until the server calculates it, sends it back, and then the client plays all the animations and effects that result. Sometimes, these effects take time to process, and as a result, if the AI were to update before they were all done, it would be calculating the wrong thing to do.

      If the code that is currently part of the slowdowns in play were disabled, what would result is that silverfish would perform an action, then quickly perform the next action too soon, which results in a lot of double target attacks (this minion has already attacked) or the wrong moves being generated because the AI is calculating an action to do before the client state has updated properly. Sure, the bot performs actions faster now, but it's doing 2x as many of them since 1/2 are invalid, so it'd end up being even slower.

      Obtaining information from the client is not "free". There's a certain performance overhead due to the game being a Unity game, and working in C# (mono). As a result, waiting more for the client to be in an expected state helps reduce performance issues from pointless AI calcs that would generate the wrong moves.

      If it were possible to simulate every possible move instantly, then there'd still be a delay between when the bot actually performs actions, but it'd not be as much of an issues as it is now with full boards. That's because there are very specific limitations in an AI design of update board -> evaluate board -> perform action -> repeat than there are in the model a normal player would use which is much faster, but a lot more difficulty to properly model.

      To phrase another way, when you play the game, you don't think about every single possible move and outcome each action, whereas right now the AI does (because it has to). If humans worked the same way as the AI did, their play style would suffer from the same issues seen in the bot.

      It's going to be an interesting problem to solve, but one we're working on to improve as time goes on.
       

    Share This Page