I'm new to Game Development. I'm creating a multiplayer game using Unity, Playfab and Photon. I'm doing matchmaking in Playfab and room creation in Photon. In Playfab I have a matchmaking queue with a max player and min player set as 2.
On running the game I can see that when 2 players log in and start the matchmaking process everything is fine and the players can play the game. But the problem is when 4 players join the game with 4 different devices (so 4 instances of the game) and try to start the match simultaneously.
The expected behaviour is when 4 players start the game simultaneously 2 rooms should be created with 2 players each and start the game. But what is happening, only 1 set of players is able to play the game and the other set of players are not able to.
I'm checking PhotonNetwork.CurrentRoom.PlayerCount is equal to 2 to start the game. when 2 players join the room it is working fine.
but when another 2 players try to play the game simultaneously while another match is going on, the master player is able to join the match but the second player is not joining and PhotonNetwork.CurrentRoom.PlayerCount is always equal to 1 for the second set of players.
while (PhotonNetwork.CurrentRoom.PlayerCount != 2)
{
Debug.Log("Player Count: " + PhotonNetwork.CurrentRoom.PlayerCount);
yield return null;
}
//After players join logic
I tried my best to explain the issue. please feel free to ask for any additional info on this. any amount of help will be much appriciated. Thank you