You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi ! i have a custom lobby mechanism on my project which implement basic matchmaking between players.
When sufficient players have joined the lobby i create the match from my api and send an event to all the players to redirect them to the match page.
When the match page load, an http call occurs to log the user to the game server.
It seems that the boardgame implementation cannot handle simultaneous connection changes properly.
When someone logs into the match (https://github.com/boardgameio/boardgame.io/blob/main/src/master/master.ts#L400)
the match metadata is fetched from my database, modified to include the new metadata, sent to all clients and then saved to the database.
When 2 players joins the match simultaneously, this logic is called 4 times simultaneously and it looks like that some players are overriding the metadata changes of previous users.
For example:
Player 1 is redirected to match page
Player 2 is redirected to match page
Player 1 onConnectionChange method start and fetch metadata
Player 2 onConnectionChange method start and fetch metadata
Player 1 onConnectionChange method modify metadata and save it to the database
Player 2 onConnectionChange method modify metadata and save it to the database
as Player 2 fetched the metadata before Player 1 finished modifying and saving it to the database, when Player 2 modify and save the metadata into the database, the data is outdated and does not contain Player 1 isConnected and credentials values. Player 2 is correctly logged into the match but Player 1 stay on the "Connecting..." screen indefinitely and the match get stuck when his turn start...
Sometimes everything plays nicely in the correct order but most of the time, for example in a 4 players match, a player stay on the loading screen and the match is blocked, this is really critical for my project, how can this be fixed ?
The text was updated successfully, but these errors were encountered:
Hi ! i have a custom lobby mechanism on my project which implement basic matchmaking between players.
When sufficient players have joined the lobby i create the match from my api and send an event to all the players to redirect them to the match page.
When the match page load, an http call occurs to log the user to the game server.
It seems that the boardgame implementation cannot handle simultaneous connection changes properly.
When someone logs into the match (https://github.com/boardgameio/boardgame.io/blob/main/src/master/master.ts#L400)
the match metadata is fetched from my database, modified to include the new metadata, sent to all clients and then saved to the database.
When 2 players joins the match simultaneously, this logic is called 4 times simultaneously and it looks like that some players are overriding the metadata changes of previous users.
For example:
Player 1 is redirected to match page
Player 2 is redirected to match page
Player 1 onConnectionChange method start and fetch metadata
Player 2 onConnectionChange method start and fetch metadata
Player 1 onConnectionChange method modify metadata and save it to the database
Player 2 onConnectionChange method modify metadata and save it to the database
as Player 2 fetched the metadata before Player 1 finished modifying and saving it to the database, when Player 2 modify and save the metadata into the database, the data is outdated and does not contain Player 1 isConnected and credentials values. Player 2 is correctly logged into the match but Player 1 stay on the "Connecting..." screen indefinitely and the match get stuck when his turn start...
Sometimes everything plays nicely in the correct order but most of the time, for example in a 4 players match, a player stay on the loading screen and the match is blocked, this is really critical for my project, how can this be fixed ?
The text was updated successfully, but these errors were encountered: