You may want to implement continuous lobbies to better support your game's flow in the following situations:
Allowing players to join a game already in progress, even after the game instance has been launched.
Enabling players to return to the same lobby after the game instance has ended.
Essential steps to implement a continuous lobby:
Create a lobby type with
Allow join in progress
option enabledCall
FindOrCreateLobby
method with thelobbyType
created above from your client code, similar to this:void OnRTTEnabled(string jsonResponse, object cbObject)
{
var algo = new Dictionary<string, object>();
algo["strategy"] = "ranged-absolute";
algo["alignment"] = "center";
List<int> ranges = new List<int>();
ranges.Add(1000);
algo["ranges"] = ranges;
_bc.LobbyService.FindOrCreateLobby(
"CustomGame",
0,
1,
algo,
new Dictionary<string, object>(),
true,
new Dictionary<string, object>(),
"all",
new Dictionary<string, object>(),
null,
null,
OnFailed,
null
);
}Done! Lobby members will continue receiving RTT event updates when new players join the game.
If you're running a custom room server, call the
SysRoomStopped
method from the server via S2S API. This will stop the game server, return players to the lobby, and reset the lobby to its initial setup state.
Note that the default lifespan for the long-lived lobby is 1 hour. Suppose a server instance gets launched associated with the long-lived lobby AND it continues to report back to brainCloud via the SysRoomKeepAlive
call. In that case, the drop-dead
timeout for the lobby instance will continue to be pushed out indefinitely, at least until it reaches the maximum allowed server instance run time.