Syncing list of players who start the game

When our game is finished loading a level, each client writes a player property to indicate they are ready to play.

After this, all the clients periodically check the PhotonNetwork.playerList to see that all players have this property written. The clients then store information for each player who is beginning the level. It is important that all clients store the same information for the players.

My question is, due to a player disconnecting would it be possible for two clients to see a different list of players? I don't see how this would be possible, but I want to check to be sure.

Comments

  • What you do is exactly the approach we would suggest, yes.

    Each player sets a property "ready" (or short "r").
    If you use "Check And Swap" to set the property, the resulting update event is becoming ordered with any other update in the room (events, rpcs, leave, etc). Of course, the timing is not perfectly guaranteed to be the same due to possible lag and loss.

    As always: Any player may drop out at any unforseen time, so some player may send "ready" but then lose connection and never receive everyone else's update. A timeout may take a while to get detected by the others and meanwhile the user is basically unresponsive.
    Depending on the game, a rejoin may make sense. Check out ReconnectAndRejoin().
Sign In or Register to comment.