Question About JoinRandomRoom in SqlLobby
Options
RockYip
✭
I want a user join a random room with using SQL Filter. But I find that if I put ExpectedCustomRoomProperties and SQLFilter together, the SQLFilter will be ignored. I want to know if I can only use either one of them?
Does it mean that I need to put all ExpectedCustomRoomProperties to C* and compare their equality?
Here is part of my code:
What I want to do is if the room is created by a Player with Level 10, only players with level 10 or higher can join this room. Those below Level 10 cannot join the room.
But if I put GameRule in expectedCustomRoomProperties, the player can join room without checking the Level.
If I pass null to expectedCustomRoomProperties, the player will now check the level and fail to join room if the level do not reached with the room creator.
Does it mean that I need to change "GameRule" to C1 and check in the SQL "C0 <= userLevel And C1 = 1" ?
Does it mean that I need to put all ExpectedCustomRoomProperties to C* and compare their equality?
Here is part of my code:
int maxPlayers = 4; TypedLobby sqlLobby = new TypedLobby("Lobby", LobbyType.SqlLobby); public void CreateRoom (string roomName, int userLevel) { RoomOptions options = new RoomOptions (); options.CustomRoomPropertiesForLobby = new string[3]; options.CustomRoomPropertiesForLobby[0] = "RN"; options.CustomRoomPropertiesForLobby[1] = "OP"; options.CustomRoomPropertiesForLobby[2] = "C0"; options.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable (); options.CustomRoomProperties.Add ("GameRule", "1"); options.CustomRoomProperties.Add ("C0", userLevel); //C0 = User level options.MaxPlayers = maxPlayers; PhotonNetwork.CreateRoom (roomName, options, sqlLobby); } public void JoinRandomRoom() { ExitGames.Client.Photon.Hashtable expectedCustomRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "GameRule", "1" } }; string sqlLobbyFilter = "C0 <= " + level; PhotonNetwork.JoinRandomRoom(expectedCustomRoomProperties, maxPlayers, MatchmakingMode.FillRoom, sqlLobby, sqlLobbyFilter); }The GameRule is for different game mode of a room.
What I want to do is if the room is created by a Player with Level 10, only players with level 10 or higher can join this room. Those below Level 10 cannot join the room.
But if I put GameRule in expectedCustomRoomProperties, the player can join room without checking the Level.
If I pass null to expectedCustomRoomProperties, the player will now check the level and fail to join room if the level do not reached with the room creator.
Does it mean that I need to change "GameRule" to C1 and check in the SQL "C0 <= userLevel And C1 = 1" ?
0
Best Answer
-
OK.
After checking with the team, expected lobby properties filtering does not work in SQL lobbies.
Only SQL filter strings could be used in random matchmaking inside SQL lobby type.5
Answers
-
OK.
After checking with the team, expected lobby properties filtering does not work in SQL lobbies.
Only SQL filter strings could be used in random matchmaking inside SQL lobby type.5 -
Sorry, I forgot I have posted a question here and thanks for answering .
I have removed expectedCustomRoomProperties and only use SQL filter in my code.
It works perfect now .0