Issue in Custom Matchmaking using SQL lobby type

Options
We are doing custom matchmaking using SQL Lobby Type.

Following is the code when we are creating room,
RoomOptions roomOptions = new RoomOptions();
roomOptions.IsOpen = true;
roomOptions.IsVisible = request.publicMatch;
roomOptions.MaxPlayers = (byte)request.maxPlayers;

int PlayerMyAge = PlayerPrefs.GetInt("PlayerMyAge");    
roomOptions.CustomRoomProperties = new Hashtable { { SQL_AGE_PROP_KEY, PlayerMyAge }, { SQL_MAP_PROP_KEY, "Maharashtra" } }; 

string[] LobbyOptions = new string[2];
LobbyOptions[0] = SQL_AGE_PROP_KEY;
LobbyOptions[1] = SQL_MAP_PROP_KEY;

roomOptions.CustomRoomPropertiesForLobby = LobbyOptions; 
			
PhotonNetwork.CreateRoom(request.matchName, roomOptions, sqlLobby);

And following is the code when we are joining the room,
int PlayerMinAge = PlayerPrefs.GetInt("PlayerMinimumAge");
int PlayerMaxAge = PlayerPrefs.GetInt("PlayerMaximumAge");

string sqlLobbyFilter = "C0 BETWEEN " + PlayerMinAge + " AND " + PlayerMaxAge + " AND C3 = 'Maharashtra'";

PhotonNetwork.JoinRandomRoom(null, 0, MatchmakingMode.FillRoom, sqlLobby, sqlLobbyFilter);

But after creating room by first client, it is not showing in OnRoomListUpdate. And other client is not able to join the room created by first client. Could you please help me in this.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @prawinb,
    But after creating room by first client, it is not showing in OnRoomListUpdate.
    SQL Lobby does not list rooms but you could use Custom Rooms Listing.
    You could use this to debug matchmaking issues by changing the filter until you find a match or a working filter.
  • prawinb
    Options
    I tried to change the filter, but still two clients are not joining each other. Both the clients are creating their own rooms. If first client is creating room, then second client should join the room if the filter properties are satisfied. I am not getting how to solve this issue.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited March 2021
    Options
    Hi @prawinb,
    roomOptions.IsVisible = request.publicMatch;
    

    Make sure this is always true.
    Invisible rooms are joined only via their name and cannot be joined randomly or listed in lobby or returned in GetCustomRoomList.
    Make sure to wait enough time for the room to finish creation.

    Otherwise you can debug this using App and Lobby Stats: to make sure the room is created in the right lobby and seen from the second client.

    Side note:

    I would replace
    string sqlLobbyFilter = "C0 BETWEEN " + PlayerMinAge + " AND " + PlayerMaxAge + " AND C3 = 'Maharashtra'";
    

    with:
    string sqlLobbyFilter = string.Format("{0} BETWEEN {1} AND {2} AND {3}='{4}'", SQL_AGE_PROP_KEY, PlayerMinAge, PlayerMaxAge, SQL_MAP_PROP_KEY, "Maharashtra");
    

    also preferably make C3 value a variable (method parameter or field.