Photon Creating Rooms but not listing them

Hi,
i am creating room on photon but i am not able to track those room, they are not visible in lobby and even if i am trying to join room with name it shows Game does not exits.

This is the code for room creation:
public void PrivateTable(double payOutCoins, byte maxPlayers,string privateRoomName)
    {
        RoomOptions roomOptions = new RoomOptions();
        roomOptions.CustomRoomPropertiesForLobby = new String[] { "entry_fee", "isAvailable", "Game_Type", "players" };
        roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "entry_fee", payOutCoins }, { "isAvailable", true }, { "Game_Type", GameManager._instance.CurrentGameType.ToString() }, { "players", maxPlayers } };
        roomOptions.IsVisible = true;
        roomOptions.PublishUserId = true;
        roomOptions.MaxPlayers = maxPlayers;
        players = maxPlayers;
        CurrentPrivateRooms.Clear();
        Debug.Log("Generated Unique ID: " + privateRoomName);
        PhotonNetwork.CreateRoom(privateRoomName, roomOptions, TypedLobby.Default,null);
    }
This is the code for room Joining:

public void JoinPrivateRoom()
{
        Debug.Log("Room trying to join : " + joinedRoomName.text);
        Debug.Log("Room Count : " + PhotonNetwork.GetRoomList().Length);
        var List = PhotonNetwork.GetRoomList();
        for (int i = 0; i < List.Length; i++)
        {
            Debug.Log("Name : " + List[i].Name);
        }
        PhotonManager._instance.JoinPrivateRoom(joinedRoomName.text);
  }


public void JoinPrivateRoom(string privateRoomName)
    {
        Debug.Log("Generated Unique ID: " + privateRoomName);
        PhotonNetwork.JoinRoom(privateRoomName);
    }

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Akrosh,

    Thank you for choosing Photon!

    You need to join the lobby where the room is created.
    In your case, it's the default lobby, so either enable AutoJoinLobby or explicitly join it.
    PhotonNetwork.GetRoomList() is available only after the callback call:
    OnReceivedRoomListUpdate. Implement that callback and list rooms inside to make sure rooms are indeed created and client is aware of their existance in the lobby.
  • Akrosh
    Akrosh
    edited June 2018
    hI @jhonedon35 ,

    I am in lobby and trying to get rooms in lobby lemme show you and i am not new to photon i have used photon in 3 different projects before this is the first time i am facing such problem that some times it show's list of the room that i created with Joinorcreateroom() and i can join them with joinRandomRoom function(). But here what i am trying to achieve is to create rooms with specific name for private game play and share the name with my friends to join. So CreateRoom() is creating the room and i can log the details of the room there is no error in creation but if i try to get list of rooms from other client i am not able to track the room its not present in the list and if i try directly to join with name it shows Game does not exits

    Photon Login :-
    public void LoginPhoton()
        {
            //string photonToken = GameManager.Instance.authToken;
            //Debug.Log(string.Format("Yay, logged in session token: {0}", photonToken));
            PhotonNetwork.AuthValues = new AuthenticationValues();
            PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Custom;
            PhotonNetwork.AuthValues.AddAuthParameter("UserName", GameManager._instance.userName);
            PhotonNetwork.AuthValues.AddAuthParameter("Password", GameManager._instance.userName);
            //PhotonNetwork.AuthValues.AddAuthParameter("Token", GameManager.Instance.authToken);
            PhotonNetwork.AuthValues.UserId = GameManager._instance.userName;
            PhotonNetwork.playerName = GameManager._instance.nickName;
            PhotonNetwork.ConnectUsingSettings("1.0");
    
            LoaderHandler._instance.loaderText.text = "Logging in to Game Server...";
            //connectToChat();
    
        }
    
    
    public void OnConnectedToMaster()
        {
            PhotonNetwork.JoinLobby();
        }
    
    public void OnJoinedLobby()
        {
            Debug.Log("Joined Lobby");
            //chatClient.SetOnlineStatus((int)UserStatus.Online);
                SceneManager.LoadScene("Lobby");
        }
    After Joining lobby em calling this from 1 client and its creating room and entering in it :-
    public void PrivateTable(double payOutCoins, byte maxPlayers,string privateRoomName)
        {
            RoomOptions roomOptions = new RoomOptions();
            roomOptions.CustomRoomPropertiesForLobby = new String[] { "entry_fee", "isAvailable", "Game_Type", "players" };
            roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "entry_fee", payOutCoins }, { "isAvailable", true }, { "Game_Type", GameManager._instance.CurrentGameType.ToString() }, { "players", maxPlayers } };
            roomOptions.IsVisible = true;
            roomOptions.PublishUserId = true;
            roomOptions.MaxPlayers = maxPlayers;
            players = maxPlayers;
            CurrentPrivateRooms.Clear();
            Debug.Log("Generated Unique ID: " + privateRoomName);
            PhotonNetwork.CreateRoom(privateRoomName, roomOptions, TypedLobby.Default,null);
        }
    Here is the callback :-
    void OnReceivedRoomListUpdate()
        {
            var roomsList = PhotonNetwork.GetRoomList();
            for (int i = 0; i < roomsList.Length; i++)
            {
                Debug.LogFormat(this, "[{0}] - {1}", i, roomsList[i].Name);
            }
        }
    Lemme know what possibly em missing my sever configuration is cloud and set to best Region.
  • Tested one more this after adding these line to room creation code


    roomOptions.PlayerTtl = 30000;//1Min.
    roomOptions.EmptyRoomTtl = 10000;

    the one who created it can see the room after leaving room and joining lobby
  • @JohnTube Can u please check with this issue some times it shows room list after creating room sometimes it doesn't... my project is already live and i have to push new build with private room concept and if you guys can't assist then please clear it i will stop recommending photon to my clients....
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Akrosh,

    Make sure clients can see each other (same AppId, same AppVersion, same Region, same lobby, etc.)
    Full "Matchmaking Checklist".

    if you guys can't assist then please clear it i will stop recommending photon to my clients
    It is better to avoid this. We do not work under threats. The forum is meant mainly for the community to help each other.
  • hi @JohnTube

    i have checked everything (app version, same region, same lobby everything), i have given you the code as well if u can check out your backend because it shows room sometime, so i dont feel like i have missed anything. Can u check if there is something broken at you side.
  • @JohnTube
    Thanx for the help i found the solution over here ;-

    http://forum.photonengine.com/discussion/comment/39942#Comment_39942