Basic Lobby
This is an example project for uLobby that demonstrates several features. The example consists of a number of simple screens with GUI elements for performing lobby actions. Features covered include:
- Initializing a lobby and connecting to it.
- Logging in to and out from accounts.
- Registering new accounts.
- Listing friends and sending friend invitations.
- Listing servers and players.
The project files can be downloaded here.

How to Run
The example is spread over three scenes and five scripts. Each scene corresponds to a peer type - lobby, server and client. To fully test the example, you should run several Unity projects simultaneously, either by duplicating the project folder and running in several Unity instances, or by building standalone executables of the scenes. Then, you should have one instance running the lobby scene, and any number of instances running the client or server scenes. The clients and servers connect to the lobby and you will be able to see them listed when running as a client.
This example uses the database. Before you can run the example you must set up a uGameDB database that the lobby can connect to. Then, you need to enter the IP address and port of the database in the lobby scene.
If you do not run all the Unity instances locally on the same machine, you need to configure the clients and servers to connect to the lobby on the right address and port. Do this by changing the <i>lobbyIP</i> and <i>lobbyPort</i> fields in the client and server scenes.
Code Overview
The following are the scripts in the example and their responsibilities.
BasicLobby.cs
Represents the lobby instance. Initializes a lobby, and sends updates of the logged in accounts to all connected peers.
Server.cs
Starts a server that connects to the lobby and registers itself with the server registry.
Client.cs
Handles connecting to the lobby as a client. Controls the flow of the example by calling GUI methods in either LoginScreen or GameScreen, depending on the current state of the program.
LoginScreen.cs
Contains the GUI code for showing the login and register screens. Uses the account manager for logging in to an existing account or registering a new one, and listening for account events.
GameScreen.cs
Represents the game that we have successfully logged in to. Contains GUI code for showing a list of connected players, your friend list and friend invitations, and a list of available servers. Showcases some simple usages of FriendListManager and ServerRegistry.

