PhotonTargets.AllBuffered, Help Please !

Options
Hello, i am developing a card games with PUN. I make a RPC called StartGame and make the MasterClient to call the RPC and target it to AllBuffered. In the StartGame(), also have function to Shuffle and share the cards to all the players who are playing. When the game starts there is a timer countdown and when the time is up, the masterclient call RPC to evaluate who is the winner and PhotonTargets.All. The problem is for example there are 3 players playing and the fourth player joins the room, when the masterclient call RPC to evaluate the game, the fourth players can not evaluate because it doesn't know other players cards.

And also from what i read, if the masterclient disconnects, all the buffered RPC are removed. Is it a good way to use AllBuffered in my case? or should i use another way? Someone help me please.

Thanks,
Kevin

Comments

  • Hi @liorium,

    [...] and the fourth player joins the room [...]


    To avoid this scenario you can 'lock' the room after the game has been started. This way no further players are able to join the game. You can do this by using PhotonNetwork.room.IsOpen = false;.

    And also from what i read, if the masterclient disconnects, all the buffered RPC are removed.


    This is basically correct. If a client leaves the room all of his buffered messages will be removed, too. To avoid this you can think about using PhotonNetwork.RaiseEvent function. It allows additional caching options, for example adding an event to the 'global' room cache which basically removes the event's allocation with a certain player. This means that the event is no longer associated with a client and persists as long as the room is alive. To see how this works I would recommend you taking a look at the RPCs and RaiseEvent documentation page (section RaiseEvent) as well as the Cached Events documentation page.
  • liorium
    Options
    HI @Christian_Simon !
    Thanks for you reply.