GetRoomList isn't returning rooms- clarifying question

Options

I have an already released game and none of the existing players in prod join a lobby, they just connect to master and find a random player.

Now I'm trying to develop a new feature to show the list of rooms and active players in each room. I was hoping to dev-test the UI on the existing players in prod, however, PhotonNetwork.GetRoomList() returns an empty list, even though PhotonNetwork.countOfRooms returns the real number.

I read the doc, and it specifies that one needs to connect to the lobby in order to get the list of rooms. So I tried both autoJoinLobby set to true and false, and even tried to join the lobby after I connected to master, but still getting 0 rooms.

  public override void OnConnectedToMaster()

  {  PhotonNetwork.JoinLobby();  }

The thing that isn't clear to me is whether or not the connected users also need to join a lobby for me to see the rooms list? If so, what's the recommended way, via autoJoinLobby, or explicitly joining like the code snippet I have above?

Another question- while I kept reading GetRoomList() in the Update loop, in some frames it returned one room with empty properties and then after a few frames it went back to 0, without me doing anything. Any idea what could cause it?

Comments

  • Bumping, still not sure if I can rely on this API. Please kindly advise.

  • Tobias
    Options

    You seem to be using outdated versions of PUN, as autoJoinLobby and GetRoomList() were removed a long time ago.

    Joining a lobby is what gets you a room list (initially, when joining) and updates to it (automatically sent in intervals). So, yes, you need to join a lobby (manually in your code).

    The Asteroids Demo in the PUN 2 package shows how to handle the room list initially and for updates. This doc also explains how to get some properties into the lobby.

    You should not send all user IDs via the lobby. It's not built-in for a reason (traffic). To find someone meaningful for a user, use FindFriends.

  • noam_behar
    Options

    @Tobias thanks for getting back to me! However, can you please answer my question about whether all the players need to join to a lobby in order for me to see the list of rooms? (this will require me to update a new app version with autoJoinLobby=true).

    The state I'm trying to get to: I want to simulate a full lobby with many rooms, and work on the UI of showing the list of rooms so it's easy to dev-test it. So doing this directly on prod traffic will help me, because otherwise I'll need to create multiple fake rooms in test env and ensure the list UI looks fine.

    Also- if "autoJoinLobby and GetRoomList() were remove", won't that break my game if I update PUN? is there an alternative API?

    Thanks, Noam

  • Tobias
    Options

    The docs should explain this: Yes, you need to join a lobby to get a room list. If your prod clients don't join a lobby, their rooms will still be listed in the default lobby, so you should be able to test.

    Again: If your PUN version has autoJoinLobby, it is outdated and should be replaced. You can join a lobby when your client arrives on a Master Server and GetRoomList is replaced by a callback that provides the initial list and updates to this list. This is shown in the Asteroids Demo in the PUN 2 package.