Matchmaking for two players entering at the same time

Hello, I'm following this workflow for random matchmaking, but we are testing on two devices, when the two players try to do matchmaking at exactly the same time none of the both players find a room and they each one create a room and they keep waiting there.

Is there any way to detect that this situation happend and merge the two rooms?

What I was trying to do is every x seconds disconnect from the created room, and try to join a random room again, but if this is called at the same time on both devices the problem still ocurrs since both are trying to find a empty room at the same time again, so what I'm doing now is doing this in random intervals so both devices dsynchronize and they can finally join the same room.

It's working in this way but I feel its a dirty solution, have someone else have a better suggestion or another way of doing this?


  • Hi @AlanCreateForLife,

    Thank you for choosing Photon!

    The situation you are described is expected in early development and testing phases.
    It will auto resolve itself as soon as you have enough players.

    There is no way to merge two rooms.

    The following is just a workaround that you won't need in production.
    What you can do when doing manual tests using two devices is to wait until the room is fully created:
    either from:
    - from the first client (creator): wait until joined then join from the second client
    - from the second client: wait until AppStats or LobbyStats or GamesList change (get notified of rooms creation) to join it
  • Thank you a lot!, @JohnTube I was not aware of the AppStats and LobbyStats, I will try to do an implementation using those, what I did was adding a button to cancel room creation so they can try again to avoid being stuck
  • Hey @JohnTube, sorry to open up this discussion again, but there is no way of matchmaking 2 players who search at the same time? So I should leave this problem which would auto resolve with enough players?
  • Hi @Afterlife1707,

    Well the solution is to use JoinOrCreateRandomRoom.
    First client's request will create the room, second client's request will join it.
Sign In or Register to comment.