Differences between Lobby and Room

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Differences between Lobby and Room

develec
2018-07-31 15:51:31

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.

Comments

JohnTube
2018-08-02 09:58:39

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".

[Deleted User]
2018-08-02 10:17:03

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
2018-08-02 11:02:11

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
2018-08-02 12:40:43

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.
Back to top