Room is full when user creates it

AmirSffAmirSff
edited September 12 in Photon Server
hello, I have a game containing creating and joining random photon rooms.
the problem is when user creates a room, the room is full for about 5 seconds and other players can't join it. And after a few seconds the romm becomes available for others to join.
this is my code for creating room:
RoomOptions roomOptions = new RoomOptions();
        

        roomOptions.CustomRoomProperties = new Hashtable { { "Game", "10" }, { "leagueName", leagueName }, { "mapName", mapName } };
        roomOptions.CustomRoomPropertiesForLobby = new string[3];
        roomOptions.CustomRoomPropertiesForLobby[0] = "Game";
        roomOptions.CustomRoomPropertiesForLobby[1] = "leagueName";
        roomOptions.CustomRoomPropertiesForLobby[2] = "mapName";
        roomOptions.CleanupCacheOnLeave = false;
        roomOptions.MaxPlayers = 2;
        roomOptions.PlayerTtl = 2000;
        roomOptions.EmptyRoomTtl = 2000;

        PhotonNetwork.CreateRoom(null, roomOptions, null);

        PhotonNetwork.autoCleanUpPlayerObjects = false;
        PhotonNetwork.networkingPeer.DisconnectTimeout = 3000;
        PhotonNetwork.BackgroundTimeout = 3;
please help my solve the problem. It's really annoying.

Comments

  • Hi, @AmirSff
    Why did you decide that the room is full? How quick you reconnect to a game server after creation?

    The thing is that room is not available till is created on GameServer and was replicated from GameServer to Master. Only since this moment, others may join it.
    best,
    Ilya
  • chvetsov said:

    Hi, @AmirSff
    Why did you decide that the room is full? How quick you reconnect to a game server after creation?

    The thing is that room is not available till is created on GameServer and was replicated from GameServer to Master. Only since this moment, others may join it.
    best,
    Ilya

    thanks for answering me
    the problem is it takes more than 10 seconds and no one can join the room.
    when others want to join the room, they first check if there is a visible room and if they found a visible room, they join it. and after the room becomes full, master client makes the room invisible.
    And I also tried joinRandomRoom but it doesn't work either till about 10 seconds pass.
    please tell me if I'm doing anything in the wrong way.
  • hi, @AmirSff
    What backend are you using, PhotonCloud or Self hosted?

    I do not see anything wrong with room creation itself. The issue is somewhere else. you did change something and this thing breaks

    best,
    Ilya
  • chvetsov said:

    hi, @AmirSff
    What backend are you using, PhotonCloud or Self hosted?

    I do not see anything wrong with room creation itself. The issue is somewhere else. you did change something and this thing breaks

    best,
    Ilya

    hello @chvetsov

    I'm using self hosted . I just found out the problem always happens for the last person who wants to join the room. for example, if Room MaxPlayers is 4, 3 players can easily join the room. But when the forth guy wants to join the room, the "room is full" error just comes up. Even though there are 3 persons in the room. And after about 10 seconds of attempting, the forth player finally joins the room.
  • This says that some of your players connected to a game on master but did not on GamServer. Master keeps it around 15 seconds and then removes from the game. This may happen for instance if you connect to master with one userId and then to GS with another one

    Please switch on DEBUG logging for master server. You will there log messages about timeouts.

    best,
    ilya
Sign In or Register to comment.