How are lobbies created?
There are several ways a lobby can be created.- By your players: Lobbies can be created by players who want get together a team of players to play. These are client-owned lobbies.
- By your game servers: Your title’s game servers can create lobbies and wait for players to join. These are server-owned lobbies.
- By matchmaking: After a group of players form after matchmaking, a lobby is created as a holding place before the game starts. These are client-owned lobbies.
Supported entity types
Before a lobby can be created, your title must login as a PlayFab entity.- When creating client-owned lobbies on behalf of your players, login as a title_player_account entity. For more information, see Log in basics and best practices.
- When creating server-owned lobbies on behalf of your game servers, login as a game_server entity. For more information, see AuthenticateGameServerWithCustomId.
How lobbies are configured
Several important settings for a lobby are configured during creation: maxMemberCount, accessPolicy, owner, and ownerMigrationPolicy.- maxMemberCount defines how many players the lobby can hold
- accessPolicy defines who may discover the lobby’s connection string
- owner defines the lobby’s owner which has special permissions to update data on the lobby. This value is implicitly the client or server entity who is creating the lobby.
- ownerMigrationPolicy defines policies for how ownership of the lobby should be transferred if the current owner leaves the lobby or has trouble maintaining a connection to the lobby.
Example creating a client-owned lobby using the Lobby and Matchmaking SDK
This example uses a local player who has been logged into PlayFab as a title_player_account entity. In this code snippet, Lobby properties are passed in as lobbyConfiguration and the player creating the lobby passes in their initial member properties via creatorMemberConfiguration. The local player becomes the lobby owner, so it’s a client-owned lobby. After the lobby is successfully created, the PFLobbyHandle can be used to invite other players with PFLobbySendInvite.Example creating a server-owned lobby using the Lobby and Matchmaking SDK
This example is similar to the client-owned lobby example except that it creates the lobby as a game_server entity and PFMultiplayerCreateAndClaimServerLobby is called in place of PFMultiplayerCreateAndJoinLobby.To enable the game server APIs in PlayFab Multiplayer, you must define PFMULTIPLAYER_INCLUDE_SERVER_APIS before including PFLobby.h. For more information, see Game Servers and Lobbies
