yiotro / Antiyoy

A source code of android game called 'antiyoy'.
421 stars 53 forks source link

Points calculation bug impacting game play #97

Open Ceaus opened 1 year ago

Ceaus commented 1 year ago

Sometimes there's a weird points calculation bug in a quick online multi player game. And that bug screws up my turn. I wanted to make a video clip, but it's difficult making a video while I'm playing.

It happens sometimes that I have sufficient points to buy a piece. But as soon as I select a piece on the board, the points go below zero and that move becomes impossible/rejected. The piece I put on the board also disappears. When I press Undo to revert the move, everything looks fine again, with more than enough points to buy a piece. But as the clock is ticking there's nothing I can do anymore then to just skip the turn. And that's pretty frustrating when I play online, because at the higher ELPs, there's no way you can recover from a skipped turn. It's basically a death sentence for that game. I think in the last couple of months I had to forfeit a dozen games because of this.

yiotro commented 1 year ago

Thanks for the bug report. Few questions:

Ceaus commented 1 year ago
  1. Yes
  2. At least in quick online multiplayer games. I don't play duels or custom.
  3. Yes.

yiotro @.***> schreef op 27 mei 2023 15:50:38 CEST:

Thanks for the bug report. Few questions:

  • Do I understand right that if bug happened at one turn then it will keep happening till the end of the match?

  • Does it happen in quick matches? In duels? Or only in custom games?

  • Is this still happening after recent update (around a week ago)?

-- Reply to this email directly or view it on GitHub: https://github.com/yiotro/Antiyoy/issues/97#issuecomment-1565426906 You are receiving this because you authored the thread.

Message ID: @.***>

Ceaus commented 1 year ago

I was able to record one specific occurrence of this bug. See https://imgur.com/a/0qasi7c. I'm playing green. After three moves (00:05) I have 10 points and should be able to buy a piece. At 00:09 I am in fact buying a piece and then you see the bug occurring. I place the new piece on the board but that move is not accepted. And I also have less points then I started with (10/3 > 8/3). So I need to undo the moves to go back to a workable position.

yiotro commented 1 year ago

Thanks for the video. Hard to tell exactly what is going on internally but my assumption is that it's one of those rare desync bugs when game state on server is different than game state on your device, so server thinks that you're trying to make illegal move and undoes it (it's the protection against cheaters, it makes it impossible to make illegal moves).

I've spent quite a lot of time on this problem few years ago and achieved some success (it was way worse previously). But it's surprisingly complicated, so I wasn't been able to fully fix it.

Ceaus commented 1 year ago

There were another few occurrences. Yesterday: After undoing the move (the units I placed were rejected), I was able to replace a tower with a strong tower. Then I ended my turn. In the following turn the strong tower was reverted back to a normal tower. Today: Placed units were rejected (as per this bug description). That continued for some 4 turns after each other. That was pretty bizar.

it's one of those rare desync bugs when game state on server is different than game state on your device

I don't think it's a rare bug. Over the last couple of months it happened quite a few times. It can go weeks without occurring, but I've also experienced this multiple times (>5) in just a couple of days. Let me know if you want to see more video clips (I now know how to screen video capture).

Is there anything I can do to help debugging? Can I run a server locally to check? Anything else? I don't suspect the client code will reveal much.

Ceaus commented 1 year ago

And another. Sorry I'm going to quit playing for a while. I really like the game, but this becomes quite frustrating. Please let me know if there's anything I can do to help debugging.

Edit: for some reason my other comment from yesterday did not go through. I had more occurrences yesterday evening, before I posted this comment. I've lost two games in a row because I had to forfeit turns which i couldn't recover from (playing against higher ELPs).

Ceaus commented 1 year ago

And another one. This is really ruining the game play. You can't afford to forfeit a turn on the higher ELP ratings.