How to Implement Lobbies

Making a lobby requires creating a room.

Firstly, we need room and member properties, which are configured using property maps.

Blueprint to create a room with appropriate properties

This Blueprint initializes a room property map which sets property values needed to implement the lobby:

  • key1 - defines if rooms will run as ranked matches, 0 means ranked and 1 means non-ranked.

  • key2 - the average skill level of the room members.

Blueprint to set member properties.

Here we initialize a current member property map. Besides the name property, we also set the state property’s initial value. The state property holds the ready state of the member: 0 means not ready and 1 means ready.

Note

Any values can be used, but remember that custom properties cannot be searched. If you want this information to be available to someone looking in the room, for example, you will want to use one of the values of key1-key8.

These property maps are passed to the Create Node Room function which creates a room on a random node.

Blueprint to create a room

Before creating a room, a connection to a master server should be established. A client automatically joins the created room after it is successfully created. The client has room owner authority, i.e., it is given the authority to update the room information, kick other members, and so on.

When the room owner is ready for the game, its state should be set to the ready state. This is done by using the following Blueprint:

Blueprint to set state "Ready"

Note

Set will erase existing properties, so always be sure to use the members received from Strix functions, containing the existing properties, and modify them with the Set Property functions.

The game will start when other members join the room and when they are ready. For this, members other than the room owner join the room by using the Join Node Room function. See more information about waiting on other members in How to Wait Until All Players Are Ready.

Blueprint to enter an existing lobby (room)