Detect Number of players in specific rooms

Options
Hello,

Is there a way to detect number of players in specific rooms.

I know there is PhotonNetwork.GetRoomlist() function which will give me a list of rooms. However I have to be connected to the master for that function. Is there an ability to do something like it without being connected to the master?

Basically I want to display the number of players that are in similar matches to the player that is already in a room. Maybe there is another way to do this?

Thanks!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @seanybaby2,

    This is not possible out-of-the-box.
    App & Lobby Stats are available only when connected to Master Server (outside rooms).
    Joining the lobby to get PlayerCount per Room from rooms list means the client is not joined to a room.

    if you really need this:
    * you can have two LoadBalancingClient instances (PUN client + another LoadBalancingClient): one joined to a room and one outside just to get this info
    * do this via external server which can keep track of rooms via WebHooks and the client request the info also via HTTP.
  • Tobias
    Options
    Please explain why you think this is needed. As long as we don't know the usecase, we can't decide if we lack a feature or if we would suggest another solution.
  • seanybaby2
    Options
    Hey @Tobias ,

    I want to display to the users how many players are in another specific kind of room or rooms.

    Basically the players hang out in aroom together that is kind of like a lobby and can start the match they're in whenever they would like, but it would be helpful to them if they new how many players are in a similar game so that they could decide whether or not to wait for those players to get out.
  • Tobias
    Tobias admin
    edited May 2020
    Options
    Sorry for the late reply.

    This is something that may work well for a few players but it won't scale well, so we would advise against it.
    By design, we try to avoid listing rooms and player counts in those. Especially, when the users are already in a room to interact with one another.
    I think I get what you want to achieve but from a network / traffic perspective, it's a lot of overhead just for the matchmaking and will break when you have hundreds of players.

    That said, you could use a room to get XY players in. They can move to certain places to form groups and when they decided to play, they hop off into a new room. You can make up a room name (guid) and share in this little group, before they leave.

    Make sure such a room is not used forever and make sure you can use multiple of those, to not break down when you reach 50 CCUs.

    We advise against such use and can't promise support in cases where something like this breaks.