I’m wondering if it’s possible to get the playerList from a room without joining the room? Basically what I want to do is when you are in the “Join Game” menu and select a room from a list I want to list what players are online in that particular room in another window in the “Join Game” menu…Hope this makes sense
We decided not to send the user list per room to clients. It’s potentially a lot of content and usually not a lot of benefit. If the game is popular, there are hundreds of rooms and thousands of players (and names to send) who are unknown to you.
Use FindFriend() to get a list of rooms known players are in.
Is this something that would be possible to achieve if I download the Photon Server instead of using the Cloud?
It is not possible by default, but you may be able to make a workaround using customRoomProperties to save player names and makes those properties available in the lobby.
I have no idea how this would impact the network for users in the lobby, though, and wouldn’t necessarily recommend it.
@Kovenant_1 : What effect do you want to achieve?
Just to be able to see what players are online in a room before joining it… I guess setting customRoomProperties can get the job done? You know, in Steam you can rightclick on a server to get what players are online and what their current score is and such. This is not a important feature of my game, so if it will do more harm than good it’s no biggie @tobiass
If it’s any good, depends a bit on the platform and play style. Yes, you can do this in steam and yes, we had long lists of servers in counterstrike. But times changed and at least on mobile it’s considered essential that players get into some game quickly and conveniently. You usually don’t know any of the others, so the names are white noise and dead traffic in most cases. Better build a few filters, like “map” or “game type” and pick a random room, unless you can find friends online.
It’s up to you. You can use the properties that way but we don’t encourage that.
can I get the count of players without joining the room. Like current online players count.
@Playzio : In Photon, the lobbies provide lists of rooms. In those, you get the player-count per room but not each player’s name. PUN has a demo “Worker”, which shows a room list. Have a look at it’s simple code.
You can also get the overall count of players and rooms in the region you’re connected to. That’s PhotonNetwork.countOfPlayers, .countOfRooms, etc…
Hello,
I am facing one issue regarding join room
I have two modules one is custom and one is join random room
In Custom i have friend list which i have created using my own services. When i send a request to my friend by creating a room with push then my player is waiting for friend to join that room and in the mean time if another 3rd user request for random room join then he joined a room which i have created for my friend. In my room Player count is 2 so my friend is unable to join the room and my module functionality fails in this case. How i can go for this?
Thanks,
Sean
You have 2 options:
You can keep a room out of the matchmaking by making it invisible. Set roomOptions.IsVisible = false when you create the room. You can do that in PhotonNetwork.JoinOrCreateRoom().
Alternatively, you could reserve a spot in the room, for the invited player. One overload of JoinOrCreateRoom() has the parameter string[ ] expectedUsers. When your friend’s userID is in that array, the spot is reserved but others might join randomly (if the room had a higher maxplayers).
Make sure you set AuthValues to set your own UserID per user.
Thanks tobiass for your quick reply
Hello
I need one help. I am using Photon MultiPlayer sdk. I am facing one issue in that.
I have created one room with Player count limit for that room 2. When both the Players joins the room both Players GameObjects are visible to each other. But when i lock my iPhone device and then unlock the device then one of the player GameObject disappears from my screen. Why this happened. Is this due to disconnecting to Photon server? If yes how i can maintain the state of the game in this situation?
Thanks,
Sean
This happens when the client gets disconnected from the server. iOS does not approve of general apps that keep connections alive…
If you’re OK with cleaning up GOs yourself, you can disable Autocleanup for those rooms. Have a look at
PhotonNetwork.autoCleanUpPlayerObjects.