Unable to get expectedCustomRoomProperties to work in Random Matchmaking.

Options
I am attempting to filter the rooms a player can find in random matchmaking by using JoinRandomRoom and passing in a hashtable of properties by which to filter the available rooms.

When I run two clients they are unable to create/join the same room. They always create separate rooms because the second client can't find the first client's room. If I don't pass joinableRoomProperties into JoinRandomRoom then the clients are able to join the same room. But I need to be able to filter rooms on the "InProgress" property.
I'm connecting to the TypedLobby.Default Lobby.
Execution starts in StartMatchmaking()

        standardProperties = new Hashtable() {
            { "roomID", UnityEngine.Random.Range(0, 50000) },
            { "gameType", CustomProperties.GameTypes.Deathmatch },
            { "numZones", 1 },
            { "numPlayers", 10 },
            { "maxPlayers", 12 },
            { "requiredPoints", 1000 },
            { "winType", WinManager.WinTypes.Null },
            { "InProgress", false }
        };

        joinableRoomProperties = new Hashtable() {
            { "InProgress", false }
        };

    string[] lobbyVisibleProperties = new string[] { "InProgress" };


    internal void StartMatchmaking() {
      PhotonNetwork.JoinRandomRoom(joinableRoomProperties, 0);
    }

    void OnPhotonRandomJoinFailed() {
        Debug.Log("Couldn't find room");
        CreateGame(RandomRoomName());
    }

    public void CreateGame(string gameName) {
        gameName = PhotonNetwork.lobby.Name + gameName;
        PhotonNetwork.autoCleanUpPlayerObjects = false;
        RoomOptions roomOptions = new RoomOptions { CustomRoomProperties = standardProperties, CustomRoomPropertiesForLobby = lobbyVisibleProperties };
        PhotonNetwork.CreateRoom(gameName, roomOptions, PhotonNetwork.lobby);
        SavedPrefs.LastGame = gameName;
    }
What more is required to get property filtering to work in random matchmaking?

Thank you.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @ScottS,

    Thank you for choosing Photon!

    Your code looks OK.
    Please go through the Matchmaking Checklist.

    You can also make sure the room is created with the proper lobby property by listing rooms inside default lobby.
    Also in case this is happening during test/dev phase, wait few seconds before trying matching 2nd client.