HearthStats / HearthStats.net-Uploader

Auto uploader for HearthStats.net
BSD 3-Clause "New" or "Revised" License
123 stars 54 forks source link

Log One Off #633

Open trigun0x2 opened 9 years ago

trigun0x2 commented 9 years ago

I often find that a player's action is moved to the beginning of the next player's turn instead of the end of this own, and this continues one.

I.E. : https://s3-us-west-2.amazonaws.com/hearthstats/prem-logs/124356/3902748

tyrcho commented 9 years ago

Yep, I noticed ... it's because the game log is like that. It follows the screen actions, this happens when you do stuff which is still animated when you click the end turn. I don't have an easy way to fix that atm.

tyrcho commented 9 years ago

Some mail from @gtch which could be a track to follow

I'm going to disgress for a moment to explain to +Michel Daviot how we can improve the end of turn detection — you may not all care about the details, just understand that we don't allocate cards to exact turns just yet, but we should be able to improve turn detection so that cards can be correctly allocated to turns...

I actually have been hoping to improve that one the refactoring of HearthStats Companion is complete, because it will be easier to do once we have a cleaner event model.

Typically the Companion notices the end of turn two or three seconds after the card draw appears in the logs: There are several reasons for the delay:

  1. We wait for three consistent screenshots in a row (I think three) so that we're not tricked by a card flying over the screen — otherwise certain cards get mistaken for a new turn when they are picked up and fly over the turn button.
  2. We only check a few times a second — this could be improved to many times a second if we switch from screenshots to just checking a dozen pixels or so, but I'm waiting on the refactoring for that.
  3. The card pickup appears in the logs before the turn changes on the screen — I've confirmed this visually by watching the log and Hearthstone at the same time. So Hearthstone knows the card before it's started showing the new turn animation.

For that last reason I'm hoping to take advantage of the refactoring to have a class that consumes events from both the log and the screen, and then pushes out new events with more context. So, for example: