SQL Lobbies Filter Not Being Taken Into Account
Hey,
I am trying to get a matchmaking logic working with an ELO filter but it does not seem to work in the intended way.
What happens is that the first client searches for a room and creates one as there are no rooms available at all. The second client runs the same logic (first searches) but it does not matter if the second client's mmr is in the range of created room mmr, it always joins this room.
Example: Client one creates a room with predefined mmr of 1400. Second client should first look for an available room of a filter ranging from 1450 and 1550. It finds the newly created room from the first client and joins it, even though it is not in the range of the filter.
What am I possibly doing wrong?
Please advise
Thanks
I am trying to get a matchmaking logic working with an ELO filter but it does not seem to work in the intended way.
public void SearchRatedGame() { min = int.Parse(mmrTextInput.text) - 50; max = int.Parse(mmrTextInput.text) + 50; TypedLobby sqlLobby = new TypedLobby("myLobby", LobbyType.SqlLobby); string sqlLobbyFilter = "C0 > " + min + " || C0 < " + max; Debug.Log(sqlLobbyFilter.ToString()); PhotonNetwork.JoinRandomRoom(null, 0, MatchmakingMode.SerialMatching, sqlLobby, sqlLobbyFilter); }This is my code for first searching for a game that is in the - 50 and + 50 range of the players elo (rating). For development purposes, I am typing in an input field now the mmr just to test it.
public override void OnJoinRandomFailed(short returnCode, string message) { Debug.LogWarningFormat("Failed to join a random game"); CreateRatedGame(); }This runs when a room with the filter is not found in the first place.
public void CreateRatedGame() { RoomOptions roomOptions = new RoomOptions(); roomOptions.MaxPlayers = 10; roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "C0", mmrTextInput.text } }; roomOptions.CustomRoomPropertiesForLobby = new string[] { "C0" }; TypedLobby sqlLobby = new TypedLobby("myLobby", LobbyType.SqlLobby); PhotonNetwork.CreateRoom(PhotonNetwork.NickName, roomOptions, sqlLobby); }This is run from OnJoinRandomFailed as it creates a room with a custom property of the matchmaking rating previously typed in the input field.
What happens is that the first client searches for a room and creates one as there are no rooms available at all. The second client runs the same logic (first searches) but it does not matter if the second client's mmr is in the range of created room mmr, it always joins this room.
Example: Client one creates a room with predefined mmr of 1400. Second client should first look for an available room of a filter ranging from 1450 and 1550. It finds the newly created room from the first client and joins it, even though it is not in the range of the filter.
What am I possibly doing wrong?
Please advise
Thanks
0
Comments
-
Hi @HeadlessFly,
It seems like "mmr"/"C0" values you are setting and comparing is of type string!
Make sure to use proper type, parsingmmrTextInput.text
into int.0 -
Hi @JohnTube,
I previously tried parsing the mmrTextInput.text but it does not work too.roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "C0", int.Parse(mmrTextInput.text) } };
No idea to why it is not working. It also does not work for only one operator such as'C0 > ' + int.Parse(mmrTextInput.text);
. Actually, it works only if I keep the string likeC0 > 1500
but then I cannot change the filter range based on the players current rating.
Any ideas?
Thanks0 -
Hi @HeadlessFly,
No idea.
Try changing||
toOR
.
Try usingC0 BETWEEN x AND y
instead ofC0 > x OR C0 < y
.
Try using <= instead of < and >= instead of >.
Try changing theMatchmakingMode
.0 -
0
-
HeadlessFly wrote:Example: Client one creates a room with predefined mmr of 1400. Second client should first look for an available room of a filter ranging from 1450 and 1550. It finds the newly created room from the first client and joins it, even though it is not in the range of the filter.
The problem is 1400 is actually IN the range of the filter
Should replace "||" with "AND" or something like that
Oh, and I'm sorry for necroposting!0