Lobby Data
Steam Lobby Functionality in an easy to use struct
Like what your seeing?
Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!
Introduction
The LobbyData object is a custom CSteamId that carries tools and functions unique to the Steam Lobby system. This object is common between both Unity and Godot game engine integrations.
You can convert a Lobby to a ulong or CSteamID or convert a ulong or CSteamID to a Lobby implicitly e.g.
or
or
All data is read on demand and is always up to date with the Lobby object. The only information it stores in local memory is the ID of the lobby its operating on.
Constants
The following are constant strings used internally to manage Heathen standard metadata values
DataName
key = name
DataVersion
key = z_heathenGameVersion
DataReady
key = z_heathenReady
DataKick
key = z_heathenKick
DataMode
key = z_heathenMode
DataType
key = z_heathenType
Fields and Attributes
All Players Not Ready
This iterates over the Members array
Returns true if all of the players 'IsReady' is false
All Players Ready
This iterates over the Members array
Returns true if all of the players 'IsReady' is true
AccountId
The account ID segment of the full CSteamID, to understand more read this article.
Friend Id
The underlying uint value of the AccountID_t segment of the CSteamID, to understand more read this article.
Full
Returns true if the lobby is full e.g. has no more open slots
Game Server
Returns the lobby game server data if any
Game Version
Gets or sets the version of the game the lobby is configured for ... this should match the owners version. This can only be set by the owner of the lobby.
Has Server
Does this lobby have a game server registered to it
Is Group
Indicates rather or not this lobby is a group (aka party) lobby. When set to true a metadata value `z_heathenMode` will be set to `Group` and the lobby type will be set to a invisible.
Is Owner
Returns true if the local user is the owner of this lobby
IsReady
Sets the ready flag for this player on this lobby
IsSession
Indicates rather or not this lobby is a session lobby. When set to true a metadata value `z_heathenMode` will be set to `Session`. Lobby type is not automatic set when writing to this field. Session type lobbies can technically be of any type.
IsTypeSet
This returns true if the Lobby Type is known
IsValid
This indicates rather or not the underlying CSteamID is of the proper Universe and Type it does not indicate that it is a valid entry. E.g. this tells you if the data is of the right shape ... not that it equates to a valid entry in Steam client.
Me
Returns the local user's LobbyMember value for this Lobby.
Members
this must create the array each time it is called, so call it once, cash it and use it do not call it multiple times a frame.
Returns an array of all the lobby members.
Max Members
Gets or sets the max members permitted in this lobby, this can only be set by the owner.
Member Count
Returns the number of members currently in this lobby
Name
The name of the lobby if stored in the lobby's metadata. Only the owner of the lobby can set this value.
Owner
The LobbyMember data for the owner of the lobby, only the current owner can set this value to some other LobbyMember.
SteamId
The underlying ulong value of the CSteamID
Type
Returns the type of the lobby if set, if not set this will default to Private, you can check if the type is set with IsTypeSet. Only the owner of the lobby can set this value.
Methods
this[string key]
read and write metadata values on the lobby much as you would access members in a dictionary.
This will never throw a key not found exception, if a key is not present it will simply return an empty string.
Set Type
Functionally the same as setting the Type field, this only works for the owner of the lobby
Set Joinable
Sets the lobby as joinable or not. A lobby always starts as joinable, a lobby that is not joinable cannot be joined by anyone not even a friend or an invited user. This can only be used by the owner of the lobby.
Get Metadata
Returns all the metadata for the lobby as a string dictionary. This creates the dictionary each time it is called so cashรฉ the value before use or read the values directly from the lobby such as via the indexer.
Create
We have a number of static create methods you can use to quickly create common types of lobbies.
Join
This attempts to join the player to this lobby. The callback parameter of this event expects a handler method such as
This method has several static overloads that can be useful for friend join UI features and similar
In all cases these static members fetch the lobby indicated by either an account ID or the Lobby value its self and then attempts to join it. The callback parameter takes the same for as the instanced method.
Leave
Leaves the lobby, if the owner leaves Steam will assigne a new owner.
Get
These methods simply return a valid Lobby object representing the lobby indicated by the provided data.
Group Lobby
Get the group lobby the user is a member of if any
Session Lobby
Get the session lobby the user is a member of if any
Delete Lobby Data
Removes the indicated metadata entry if present, can only be used by the owner of the lobby
Invite User to Lobby
Invites the indicated user to the lobby
Request
Searches for a lobby that matches the arguments
Send Chat Message
Sends a message over the Lobby chat system. You can use tools like the Lobby Chat Director to help you manage incoming chat messages.
Note that Steam's lobby chat sends byte[] data so it can send more than simple text if you need.
Set Game Server
Sets the Game Server information and causes the EventLobbyGameServer event to be raised on the Matchmaking interface and on any attached Lobby Manager components.
Kick Member
Marks the ID as a member that should be removed from the lobby. This simply sets the ID to a "kick list" on the lobbies metadata and will cause the EventLobbyAskedToLeave event to be raised for the effected user on the event is present on the Matchmaking interface and Lobby Manager.
Kick List Contains
Does the kick list contain the members ID;
Remove from Kick List
Removes a member from the kick list if present
Clear Kick List
Clears the kick list
Get Kick List
Gets a list of the IDs in the kick list. This must build the array every time its called so cashe the results and only update when needed.
Set Member Metadata
Set metadata on the local user's LobbyMember
Get Member Metadata
Gets the metadata field from the local user's LobbyMember
Gets the metadata field for the indiacated user
Last updated