Joinrandomroom issue

Options
My game has a multiplayer mode. I use the joinRandomRoom function to create or join room. My room maximum
player count is 2. If A player and B player press the joinRandomRoom button in the same time. They cannot search any player. How can I search player if press the button in the same time

Comments

  • Hi @manlok1992,

    PhotonNetwork.JoinRandomRoom() only joins a room if there is one available. It doesn't create a room if it fails. In case of failure the OnPhotonRandomJoinFailed callback is executed. So I would recommend you to implement this callback in order to process anyway, for example by using PhotonNetwork.CreateRoom(...) so that the clients creates a room himself another client can join later.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited June 2017
    Options
    Hi @manlok1992,

    Thank you for choosing Photon!

    In case what you are asking is the following:
    "why sometimes you can't match players if they try random matchmaking at the same time"
    Then:
    this is a known issue. it should be gone when you have more testers or more players in production. as a workaround, wait after few seconds before trying to find a match from second player.
  • manlok1992
    Options

    Hi @manlok1992,

    PhotonNetwork.JoinRandomRoom() only joins a room if there is one available. It doesn't create a room if it fails. In case of failure the OnPhotonRandomJoinFailed callback is executed. So I would recommend you to implement this callback in order to process anyway, for example by using PhotonNetwork.CreateRoom(...) so that the clients creates a room himself another client can join later.

    I have implement the createRoom function in the joinRoomFailed. I meant if I press button in the same time, these 2 players will be create two rooms. I want a player is create room, another player is join room.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    @manlok1992,

    As I mentioned above:
    this is a known issue. it should be gone when you have more testers or more players in production. as a workaround, wait after few seconds before trying to find a match from second player.
  • manlok1992
    Options
    @JohnTube
    I know your solution. But my director want to fix this issue. But I don't have any way to fix it.