Skip to main content

Lobby

Last updated on

Overview

AccelByte Foundations' Lobby service provides a continuous connection between your game and players by using WebSocket. WebSocket ensures reliable, real-time data transfer by allowing two-way communication between the server and clients. Since the Lobby serves as the main hub of your game, it is related to many of our other services, including:

  1. Presence which enables players to see what other players are doing in real-time. This feature is critical in online multiplayer games because player interactions rely on knowing which players are available.
  2. Party which is used as the basis for multiplayer matchmaking. Parties can be integrated with other services such as Presence, Friends, and Chat for a more engaging and enjoyable multiplayer experience.
  3. Friends which lets players connect and interact with each other. AccelByte supports both in-game friends and platform-level friends. In-game friends can chat and play together within a game, whereas platform-level friends allow players of different games to interact with each other on your web platform.
  4. Chat which enables real-time text-based communication in-game. We support global, party, and individual chat.
NOTE

Please click the below links to read how to implement Lobby in Unity and Unreal Engine.

Managing the Lobby in the Admin Portal

Configure the Lobby

  1. In the Admin Portal, open your game namespace, go to the Game Management section, and click on Lobby Configuration.

  2. On the Lobby Configuration page, you can configure your game’s lobby by adjusting the available settings.

    Lobby

    • Lobby Concurrent User (CCU)

      Lobby Concurrent User (CCU) displays the total number of active players. This value is refreshed once every minute.

      Lobby

    • Configuration

      This section includes general lobby settings.

      Lobby

      • Keep Player’s Activity: When toggled ON, a player’s activity data will be kept after they disconnect from the Lobby.
      • Max Player in the Lobby: determines the maximum number of players that can join the Lobby at any one time. The default value is -1, which means that an unlimited number of players can join the Lobby.
    • Chat Rate Limit

      This section contains Chat settings. The Chat Rate Limit Duration (ms) and Chat Rate Limit Burst settings work together to limit how many messages a player can send in the chat, to prevent spamming.

      Lobby

      • Chat enables or disables the chat feature in your game. This setting is set to Active by default.
      • Chat Rate Limit Duration (ms) is the amount of time (in milliseconds) that is used to determine when messages are considered spam. This setting works with the Chat Rate Limit Burst setting.
      • Chat Rate Limit Burst is the number of messages that a player can send within a given time period before they receive an error. This setting works with the Chat Rate Limit Duration setting.

      When combined, these two settings determine a particular rate of messages per unit of time. For example, if the Chat Rate Limit Durationis 1,000 milliseconds and the Chat Rate Limit Burstis 3, then 3 messages per 1,000 milliseconds (1 second) is the rate at which sent messages are considered spam by the Lobby service. This means that chat messages that are sent at a rate of less than 3 messages per second will be sent normally and not considered spam.

    • Entitlement Check

      This section contains Entitlements settings.

      Lobby

      • Entitlement Check: When set to ACTIVE, the backend will check if a player has the necessary entitlements before they are granted access to the Lobby. This can be used as an additional layer of security to prevent players from accessing games if they have obtained access to a Client ID and Client Secret that allows them to access your game, even if they haven’t purchased it.
      NOTE

      You must first publish a store in your game title to be able to configure Entitlement Check.

      Lobby

      • Select Item: determines which item will be used in the Entitlement Check.
    • Lobby Service Rate Limit

      These settings work together to determine how many requests a player can make to the Lobby service before an error is returned.

      Lobby

    • Duration Limit (ms) determines the duration (in milliseconds) in which requests made to the Lobby service may return an error. This setting works with the Burst Limit setting.
    • Burst Limit determines the number of requests that can be made to the Lobby service within a given time. This setting works with the Duration Limit setting.

    When combined, these two settings determine a rate of requests per unit of time. For example, if the Duration Limit is 1,000 milliseconds and the Burst Limit is 3, then 3 requests per 1,000 milliseconds (or per second) is the minimum rate at which requests sent to the Lobby will be considered spam by the Lobby service. This means that requests that are made at a rate of less than 3 per second will be handled normally and not considered spam.

Import or Export Lobby Configuration

  1. In the Admin Portal, open the desired game namespace, then go to the Game Management section and open the Lobby Configuration menu.

  2. On the Lobby Configuration page, click Export/Import Configuration in the top-right corner of the page.

    Lobby

  3. Two options will appear:

    • Export Lobby Configuration: The lobby configuration of the selected game namespace will be downloaded to your computer in .JSON format.

      OR

    • Import Lobby Configuration: The Import Lobby Configuration form will appear. Click Select JSON File to browse for the lobby configuration you want to import, then click the Import button. The selected lobby configuration will be imported.

      Lobby

Implementing Lobby using SDK

Connect to Lobby

You can connect AccelByte Foundations’ Lobby service to your game by using the command below:

AccelByte::FRegistry::Lobby.Connect();

Once you have set up a Lobby connection, you will be able to implement social features like Presence, Party, Friends, and Chat.

Handle the Connect / Disconnect Event

This feature notifies the game of any changes to the connection to the Lobby server. The SDK already provides an auto-reconnect mechanism, but when the auto-reconnect times out, you must reconnect manually.

FRegistry::Lobby.Connect();
FRegistry::Lobby.SetConnectSuccessDelegate(AccelByte::Api::Lobby::ConnectSuccess.CreateLambda([]()
{
// Do something If ConnectSuccessDelegate has been successful
}));
FRegistry::Lobby.SetConnectFailedDelegate(AccelByte::Api::Lobby::ConnectError.CreateLambda([]()
{
// Do something if ConnectFailedDelegate has been successful
}));
FRegistry::Lobby.SetConnectionClosedDelegate(AccelByte::Api::Lobby::ConnectionClosed.CreateLambda([]()
{
// Do something if ConnectionClosedDelegate has been successful
}));