Random Matchmaking is taking place even if the CustomRoomProperties and expectedCustomRoomProperties

Hi,
I am doing Random Matchmaking in our project. I have given some room properties while creating the room. The code is as follows while creating the match,
public void CreateMatch()
{
	RoomOptions roomOptions = new RoomOptions();
	roomOptions.IsOpen = true;
	roomOptions.IsVisible = true;
	roomOptions.MaxPlayers = 2;

        string[] LobbyOptions = new string[1];
	LobbyOptions[0] = "map";
	roomOptions.CustomRoomPropertiesForLobby = LobbyOptions;
	roomOptions.CustomRoomProperties = new Hashtable { { "map", 1} };
  	PhotonNetwork.CreateRoom("matchname", roomOptions, null);
}

and I am filtering the room in join random
public void JoinRandomMatch()
{
	byte expectedMaxPlayers = 2;
	Hashtable expectedCustomRoomProperties = new Hashtable { { "map", 2 } };
	PhotonNetwork.JoinRandomRoom(expectedCustomRoomProperties, expectedMaxPlayers);
}

Also I am doing following to set custom properties in a room
public void OnCreatedRoom()
{
        Hashtable prop = new Hashtable { { "map", 1 } };
        PhotonNetwork.room.SetCustomProperties(prop);
}

I am doing the basic thing, but though I am giving different values for Room Property "map", while creating room and while joining room, both the players are joining the room. I am not getting where I am doing wrong.

Comments

  • On first sight, this looks correct. I will take a look.
    Which version of PUN do you use?
  • Thank you for Response. I am using PUN v1
  • For me, this seems to work in PUN 2.28 on the Photon Cloud.
    First client fails to find a room and creates it. Second client fails to find a match (due to deliberately using not-matching map value) and also fails to create the room.

    You might want to try this with an up to date version of PUN 2.
  • Ok. Thank you Tobias.
  • Hi Tobias, I am using PUN2 but still I am getting above problem. Could you please help me where I am doing wrong...
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @prawinb,

    I replied to your email but I'm also posting this here:

    Please try without this first:
    public void OnCreatedRoom()
    {
            Hashtable prop = new Hashtable { { "map", 1 } };
            PhotonNetwork.room.SetCustomProperties(prop);
    }
    

    Maybe this is what's causing the second client to join the room because it now has the expected matching properties.

    Also maybe you have another PhotonNetwork calls due to another script/component in the scene which interferes with the matchmaking process (like a UtilityScript, ConnectAndJoinRandom).

    In any case, I would first; enable SupportLogger to add logs that help investigate this.
    Then I would test JoinRandomRoom calls from both clients -> both clients should fail to find any match.
    Then try a CreateRoom from one and a JoinRandomRoom from the other -> the second one should not join.
  • Thank you. I got your email. I am working on it.
  • Hi @JohnTube ,

    The issue is resolved. Thank you.