Turn based Multiplayer game create room join other can join the room, if its not reach max player

Options
i need like this Player1 connects to photon and creates room if there are no rooms, Player2 connects to photon and joined to the room which has been created by Player1. So the room is full (because I set maxPlayers to 2)
Now there is a new player Player3. Is Player3 will create a new room? because when I have used codes from "Sky Arena" my Player3 couldn't created a new room. Unity Editor console says "The Room is Full".After enter to room the suppose have his first turn like roll the dice and he gets 5 and finish his move now the second player turns, at this point how i can restrict player 1 he can't do anything until unless player 2 finished his move.

Comments

  • Hi @tahir,

    when the client is successfully connected to Photon you can use PhotonNetwork.JoinRandomRoom(); to join an available room. If there is a room available (current player count of this room is one), he joins this room and you are done with this case. If however joining a random room fails, there is a callback executed which you have to implement:
    void OnPhotonRandomJoinFailed(object[] codeAndMsg)
    {
        // codeAndMsg[0] is short ErrorCode. codeAndMsg[1] is string debug msg. 
    }
    Whenever this one is called, you know that there is no room available and the client can create a new one by using PhotonNetwork.CreateRoom(...); or PhotonNetwork.JoinOrCreateRoom(...);

    For turn-based possibilities please take a look at the PunTurnManager class included in the PUN package. Maybe this one helps. If you have further questions, please feel free to ask.