Multiplayer
Lobbies

Lobbies

There are basically two methods to use lobbies with the Steam Integration Kit.

Steam Integration Kit Method (Easy)

This is the easiest way to use lobbies with the Steam Integration Kit.

Create a Lobby

To create a lobby, you can use the Create Listen Server Session function. This function will create a new lobby and return the lobby ID if it was a success.

Please make sure to store reference to the lobby ID, as you will need it to modify the lobby later.

picture 10

Lobby Data

You can pass any data you want to store in the lobby in the Extra Settings parameter. This data will be stored in the lobby and can be retrieved later and can be used to filter the lobbies.

picture 11

Finding Lobbies

To find lobbies, you can use the Find SIK Sessions function with Match Type set to Lobby. This function will find the lobbies return the sessions found if it was a success.

picture 12

Now that you have the lobby IDs, we can either join the lobby or get the lobby data to display in the UI. Let's talk about both:

Joining a Lobby

To join a lobby, you can use the Join SIK Session function. This function will join the lobby with the given lobby ID.

picture 13

Get Lobby Data

To get the lobby data, you can use the SDK method given below or the session settings method given below.

picture 14

Leave Lobby

To leave the lobby, you can use the Destroy SIK Session function for both the host and the client. This function will leave the lobby.

picture 15

Direct Steamworks SDK Method (Advanced)

This is the most common way to use lobbies directly with the functions provided by the Steamworks SDK and exposed to Blueprints by Steam Integration Kit.

Create a Lobby

To create a direct steam lobby, you can use the CreateLobby function. This function will create a new lobby and return the lobby ID if it was a success.

Please make sure to store reference to the lobby ID, as you will need it to modify the lobby later.

picture 0

Update Lobby Data

Now that you have created a lobby, you can update the lobby data, including lobby owner data, lobby member data, and lobby type etc.

Set Lobby Data

To update the lobby data, you can use the SetLobbyData function. This function will update the lobby data with the given key and value.

picture 1

Like in the above example, we update the map name associated with the lobby.

Set Lobby Member Data

To update the lobby member data, you can use the SetLobbyMemberData function. This function will update the lobby member data with the given key and value. Also, just to add, this can only update the local user's data for the lobby.

picture 2

Set Lobby Type

To update the lobby type, you can use the SetLobbyType function. This function will update the lobby type with the given type.

picture 3

Please note, this value will just update the option you selected while creating the lobby session.

Finding Lobbies

To find lobbies, you can use the FindLobbies function. This function will find the lobbies return the lobby IDs of found sessions if it was a success.

picture 4

Now that you have the lobby IDs, we can either join the lobby or get the lobby data to display in the UI. Let's talk about both:

Joining a Lobby

To join a lobby, you can use the JoinLobby function. This function will join the lobby with the given lobby ID.

picture 5

Like in the above example, we get the length of found lobbies, then subtract 1 to get the first Lobby ID and join it. (Remember, the array starts from 0 and that's why we subtract 1)

Get Lobby Data

To get the lobby data, you can use the GetLobbyData function. This function will get the lobby data with the given key.

RequestLobbyData function is used to get the lobby data from the Steam backend. This function is only used to get the data from the Steam backend, and you can use GetLobbyData to get the data from the local cache.

picture 6

Leave Lobby

To leave the lobby, you can use the LeaveLobby function. This function will leave the lobby.

picture 7

Invite Friend to Lobby

To invite a friend to the lobby, you can use the InviteFriendToLobby function. This function will invite the friend to the lobby with the given lobby ID.

picture 9

To get the steam ID of the friend, please checkout the Steam Friends section.

Lobby To Session

We already know that lobbies are only existing on the Steam backend, but you can link a game server with a given lobby and it can be a Listen Server too.

Linking Lobby to a Dedicated Server Session

To link a lobby to a dedicated server session, you can use the SetLobbyGameServer function. This function will link the lobby to the dedicated server session with the given lobby ID and game server IP.

Cannot view the code? Click here (opens in a new tab)

In the above example, we set the lobby game server with the first dedicated server ip and port we found. (Remember, this is just an example and you may want to filter the dedicated server by some criteria)

Linking Lobby to a Listen Server Session

So let's talk about the basics first. A Listen Server is a server that is also a client. This means that the server is running on the same machine as the client. This is the most common way to implement multiplayer in games.

Here we will make the session owner a listen server and link the lobby to the listen server session. (For better understanding, please assume Lobby and Session are different thing and Lobby is just a chat room)

To link a lobby to a listen server session, you can use the SetLobbyGameServer function. This function will link the lobby to the listen server session with the given lobby ID and player's steam ID.

Cannot view the code? Click here (opens in a new tab)

In the above example, we set the lobby game server with the player's steam ID. Remember, the player's steam ID is the steam ID of the player who is hosting the session.

IMPORTANT : The level has to be opened with the listen tag to make the player a listen server.You can either use the OpenLevel function with the listen tag or use Execute Console Command function with the open command and the ?listen tag.

Callback Handling

When a Game Server is set, you will get a callback. You can handle the callback and join the user to the session.