Sequence for joining lobby/room

Options
Could someone please advise or point me to an article (looked at Sky Arena, etc) on the basic workflow when using lobbies/rooms? The info is fragmented and a bit confusing :-(. Lot of stuff about joining rooms, listing players and all the callbacks - but HOW do they fit together?

For the simplest case: I have two maps, the players pick one and hit "play", wait until 5 players (including themselves) get matched and are ready to go, the level loads (on ALL clients - i.e. wait until the slowest machine has finished loading), 10 second countdown, game begins for everyone.

Question is: Where do they "wait" (is that in the lobby or in the room)? When do I JoinOrCreate the room? When do I load the level? Does the room have to be "JoinOrCreated" by at least one player before others see there's a room to join (with the room property "mapname" (or "mn" as recommended) exposed to the lobby for matchmaking)?

Thanks for any help!


Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @NotQuiteSmith,

    You don't need to join lobbies or list rooms for your use case.

    Call JoinRandomRoom with the map as a custom lobby property ("mn" key).
    If no room is found, create a new one with a custom lobby property ("mn" key) set to the requested map and MaxPlayers set to 5.
    Creating a room makes you join it.

    Once joined to the room, wait for the room to become full (players count == 5 or wait for a custom event/RPC ready by all players or use player properties for the ready flag) then start the game (send RPC, load level, etc. preferably by Master Client).

    "Matchmaking Guide".
  • Perfect! Thanks!