Lobby

Introduction

The Lobby object is a custom CSteamId that carries tools and funcitons unique to the Steam Lobby system.
You can convert a Lobby to a ulong or CSteamID or convert a ulong or CSteamID to a Lobby implicitly e.g.
1
Lobby myLobby = new CSteamID(ulongId);
Copied!
or
1
ulong id = myLobby;
Copied!
or
1
CSteamID id = myLobby;
Copied!
All data is read on demand and is always up todate 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

Definition

1
public struct Lobby : IEquatable<CSteamID>, IEquatable<ulong>
Copied!

Fields and Attributes

Type
Name
Notes
CSteamID
id
The native id of the lobby
string
Name
the name of the lobby if stored in the lobbies metdata else this returns blank.
This can be used by the owner of the lobby to set the lobby name
LobbyMember
Owner
Returns the lobby owner's LobbyMember object
This can be used by the owner to set a new user as owner
LobbyMember
User
Gets the local user's LobbyMember entry
LobbyMember[]
Members
Gets an array of all the members in this lobby
bool
IsTypeSet
Does the system know what type of lobby this is e.g. public, private, friend, etc.
ELobbyType
Type
If IsTypeSet is true this will return the type of lobby this is set as.
Else this will return Private as a default but is not accurate.
Note Steam gives no way to accuratly read lobby type so we depend on the Heathen system setting the Type value.
The owner of the lobby can use this to set a new type value changing the lobby type and updating the Type field.
string
GameVersion
Gets or sets (owner only) the game version this lobby's owner is running on
bool
IsOwner
True if the local user is the owner of the lobby
bool
HasServer
true if the lobby has game server data set
LobbyGameServer
GameServer
The current set game server data
bool
AllPlayersReady
true if all players have indicated they are ready to play
bool
AllPlayersNotReady
true if all players have indicated they are not ready to play e.g. all are false
bool
IsReady
read and sets the local user's IsReady status
bool
Full
Is the lobby full e.g. max slots used
int
MaxMembers
gets the max member count and can be used by the owner to change the max member count
string
[string key]
indexer you can use this to access metadata e.g. set or read metadata.
Only the owner can set metadata

Methods

this[string key]

1
public string this[string key]
2
3
// Example
4
lobby["name"] = "New name";
5
// and
6
var name = lobby["name"];
Copied!
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

1
public bool SetType(type);
Copied!
Funcitonally the same as setting the Type field, this only works for the owner of the lobby

Set Joinable

1
public bool SetJoinable(bool makeJoinable);
Copied!
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

1
Dictionary<string, string> GetMetadata();
Copied!
Returns all the metadata for the lobby as a string dictionary. This creates the dictionary each time it is called so cashe the value before use or read the values directly from the lobby such as via the indexer.

Leave

1
public void Leave();
Copied!
Leaves the lobby, if the owner leaves Steam will assigne a new owner.

Delete Lobby Data

1
public bool DeleteLobbyData(string key);
Copied!
Removes the indicated metadata entry if present, can only be used by the owner of the lobby

Invite User to Lobby

1
public bool InviteUserToLobby(UserData user);
Copied!
Invites the indiated user to the lobby

Send Chat Message

1
public bool SendChatMessage(string message);
Copied!
1
public bool SendChatMessage(byte[] data);
Copied!
Sends a message over the Lobby chat system. See the Lobby Chat Director for more information.

Set Game Server

1
public void SetGameServer(string address, ushort port, CSteamID id);
Copied!
1
public void SetGameServer(string address, ushort port);
Copied!
1
public void SetGameServer(CSteamID id);
Copied!
Sets the Game Server information and causes the EventLobbyGameServer event to be raised on the Matchmaking interface and on any attached Lobby Manager componenets.

Kick Member

1
public bool KickMember(CSteamID memberId);
Copied!
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

1
public bool KickListContains(CSteamID memberID);
Copied!
Does the kick list contain the members ID;

Remove from Kick List

1
public bool RemoveFromKickList(CSteamID memberID);
Copied!
Removes a member from the kick list if present

Clear Kick List

1
public bool ClearKickList();
Copied!
Clears the kick list

Get Kick List

1
public CSteamID[] GetKickList();
Copied!
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

1
public void SetMemberMetadata(string key, string value);
Copied!
Set metadata on the local user's LobbyMember

Get Member Metadata

1
public string GetMemberMetadata(string key);
Copied!
Gets the metadata field from the local user's LobbyMember
1
public string GetMemberMetadata(CSteamID memberId, string key);
Copied!
1
public string GetMemberMetadata(LobbyMember member, string key);
Copied!
Gets the metadata field for the indiacated user