Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Unable to get expectedCustomRoomProperties to work in Random Matchmaking.

$
0
0
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.

Viewing all articles
Browse latest Browse all 15755

Trending Articles