Automatic matchmaking
Many games do not use a lobby. For example, console games often opt to randomly match players together rather than allowing them to browse a list of games (which could be unwieldy with a controller), or some games also have a "Quick Play" button in the lobby which allows the user to jump right into the action without having to browse the server lists. Usually, players can specify a preference, such as which map to play on, or what game mode they want.
Luckily, random matchmaking in PUN is very easy.
In PUN, you can call the PhotonNetwork.JoinRandomRoom
function. This function takes a Hashtable of expected properties, and the desired max player count. It will attempt to join a random room, which will either call OnJoinedRoom
if a room was found and the client was able to connect, or OnPhotonRandomJoinFailed
if no room could be found (usually, this means all rooms are full, or no rooms are available).
Our lobby example might have a "Quick Play" button to do this:
// if quick...