Rooms created in separate lobbies are visible in other lobbies?

H.

I have a Quickmatch and Tournament mode in my game. If you choose Quickmatch the lobby named "QuickLobby" is joined from where a player can create rooms and viceversa: If you choose Tournament mode a different lobby named "TourLobby" is created from where you can create rooms for people to join.

Here's the lobby creating and joining code for Quickmatch:
private TypedLobby QuickLobby = new TypedLobby("QuickLobby", LobbyType.Default);

public virtual void OnConnectedToMaster()
{
PhotonNetwork.JoinLobby(new TypedLobby("QuickLobby", LobbyType.Default));
}

Here's the lobby creating and joining code for Torunament mode:
private TypedLobby TourLobby = new TypedLobby("TourLobby", LobbyType.Default);

public virtual void OnConnectedToMaster()
{
PhotonNetwork.JoinLobby(new TypedLobby("TourLobby", LobbyType.Default));
}

As you can see they are the same but for some reason, rooms created only in the Tournament mode lobby can be seen by the players that have only joined the quickmatch lobby.

Here's the room creation code for Tournament mode:

public void createRoom()
{

RoomOptions roomOptions = new RoomOptions();

roomOptions.IsVisible = true;

roomOptions.maxPlayers = (byte)MaxPlayer;

PhotonNetwork.CreateRoom (Random.Range(0, 9999).ToString(), roomOptions, TypedLobby.Default);
}

Why is the room visible in another lobby, shouldn't the rooms automatically be separate since it's not the same lobby?

Comments

  • Hi @petersenjmp,

    Thank you for choosing Photon!

    You are creating rooms in default lobby: TypedLobby.Default
    so instead of
    PhotonNetwork.CreateRoom (Random.Range(0, 9999).ToString(), roomOptions, TypedLobby.Default);
    
    do this if you want to create rooms in Tournament lobby:
    PhotonNetwork.CreateRoom (Random.Range(0, 9999).ToString(), roomOptions, TourLobby);
    

    Side note: since you have the lobby as a field, why not use it instead of creating a new one each time:
    private TypedLobby QuickLobby = new TypedLobby("QuickLobby", LobbyType.Default);
    
    public virtual void OnConnectedToMaster()
    {
    PhotonNetwork.JoinLobby(QuickLobby );
    }
    

    and
    private TypedLobby TourLobby = new TypedLobby("TourLobby", LobbyType.Default);
    
    public virtual void OnConnectedToMaster()
    {
    PhotonNetwork.JoinLobby(TourLobby);
    }
    
  • @JohnTube Best answer ever my friend, thank you very much. I thought it had to be typed lobby default but of course, it makes sense and thanks for the tip about the lobby creation. Have a great day!
  • @JohnTube The rooms aren't visible in in the lobbies to other players even though it's set to isVisible in room options. I used your line of code to create the rooms: PhotonNetwork.CreateRoom (Random.Range(0, 9999).ToString(), roomOptions, TourLobby);

    And to join the lobby:
    private TypedLobby TourLobby = new TypedLobby("TourLobby", LobbyType.Default);
    
    public virtual void OnConnectedToMaster()
    {
    PhotonNetwork.JoinLobby(TourLobby);
    }
    

    Do you know why the rooms aren't visible to others who are in the same lobby?




    Another issue I'm having is figuring out how to search and find private rooms. They are created and named as such which is working:
    public void createPrivateRoom()
        {
    
            createroom.interactable = false;
            RoomOptions roomOptions = new RoomOptions();
           
            roomOptions.IsVisible = false;
            roomOptions.IsOpen = true;
    
            roomOptions.maxPlayers = (byte)MaxPlayer;
    
    
    
            PhotonNetwork.CreateRoom(SRN.RoomNominclature, roomOptions, null);
          
    
        }
    

    *SRN.RoomNominclature is the "nomenclature" or name of the room in the following Save Room Script that stores the name from the inputfield:
    public InputField nameInput;
       public string RoomNominclature;
    
    
        public void SaveUsername()
        {
            RoomNominclature = nameInput.text.ToString(); 
        }
    


    The problem is when I try the following code to search and find the room with the correct name, it never finds it:
    public void SearchAndJoinPrivateRoom()
        {
    
            if (InputFieldForRoomName.text == SRN.RoomNominclature) 
            {
    
    
                for (int i = 1; i < roomInfo.Length; i++)
                {
                    if (roomInfo[i].Name != SRN.RoomNominclature)
    
                        NoRoom = true;
    
                        else NoRoom = false;
    
                    if (NoRoom == false)
                    {
                        Debug.Log("There is a room with this name");
                        PhotonNetwork.JoinRoom(SRN.RoomNominclature);
                    }
                }
            }
        }
    

    Do you know why by any chance? All help is very very appreciated my friend. Thank you
  • I fixed the rooms not being visible issue by getting the room list OnReceivedRoomListUpdate() yaaay, so now I just have to make the search rooms function work, I look forward to your input :-)
  • Hi @petersenjmp,

    Invisible rooms are not listed in the lobby.
    Invisible rooms are joined only using their room name.

    Read "Matchmaking and Lobby".

    Please do the "PUN Basics Tutorial" and maybe some other YouTube tutorials.
    Also make sure to read the documentation carefully and search the forum or the internet for answers on questions already asked before.

    Find some tutorial links here.
  • @JohnTube The links you've sent do not explain how to search for and join a specific room only random rooms. Please tell me exactly where to find this information as I have already searched "and maybe some youtube tutorials" is not helpfull at all btw!
  • JohnTubeJohnTube mod
    edited March 24
    You can't search for or list invisible rooms.
    In order to join an invisible/private room you need to know its room name beforehand.
  • edited March 24
    Well it's clear you haven't read my post. I have never asked about how to find an invisible room. I have explained how I am trying to search for rooms by Name from the start and my posted code clearly shows that as well. The private room is invisible so as to not show up in any of the lobbies! This is typical Photon support
Sign In or Register to comment.