Possible to promote a player to master?

I have a small game that is played with four players. The master client is responsible for syncing the game and other clients.

I'm now trying to make the networking more robust (it is played on iPad and we have had a few drops in the connections). So far I'm able to have clients reconnect, rejoin the room and update the room vars for the changed player id, but this only works if the client that dropped out is not the master. If that happens, the "history" of the master is lost.

I could write some code to deal with this, but it would be easier to just have the reconnected player be promoted back to be the master (since playing on with less than four is not an option anyway). Is it possible to "promote" a player to be the master?

Thanks.

Comments

  • This is possible but you would have to modify PUN itself.
    The master client selection is pure client side and based on finding the player with the lowest actor number in a room.
    You could add a room property "master" and set it to some player's actor number. If that player is available, this player is master. If that player is not online, the default rule applies and the one with lowest number is temporarily the master.
  • Good, thanks. I will take a look at it.