Master client can't receive buffered RPC after rejoining

I'm using photon cloud and I have the issue that if someone become the master client, it will not receive any buffered RPC when he rejoin the room.

I use RPC called "ClientRequestPlayer" to tell master client, and master client will send AllBuffered RPC called "AddPlayer" to everyone in the room to add player in their own PlayerList to track all players, and also spawn each player in the position it should be.

Everything works fine when new client joins and leaves the room except for the master client. If the master client leaves the room and rejoins, it only create its own in the PlayerList and instantiate itself in the room.

I found that not only the client create the room(master client) would have this problem, the client became the master client after the master client was switched would also cause this problem.

I will be very grateful if someone can tell me how to fix this problem!

Comments

  • After master client left the room, next active player in room become a master. Probably that client has no enough data to respond with player list to returning ex-master.

    But you do not need maintain player list on clients or instantiate objects manually.
    PUN does it for you:
    'PhotonNetwork.playerList' property contains list of currently joined players.
    PhotonView component attached to your object prefab keeps that object instances on different client synchronized. Also it instantiates object on other clients if PhotonNetwork.Instantiate(...) used.
    Please refer to PUN documentation and tutorials for detailed info on PhotonView:
    http://doc.exitgames.com/en/pun/current ... w#_viewpun
    http://doc.exitgames.com/en/pun/current ... c317517599
  • If I use PhotonNetwork.PlayerList, how do I assign the team for each player?

    Also, thank you for your prompt reply!
  • You can set or update custom properties for any player from list by calling PhotonPlayer.SetCustomProperties() method. Those properties should be automatically updated for each client player list and you can fetch them via PhotonPlayer.customProperties property. I suppose that 'team' may be one of such properties.
  • I use setRoomProperties to record the number of people in different teams and playerlist to save the information of team and position(spawn point). It works!!! It also solves the problem that the master client can not recieve the buffered RPC.

    Thank you Tobias. Photon is really a useful plugin!!!
  • Thank you! I'm glad PUN actually helps you, despite the questions and detail work.
    An thanks to Vadim for jumping in and helping, too!
Sign In or Register to comment.