Logic for making a Lobby(Room browser)

Options
The entire project is finished but before releasing the game to market we decided to make a room browser and let players create their own rooms rather than creating rooms our self(something like a master room) which stays 24/7 online at our servers to reduce the server upkeep costs.

Problem is im not familiar with Photon API nor Unity Networking API. Im pretty sure that i have to use a for statement to list all rooms and create a button, text etc for each specific room but as i said i dont know what kind of built in function i have to write to retrieve all rooms.

If i can get a simple sample code i would really appreciate it.

With my all regards,
Emre Buğday,
Istanbul Interactive Studios.

Comments

  • Istanbul Interactive Studio
    edited August 2015
    Options
    Okay so since there was no reply we had to keep going with the system we used before; hosting rooms at our servers.
    It will still be nice to get an answer, can implement that function in next update.

    There was going to be another question, just wondering that are there any way to get information of a room without running a for loop if i know the name of the room(the room i host at my own servers)? Like;
    Name of the rooms are EU1,EU2,US1 and i want to get their room informations without doing a for loop. Is it possible?
  • Tobias
    Options
    If you want to show all rooms, have a look at the "Worker Demo" in the PUN package. It lists existing rooms with the old UI but the code will be the same for your case.
    You need to check "AutoJoinLobby" in the PhotonServerSettings, if you use PUN v1.60 and newer.

    You can't fetch the info of arbitrary rooms. We don't want clients polling those, so instead the server gives you the rooms per lobby, as long as you're in. You can define some properties which should be known in the lobby. Those are also pushed (and not polled).

    https://doc.photonengine.com/en/pun/current/tutorials/matchmaking-and-lobby

    In best case, you use the random matchmaking workflow as described at the top of the page. Showing room names and some properties to a player does not add much value usually. If they can select the level, game type, etc, they should be happy if the server finds them a fitting room.