Introduction to uLobby
uLobby is a lobby system for the Unity game engine that simplifies the task of adding lobby functionality to multiplayer games. It consists of a variety of components that can be used for implementing features such as account management, server and player listings, text chat and chat channels, friend lists, geo-filtering, server creation, and more. uLobby also has built-in database support to allow for persistent storage of data associated with players and other lobby information.
uLobby can be used as an add-on to virtually any type of network game created with Unity. It makes no assumptions about the type of the game and puts no restrictions on the networking library used by it. It uses its own networking API that can be used side-by-side with the game's own networking layer, in order to include lobby functionality while running the actual game.
At the core, the role of a lobby is to get players into the game. Usually, this means finding a suitable game server for a player to join. There are a multitude of ways in which this can be done, depending largely on the game itself and of the desired sophistication of the game setup process. For example, a common scenario would be for the lobby to provide a list of active game servers that the player can join. Players might also be able to see what other users are currently in the lobby and chat with them. Perhaps players could start their own game servers and invite other players to join it. Another type of lobby could omit the server selection process completely and let players automatically join a game server based on their skill in the game or the geographical distance of their computer to the server.
To allow for all of these different types of lobby systems, uLobby is designed as a set of independent components that can be freely mixed and matched to tailor the lobby for the game's needs. This means that developers can include only the functionality they need and customise it appropriately, while leaving out unwanted features.
uLobby runs in a standard Unity instance, and configuring it is therefore done in the same environment as the game itself. In its simplest form, without adding any custom functionality, the lobby system consists of a lobby server waiting for incoming connections. Game clients and game servers connect to the lobby server to register themselves with it, and communication to and from the lobby server can thereafter be carried out using RPCs, similar to how networking in Unity works.
The same uLobby API is used in the lobby server, game client and game server. The base API includes such functionality as initializing the lobby server, connecting and disconnecting to it, and sending RPCs. The rest of the functionality is provided by separate components. The following is a list of the extra functionality that can be added through the use of additional components.
Adds support for user accounts. Users can register with the lobby using a name and password - or other custom types of credentials - and later log in to the account. The lobby takes care of user credentials verification and stores account information in the database.
Server and Player Listings
Provides information about what game servers are connected to the lobby system, and of the players that are logged in. This can be used for implementing interface controls that let players choose what game server to connect to, and for implementing player lists showing the logged in players.
Provides support for adding other players as friends, sending friend invitations and keeping track of friend lists. uLobby stores the friend information in a database and automatically makes it available to players upon connecting to the lobby.
The following features will be available shortly:
Adds text chat functionality to game clients, allowing players to talk with each other in the lobby. Also includes support for chat channels that can be used for separating different conversations among groups of players. Since the lobby connection can be kept while playing the actual game, the same chat system can be used for both the lobby and the game - should the developer choose to.
Adds functionality for finding the general geographical location of a client's computer. This might be used for automatically selecting a server in the player's geographical region, or for finding nearby players.
Enables starting game servers programmatically from the lobby, thereby bypassing the need to manually setup the server instances. This can be used for implementing a scalable lobby that automatically creates new server instances as more players connect, and closes them when the load decreases. It can also be used for games that allow players themselves to create new servers.