Differences between Lobby and Room

Options
Hi, I've been some years programming on Unity and now I am trying to dive into networking. What I try to achieve I think is a pretty simple case...

The player chooses if he will play as hero or enemy > he enters a wait room/lobby and wait for it to be filled > match start

The game itself consists on 4 heroes vs 1 enemy, this "enemy player" should act as the host of the match.

But I have so many doubts about the "waiting room" being a Lobby or if it should be a Room. In the Lobby case, I dont know how to difference if the player wants to be hero or enemy/client or host with just the JoinLobby() method... And in the Room case, Im not sure if a hero/client could create a Room and wait for a enemy/host to enter and become the host.

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited August 2018
    Options
    Hi @develec,

    Thank you for choosing Photon!

    To help you choose between a "waiting room" or "lobby room" and "proper lobby" here are some things to consider:

    - Inside a lobby, players can't see each other or communicate with each other using Photon (PUN or Photon Realtime). You may need another service for that, like Photon Chat or Facebook, etc. Although some players invented a smart way to exchange invitations via room lists!
    - Rooms are not meant for a big number of players, usually 4, 6 or 8, 10 tops. More require net code magic.
    - Lobbies are useful for rooms listing or random matchmaking. You don't need to join a random to make use of its matchmaking features. Only rooms listing requires joining a compatible lobby type.

    So for your case, I think you need two phases matchmaking system with phase 1 requires joining "waiting room".
  • Hi @develec,

    in Photon the Lobby is the place where all available rooms are listed. When a client wants to play, he joins a room (either a random or a certain room by name or from the Room List). So both - Lobby and Room - are totally different things in terms of Photon.

    What you can do: after the player has connected to Photon and joined the Lobby (either by enabling PhotonNetwork.autoJoinLobby = true; or using PhotonNetwork.JoinLobby();) you can offer him to options. The first option is "Play as Enemy", which will create a new room the client joins. This can be done by using PhotonNetwork.CreateRoom(...);. Important in this case is, that you use the Custom Room Properties and also make a certain identifier available to the Lobby. To see how this works, I would recommend you taking a look at the Matchmaking Guide. This links leads you directly to the section about how to make Room Properties available to the lobby, but I think you can also take a look at the rest of this page as well. The second option you can offer to the client is "Play as Hero". In this case the client tries to join a random room which has made the above mentioned certain identifier available to the Lobby. This is described on the documentation page mentioned above as well (Filtering Room Properties in Join Random).

    There is a certain case, where the above described application flow will fail: if the client wants to play as a hero and there is no random room available. In this case the client can create a room on his own (as hero) and make another certain identifier available to the lobby. If another client wants to play as an enemy now, he can to join a random room with this certain identifier first. If a room is available, he can join it. In this case you want to make this client the new MasterClient, which can be done by using PhotonNetwork.SetMasterClient(...);. If no room is available, he can create a new one as described before.
  • S_Oliver
    S_Oliver ✭✭✭
    edited August 2018
    Options
    Hi,

    im working on a Photon Example Project wich provide exactly what you are looking for.

    From simple Login to Room List/Overview to a waiting Room, in the Waiting room you can walk around with other players.
    If the Waiting Room is full or after a certain Time the picked Map will loading and the match begins.


    https://github.com/SradnickDev/Photon-Example
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited August 2018
    Options
    Hi @S_Oliver,

    I like the idea behind your repo.
    However:

    1. you need to remove PUN from the repo unless you have prior consent from Exit Games to include it in your public repo. I would add all PUN folders to .gitignore.
    2. I can't find examples mentioned in the readme. For instance the custom room and player properties extensions.