- Home /
[Photon] Getting the players in a room in the same order
Hi
I have a project that uses Photon for multiplayer and this project really depends on the player list being the same over the network. It is like this since I use a list to store the players and then set their role as a "manager", or whatever you can call it, for the current round using the list.
But then I noticed, by using a simple foreach loop that goes through the player list with PhotonNetwork.playerList, that the order of the players doesn't sync. For example:
There are 3 players in a room. Player 1, Player 2 and Player 3. Player 1 is the host and for him, the player list goes 1, 2, 3. But then for Player 2 it goes 3, 1, 2 and for Player 3 it goes 1, 3, 2.
Now this wouldn't be much of a problem for most games but for mine it is devastating. Since the player list doesn't sync up that means if the manager index is set to 1 then normally Player 2 would be the manager. For Player 1, who has the correct list, it is. But for Player 2 it is Player 1 who's the manager and for Player 3 it is Player 3.
Now obviously, this is not how it is supposed to be. I have been trying to sync the player list using JSON and sending it through and RPC but that doesn't carry over the PhotonPlayer, which is also needed for my game to work.
So is there some way I can make the player list the same for every player?
Any help is greatly appreciated!
Answer by AiGameStudio · Dec 28, 2016 at 10:56 PM
Hi!
try this. http://forum.photonengine.com/discussion/4866/in-what-order-is-photonnetwork-playerlist-in
Your answer
Follow this Question
Related Questions
Photon player instantiation BY MAGIC!? 0 Answers
Player names all displayed as local player 1 Answer
Photon switches player's camera 2 Answers
How do I Photon Instantiate a scene object randomly from a list of objects? 0 Answers
How to manually destory GameObjects on player leaving game in Photon 1 Answer