boardgameio / boardgame.io

State Management and Multiplayer Networking for Turn-Based Games
https://boardgame.io
MIT License
10k stars 704 forks source link

Boards/bots not in sync after update to v0.38.0 #800

Closed brokolja closed 3 years ago

brokolja commented 4 years ago

The following (using react client TicTacToe example with multilplayer local bots) shows two boards syncing every turn from player + bot in v0.37.2. Perfect!

...
const GameBoardClient = Client({
  game: TicTacToe,
  multiplayer: Local(
    { bots: { "1" : RandomBot } }
  ),
  board: Board,
});
...
...
<GameBoardClient playerID="0" matchID="match1" />  
<GameBoardClient playerID="1" matchID="match1" />
...

Starting with v0.38.0 this is completely broken. Turns not synced to the other board + bot does not to change currentPlayer so that gameplay is broken. Ive seen other issues related to changing currentPlayer manually because this does not work by default - but it worked using v0.37.2. I tested multiple versions up to 40.0 the issue is definitely between v0.37.2...v0.38.0.

Additionally: The bot worked with only one board in v0.37.2 also because it changes the current player automatically like a bot should...

The issue must be here: https://github.com/boardgameio/boardgame.io/compare/v0.37.2...v0.38.0

delucis commented 3 years ago

@koljakutschera Sorry for missing this.

This is almost certainly caused by this commit: https://github.com/boardgameio/boardgame.io/commit/a080ce3e3622c2c036abba4b8d370702971f3117.

That fixed a bug with outdated bots (described in https://github.com/boardgameio/boardgame.io/issues/552), but didn’t take into account having several instances of the client component running simultaneously. Not sure what the solution is off the top of my head, but perhaps someone can see a nice way to handle this.