Unity Lobby Tools

Here we outline some of the component scripts and prefabs available in the Toolkit for Steamworks SDK (Unity) version.

Lobby Data

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.

using Heathen.SteamworksIntegraiton;

You can convert a Lobby to a ulong or CSteamID, or convert a ulong or CSteamID to a Lobby implicitly e.g.

LobbyData myLobby = new CSteamID(ulongId);
// or
ulong id = myLobby;
// or
CSteamID id = myLobby;

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.

Fields and Attributes

Account ID

public readonly AccountID_t AccountId = get;

Returns the native AccountID_t struct for this lobby; this is read-only.


All Players Not Ready

public readonly bool AllPlayersNotReady => get;

True if any player in the lobby is not marked as ready.


All Players Ready

public readonly bool AllPlayersReady => get;

True if all players in the lobby are marked as ready.


Friend ID

public readonly uint FriendId => get;

Primitive value of the Account ID.


Full

public readonly bool Full => get;

Returns true if this lobby is full.


Game Server

public readonly LobbyGameServer GameServer => get;

Lobby Game Server structure provides detailed information about the connection info, if any, on the lobby, including the ID of the Host or Server and the IP:Port if set.


Game Version

public readonly string GameVersion { get; set; }

Gets or sets the game version string on this lobby. This can only be set by the owner of the lobby, but can be read by any member of the lobby or searched for by using key=z_heathenGameVersion


Has Server

public readonly bool HasServer => get;

True if the lobby has a Game Server value set.


Hex ID

public readonly string HexId => get;

Gets the Hex ID of the lobby; this is a much more human-friendly value to ask a user to type if you are doing that.


Is Group

public readonly bool IsGroup { get; set; }

True if this lobby is a group, this can be set by the owner only and will change the lobby type to Invisible if set to true.


Is Owner

public readonly bool IsOwner => get;

True if the local user is the owner of this lobby.


Is Ready

public readonly bool IsReady { get; set; }

Returns the local user's ready state and can be set by the local user to update their ready state.


Is Session

public readonly bool IsSession { get; set; }

True if this lobby is flagged as a session lobby; this can only be set by the owner of the lobby.


Is Type Set

public readonly bool IsTypeSet => get;

True if the lobby type has been recorded in the metadata, else false.


Is Valid

public readonly bool IsValid => get;

True if this LobbyData points to a valid lobby CSteamID, this only indicates the value is structurally valid, it doesn't indicate whether or not this lobby exists or is in use.


Max Members

public readonly int MaxMembers { get; set; }

The maximum number of members this lobby can take, this can be set by the owner of the lobby.


Me

public readonly LobbyMemberData Me => get;

The member data for this user.


Member Count

public readonly int MemberCount => get;

The number of members in this lobby.


Members

public readonly LobbyMemberData[] Members => get;

The collection of all members of this lobby, including the owner of the lobby.


Name

public readonly string Name { get; set; }

Get or set the lobby name.


Owner

public readonly LobbyMemberData Owner { get; set; }

The owner of this lobby, the current owner can set this to another member's value to change who the owner is.


Steam ID

public readonly CSteamID SteamId => get;

Gets the native CSteamID of this lobby.


this[string metadataKey]

public readonly string this[string metadataKey] { get; set; }

It can be used to read metadata from the lobby, and can be used by the owner to set metadata on the lobby.


this[UserData user]

public readonly LobbyMemberData this[UserData user] => get;

Get the LobbyMemberData of a user, assuming they are a member of the lobby.


Type

public readonly ELobbyType Type { get; set; }

Read the type of lobby this is, the owner can set this to change the type.


Funcitons

Authenticate

public readonly void Authenticate(Action<AuthenticationTicket, bool> callback)
// Or
public readonly bool Authenticate(LobbyAuthenticationData data)

Sends a chat message to the lobby with authentication data that can be used by the owner of the lobby to validate this user and optionally serialized inventory. Two overloads are available; you can either create your own LobbyAuthenticationData object and pass that in, or you can provide a callback to be invoked on completion, and the system will create a default LobbyAuthenticaitonData for you and send that, invoking the callback once that process has been completed.

Callback example

void Callback(AuthenticationTicket ticket, bool ioError)
{
    // ioError true if an error occurred on send
    // ticket the ticket that was sent, if no error
}

Clear Kick List

public readonly bool ClearKickList()

Clears the kick list


Create

public static void Create(CreateArguments createArguments, Action<EResult, LobbyData, bool> callback)
// or
public static void Create(ELobbyType type, int slots, Action<EResult, LobbyData, bool> callback)
// or 
public static void CreateParty(int slots, Action<EResult, LobbyData, bool> callback)
// or 
public static void CreateSession(ELobbyType type, int slots, Action<EResult, LobbyData, bool> callback)
// or
public static void CreatePublicSession(int slots, Action<EResult, LobbyData, bool> callback)
// or
public static void CreatePrivateSession(int slots, Action<EResult, LobbyData, bool> callback)
// or
public static void CreateFriendOnlySession(int slots, Action<EResult, LobbyData, bool> callback)

Creates a new lobby, multiple overloads act as a shortcut for more or less details, the "native" or general use would be (type, slots, callback). In all cases the callback has the same form.

void Callback(EResult Result, LobbyData Lobby, bool IOError)
{
    
}

Delete Lobby Data

public readonly bool DeleteLobbyData(string dataKey)

Removes a key from the lobby metadata.


Get

public static LobbyData Get(string accountId)
// or
public static LobbyData Get(uint accountId)
// or
public static LobbyData Get(AccountID_t accountId)
// or
public static LobbyData Get(ulong id)
// or
public static LobbyData Get(CSteamID id)

Get a LobbyData based on the provided input.


Get Kick List

public readonly UserData[] GetKickList()

Gets the list of users that are recorded in the lobby kick list.


Get Member

public readonly bool GetMember(UserData user, out LobbyMemberData member)

Get the LobbyMember object for a given user. Returns true if the user is a member of the lobby, false if they are not.


Get Member Metadata

public readonly string GetMemberMetadata(LobbyMemberData member, string key)
// or
public readonly string GetMemberMetadata(string key)
// or
public readonly string GetMemberMetadata(UserData memberId, string key)

Reads the metadata of a given user from the lobby. If no member is indicated it will assume the local user.


Get Metadata

public readonly Dictionary<string, string> GetMetadata()

Gets a dictionary containing all the lobby's metadata.


Group Lobby

public static bool GroupLobby(out LobbyData lobby)

Returns the first lobby the user is a member of where lobby.IsGroup was set to true


Invite User to Lobby

public readonly bool InviteUserToLobby(UserData targetUser)

Invite the indicated user to the lobby


Is a Member

public readonly bool IsAMember(UserData id)

Checks if a user is a member of this lobby.


Join

public readonly void Join(AccountID_t accountId, Action<LobbyEnter, bool> callback)
// or
public readonly void Join(Action<LobbyEnter, bool> callback)
// or
public static void Join(LobbyData lobby, Action<LobbyEnter, bool> callback)
// or
public static void Join(string accountId, Action<LobbyEnter, bool> callback)

Joins the indicated lobby; in all cases, the callback has the same form.

void Callback(LobbyEnter Data, bool IOError)
{
    // Data.Lobby is the lobby you joined
    // Data.Response is the chat room response when you joined
    // Data.Locked if this lobby is locked
}

Kick List Contains

public readonly bool KickListContains(UserData memberId)

Check if the indicated user is contained in the list of members who should leave the lobby


Kick Member

public readonly bool KickMember(UserData memberId)

Marks the user to be removed.


Leave

public readonly void Leave()

Leaves the current lobby if any.


Quick Match

public static void QuickMatch(SearchArguments searchArguments, CreateArguments createArguments, Action<EResult, LobbyData, bool> callback)

Using the Search Arguments, it will search for a matching lobby. If one is found, it will join it; if not, and if the createOnFail parameter is true, it will create a lobby according to the Create Arguments.


Remove from Kick List

public readonly bool RemoveFromKickList(UserData memberId)

Removes the indicated member from the kick list


Request

public static void Request(ELobbyDistanceFilter distanceFilter, int openSlotsRequired, int maxResultsToReturn, IEnumerable<StringFilter> stringFilters, IEnumerable<NearFilter> nearFilters, IEnumerable<NumericFilter> numericFilters, Action<LobbyData[], bool> callback)
// or 
public static void Request(SearchArguments searchArguments, int maxResultsToReturn, Action<LobbyData[], bool> callback)

Request a list of lobbies that match the input filters.


Request Data

public readonly bool RequestData()

Refreshes all of the metadata for a lobby that you're not in right now. You will never do this for lobbies you're a member of, that data will always be up to date. You can use this to refresh lobbies that you have obtained from RequestLobbyList or that are available via friends.


Send Chat Message

public bool SendChatMessage(string message)
// or
public bool SendChatMessage(byte[] data)
// or 
public bool SendChatMessage(object jsonObject)

Send a Steam Lobby Chat message to the lobby. You can send a string, a byte[] of binary data or you can provide a JSON Serializable object and we will serialize that and send it as an object.


Session Lobby

public static bool SessionLobby(out LobbyData lobby)

Returns the first lobby where lobby.IsSession was set to true.


Set Game Server

public readonly void SetGameServer()
// or
public readonly void SetGameServer(CSteamID gameServerId)
// or
public readonly void SetGameServer(string address, ushort port, CSteamID gameServerId)
// or 
public readonly void SetGameServer(string address, ushort port)

Sets the game server associated with the lobby. You can indicate a Steam ID and or an IP:Port. If you do not provide any parameters, it will assume the owner of the Lobby is the server, e.g. is the Host.


Set Joinable

public readonly bool SetJoinable(bool makeJoinable)

Mark the lobby as joinable or not.


Set Member Metadata

public readonly void SetMemberMetadata(string key, string value)

Set the metadata for the player on the lobby.


Set Type

public readonly bool SetType(ELobbyType type)

Updates the lobby type, can only be called by the owner of the lobby.


Lobby Manager

This tool simply exposes features present in LobbyData and the Matchmaking API to the inspector.

This is not required to use these features, it is simply a helper tool allowing users who are more comfortable working with editor inspectors and game objects rather than classic C# objects and scripting to make use of the related feature.

A tool for creating and managing a specific lobby. This component is meant to be attached to a game object in your matchmaking scene / ui. Your game may have multiple Lobby Managers where each manages a single specific lobby.

Events

You can add events via the Add New Event Type button, like Unity's Event Trigger component. The names listed are slightly different from the names as they appear in code to help clarify the use of each when IntelliSense is not available as it is in code.

Authentication Session Results

Only occurs on the owner of the lobby when an authentication request is received and BeginSession responds with the results of the authentication attempt.

void Handler(AuthenticationSession Session, byte[] Inventory)
{
    // Session contains details about the auth session started
    // If any this will be the serialized inventory passed in with the ticket
}

Lobby Chat Message Received

Occurs on all lobby members when a chat message is received from the lobby.

void Handler(LobbyChatMsg Message)
{
    // Message contains the user, time, string and byte[] if any sent
}

Lobby Creation Failed

Occurs when a Create request fails.

void Handler(EResult Result)
{
    // Result is the error code for the failure
}

Lobby Creation Success

Occurs when a Create request is successful.

void Handler(LobbyData Lobby)
{
    // Lobby is the lobby that was created
}

Lobby Invite Received

Occurs when a lobby invite was received.

void Handler(LobbyInvite Invite)
{
    // Invite contains the user its from and the lobby and game it is for
}

Lobby Join Failure

Occurs when a request to join a lobby fails.

void Handler(EChatRoomEnterResponse Response)
{
}

Lobby Join Success

Occurs when a request to join a lobby is successful.

void Handler(LobbyData Lobby)
{
    // Lobby is the lobby that was joined
}

Metadata Updated

Occurs when data on the lobby or a member is updated.

void Handler(LobbyDataUpdateEventData Data)
{
    // Data.lobby will always have a value and be the lobby that was updated
    // Data.member can be null, if it is null, then the data was lobby metadata
    // If it is not null then the data was member metadata.
    // Steam doesn't tell us what field, just on what object.
}

Other User Left

Occurs when a user leaves a lobby that you are in.

void Handler(UserLobbyLeaveData Data)
{
    // Data.user is who left
    // Data.state can indicate how or why
}

Other User Joined

Occurs when a user joins the lobby that you are in.

void Handler(UserData User)
{
    // User is who joined
}

Quick Match Failed

Occurs when quick match fails to find a lobby to match to.

void Handler()
{
    // No parameters are passed
}

Search Result Ready

Occurs when a search completes and results are ready.

void Handler(LobbyData[] Results)
{
    // Results is the array of lobbies found as LobbyData structs
}

Session Connection Updated

Occurs when connection information has been updated in the lobby

void Handler(LobbyGameServer GameServer)
{
    // GameServer.id is the CSteamID of the Listen (P2P) or Dedicated server, if any
    // GameServer.IpAddress is the 0.0.0.0 IP address as a string, if any
    // GameServer.ipAddress is the IP address as a uint32, if any
    // GameServer.port is the port, if any
}

You Are Asked to Leave

Occurs when you have been "kicked" from the lobby, and you should then leave the lobby.

void Handler()
{
    // No parameters are passed
}

Fields and Attributes

Search Arguments

public SearchArguments searchArguments;

The SearchArguments data type is an internal class:

[Serializable]
public class SearchArguments
{
    /// <summary>
    /// If less than or equal to 0, then we won't use the open slot filter
    /// </summary>
    public int slots = -1;
    public ELobbyDistanceFilter distance = ELobbyDistanceFilter.k_ELobbyDistanceFilterDefault;
    public List<NearFilter> nearValues = new List<NearFilter>();
    public List<NumericFilter> numericFilters = new List<NumericFilter>();
    public List<StringFilter> stringFilters = new List<StringFilter>();
}

The fields of the class are as follows

  • slots If less than or equal to 0, this will be ignored; otherwise, this will indicate the number of available slots resulting lobbies must have. For example, if you wanted to find a lobby for you and 3 friends, then you would provide a value of 4 in this field to return only lobbies that had 4 open slots.

    • Close Only in the same Valve region as this user

    • Default In the same or nearby Valve region as this user

    • Far Up to half a world away

    • World Wide No filtering at all

  • numericFilters Instructs the search to perform a numeric filtering operation on these fields, and can filter by the following methods

    • Equal to or Less than

    • Less than

    • Equal

    • Greater than

    • Equal to or Greater than

    • Not Equal

  • stringFilter Instructs the search to perform a string filtering operation on these fields and can be filtered by the same methods as numeric filters. Valve doesn't explain what the result of each is so test to confirm the desired results.


Create Arguments

public CreateArguments createArguments;

The CreateArguments data type is an internal class:

[Serializable]
public class CreateArguments
{
    public UseHintOptions usageHint;
    public string name;
    public int slots;
    public ELobbyType type;
    public List<MetadataTempalate> metadata = new List<MetadataTempalate>();
}

The fields of the class are as follows

  • usageHint This simply indicates what the intended use is for the lobbies created by this instance of the lobby manager. If set to a value other than "None" it will cause the Lobby Manager, on the creation of a new lobby, to set that lobby as either Group or Session, depending on the value you set here.

  • name This will be set as metadata on the lobby when created e.g. MyLobby["name"] = value;

  • slots This is the maximum number of slots this lobby will have ... this includes the owner of the lobby.

  • metadata Metadata fields to be set on the lobby once created. This is a simple string key and string value pairing. Metadata is what is used when "filtering" or "searching" for lobbies.


Lobby

public LobbyData Lobby { get; set; }

The lobby the manager is currently managing. This will automatically be updated when you use the lobby manager to create, join or leave a lobby. If you create, join or leave a lobby from outside the manager, then you should update this field accordingly.


Has Lobby

public bool HasLobby => get;

True if the manager is managing a lobby, false otherwise.


Is Player Owner

public bool IsPlayerOwner => get;

True if the local user is the owner of the managed lobby, false otherwise.


All Players Ready

public bool AllPlayersReady => get;

True if all members of the lobby have marked themselves as ready, otherwise false.


Is Player Ready

public bool IsPlayerReady { get; set; }

Returns true if the player has marked them self as ready on this lobby. This can be set to mark the player as ready or not on this lobby.


Full

public bool Full => get;

Returns true if the lobby is currently full, false otherwise.


Is Type Set

public bool IsTypeSet => get;

Returns true if the lobby type has been recorded on the lobby metadata, false otherwise.


Type

public ELobbyType Type { get; set; }

Returns the type of lobby this lobby is set to, this is a feature of Heahten's Lobby tools. Valve does not actually expose this, so this will only work for lobbies created by Heathen's tools, such as the lobby manager or the API.Matchmaking class. This can only be set by the owner of the lobby.


Max Members

public int MaxMembers { get; set; }

Indicates the maximum number of members that can be in the lobby. This can be set by the owner of the lobby to change the max slots.


Has Server

public bool HasServer => get;

Returns true if the lobby has had its game server set, false otherwise.


Game Server

public LobbyGameServer GameServer => get;

Returns data about the game server set in the lobby, if any.


Funcitons

Authenticate

public void Authenticate(Action<AuthenticationTicket, bool> callback)
// Or
public bool Authenticate(LobbyAuthenticationData data)

Sends a chat message to the lobby with authentication data that can be used by the owner of the lobby to validate this user and optionally serialized inventory. Two overloads are available; you can either create your own LobbyAuthenticationData object and pass that in, or you can provide a callback to be invoked on completion, and the system will create a default LobbyAuthenticaitonData for you and send that, invoking the callback once that process has been completed.

Callback example

void Callback(AuthenticationTicket ticket, bool ioError)
{
    // ioError true if an error occurred on send
    // ticket the ticket that was sent, if no error
}

Create

public void Create()
// or
public void Create(string name, ELobbyType type, int slots, params MetadataTemplate[] metadata)
// or
public void Create(ELobbyType type, int slots, params MetadataTemplate[] metadata)
// or
public void Create(Action<EResult, LobbyData, bool> callback)
void Callback(EResult resultCode, LobbyData lobby, bool ioError)
{
    // resultCode is the status of the request, generally should be "OK"
    // lobby is the lobby that was created
    // ioError if true, then there was a failure requesting the lobby creation
}

Get Lobby Data

public string GetLobbyData(string key)

Get metadata from the lobby itself.


Get Lobby Member

public LobbyMemberData GetLobbyMember(UserData member)

Create a Lobby Member Data object for the indicated user.


Get Member Data

public string GetMemberData(UserData member, string key)

Gets the metadata of a given user; the user must be a member of this lobby.


Invite

public void Invite(UserData user)
// or
public void Invite(uint FriendId)

Invites the indicated user to the lobby.


Is Member Ready

public bool IsMemberReady(UserData member)

Checks if the indicated member is flagged as "ready"


Join

public void Join(LobbyData lobby)
// or
public void Join(ulong lobby)
// or
public void Join(string lobbyIdAsString)

Joins the indicated lobby, which will leave the current lobby, if any.


Kick Member

public void KickMember(UserData member)

Add the member's ID to the Kick Member list, You must then handle the Asked to Leave event and leave the lobby if you want this to work. It is less a "kick" and more of an ask to leave nicely.


Leave

public void Leave()

Leave the lobby.


Quick Match

public void QuickMatch(bool createOnFail = true)

public void Search(int maxResults)

Send Chat Message

public bool SendChatMessage(string message)
// or
public bool SendChatMessage(byte[] data)
// or 
public bool SendChatMessage(object jsonObject)

Send a Steam Lobby Chat message to the lobby. You can send a string, a byte[] of binary data or you can provide a JSON Serializable object, and we will serialize that and send it as an object.


Set Joinable

public bool SetJoinable(bool makeJoinable)

Set the lobby as joinable or not, this can only be called by the lobby owner.


Set Lobby Data

public bool SetLobbyData(string key, string value)

Set metadata on the lobby, only the lobby owner can do this.


Set Member Data

public void SetMemberData(string key, string value)

Set metadata on the local user, you can only set data on yourself self not other members.


public bool SetType(ELobbyType type)

Change the type of lobby for the lobby being managed. This can only be done by the lobby owner.

Quick Match Lobby Control

Create a session lobby and manage a quick match style UI with zero code required.

Quick match-based lobbies are the simplest and cleanest user experience for your player in common game design. They present very little to no real UI elements concerned with the "lobby" rather the user or system defines the search arguments and searches for or creates a new session to match players with. This approach requires the least amount of input from players, typically reducing match wait times by using more flexible search parameters when needed.

DOTA 2 Example

Screen captures of the DOTA 2 "Play DOTA" option are a true example of Steam Lobby used for Quick Match matchmaking. The player hits one button, optionally selects preferences like ranked vs unranked and the system does the rest based on the player's stats, whether or not they are in a party, geo location, rankings, etc.

Halo Infinite Example

Screen captures of Halo Infinite's "Quick Play" option are a prime example of a Quick Match Lobby setup. The player hits one button and the system will find an appropriate match based on the player's stats, whether or not they are in a party, geo-location, rankings, etc.

Features

Authentication

Automatically checks the VAC and auth status of connecting users, asking users to leave if they fail the checks you have configured.

Simple Quick Match

Search for a match and join, if none is found, create a match and wait. Quick match is one of the best options for a quality user experience in most session-based multiplayer games. The Quick Match Lobby Control's main function is this: your user, with a single push of a button, will be placed in a match with any party they may have as quickly as possible, with as little input required as possible.

Event Driven

Optional Unity Events are available in the editor and in code to help you drive additional UI and game logic based on Quick Match status changes.

Working Status

A simple `Status` enum is available for use cases where event-driven is not desired or possible. You can test the `WorkingStatus` of the control to see when it's idle, searching, waiting or starting.

Easy Access

Easily access critical information about your Quick Match session for simple and efficient integration with any networking HLAPI you would like. Quickly access the lobby, owner, the local user's member and much more.

Prefab

A production-ready prefab is available and configured with the features displayed above.

Events

Evt Process Started

public UnityEvent evtProcessStarted;

This event is invoked when the system starts the process of quick matching and can be used to trigger other game logic that should happen when the process starts.


Evt Process Stopped

public UnityEvent evtProcessStopped;

This event is invoked when the system stops the process of quick matching, such as from a cancel and can be used to trigger other game logic that should happen when the process stops.


Evt Lobby Full

public LobbyDataEvent evtLobbyFull;

This event is invoked when the lobby becomes full, e.g. all available slots are populated with users. This is usually used to start whatever your networking API requires to start a network session.


Evt Game Created

public GameServerSetEvent evtGameCreated;

This event is invoked when the owner calls Lobby.SetGameServer() or uses the SetGameServer methods on the Quick Match Lobby Controller. This indicates to all members that the network session is ready for them to connect to it.


Evt Enter Success

public LobbyDataEvent evtEnterSuccess;

This event is invoked when the user joins or creates a lobby, e.g. lets you know the local user is now in a session lobby.


Evt Enter Failed

public LobbyResponceEvent evtEnterFailed;

This event is invoked when the user attempts to join an existing lobby, but for some reason, it fails. The event parameter will indicate what went wrong.


Evt Created Failed

public EResultEvent evtCreatedFailed;

This event is invoked when the user attempts to create a new lobby but for some reason it failed. The event parameter will indicate what went wrong.


Evt State Changed

public UnityEvent evtStateChanged;

This event is frequently invoked and will trigger when any data change happens such as user's coming and going, authentication failing, etc. This can be used to drive general game logic that simply needs to know when to check the system for a change.


Fields and Attributes

Idle Group

public GameObject indelGroup;

This game object is enabled when the system is **NOT** processing. This is useful to place a "Play Button" or similar elements in that you want to be "turned off" when the system starts processing. You can similarly use the `Evt Process Started` event to control your UI


Processing Group

public GameObject processingGroup;

This game object is enabled when the system **IS** processing. This is useful for placing a "status message" object that should be displayed when the system is working.


Update Rich Presence Group Data

public bool updateRichPresenceGroupData;

Indicates whether or not the system could update the player's `steam_player_group` and `steam_player_group_size` rich presence data.


Kick When

public EAuthSessionResponce[] kickWhen;

A collection of authentication response codes that, if seen on authentication, the user should be asked to leave.


SearchArguments

public SearchArguments searchArguments;

Used with any form of search performed through the Lobby Manager, including the Search and QuickMatch methods. This is used to define the "search arguments" e.g. the rules to be tested when searching for lobbies.

The SearchArguments Data type is an internal class:

[Serializable]
public class SearchArguments
{
    /// <summary>
    /// If less than or equal to 0, then we won't use the open slot filter
    /// </summary>
    public int slots = -1;
    public ELobbyDistanceFilter distance = ELobbyDistanceFilter.k_ELobbyDistanceFilterDefault;
    public List<NearFilter> nearValues = new List<NearFilter>();
    public List<NumericFilter> numericFilters = new List<NumericFilter>();
    public List<StringFilter> stringFilters = new List<StringFilter>();
}

The fields of the class are as follows

  • If less than or equal to 0, this will be ignored; otherwise, this will indicate the number of available slots that the resulting lobbies must have. For example, if you wanted to find a lobby for you and 3 friends, then you would provide a value of 4 in this field to return only lobbies that had 4 open slots.

    • Close only in the same Valve region as this user

    • Default: In the same or nearby Valve region as this user

    • Far up to half a world away

    • World Wide No filtering at all

  • numericFilters instructs the search to perform a numeric filtering operation on these fields and can filter by the following methods

    • Equal to or Less than

    • Less than

    • Equal

    • Greater than

    • Equal to or Greater than

    • Not Equal

  • stringFilter Instructs the search to perform a string filtering operation on these fields which can be filtered by the same methods as numeric filters. Valve doesn't explain what the result of each is, so test to confirm the desired results.


CreateArguments

public CreateArguments createArguments;

The CreateArguments Data type is an internal class:

[Serializable]
public class CreateArguments
{
    public string name;
    public int slots;
    public ELobbyType type;
    public List<MetadataTempalate> metadata = new List<MetadataTempalate>();
}

The fields of the class are as follows

  • name This will be set as metadata on the lobby when created, e.g. MyLobby["name"] = value;

  • slots This is the maximum number of slots this lobby will have ... this includes the owner of the lobby.

  • metadata Metadata fields are to be set on the lobby once created. This is a simple string key and string value pairing. Metadata is what is used when "filtering" or "searching" for lobbies.


Lobby

public Lobby Lobby { get; set; }

The lobby the manager is currently managing. This will automatically be updated when you use the lobby manager to create, join or leave a lobby. If you create, join or leave a lobby from outside the manager, then you should update this field accordingly.


Owner

public LobbyMember Owner => get;

Gets the Lobby Member data for the current lobby owner.


Me

public LobbyMember Me => get;

Gets the local user's Lobby Member data for the current lobby.


HasLobby

public bool HasLobby => get;

True if the manager is managing a lobby, false otherwise.


Searching

public bool Searching => get;

True if the system is searching for a match at the moment.


IsPlayerOwner

public bool IsPlayerOwner => get;

True if the local user is the owner of the managed lobby, false otherwise.


AllPlayersReady

public bool AllPlayersReady => get;

True if all members of the lobby have marked themselves as ready, otherwise false.


IsPlayerReady

public bool IsPlayerReady { get; set; }

Returns true if the player has marked themselves as ready on this lobby. This can be set to mark the player as ready or not in this lobby.


Full

public bool Full => get;

Returns true if the lobby is currently full, false otherwise.


Slots

public int Slot => get;

How many people can join this lobby, if any lobby at all


Member Count

public int MemberCount => get;

How many people are currently in this lobby, if any lobby at all


Game Server

public LobbyGameServer GameServer => get;

The current game server is set by the owner of the lobby, if any


Working Status

public Status WorkingStatus => get;

The current status of the system

  • Idle Not processing

  • Searching If currently searching for a match

  • Waiting For Start A match was found, but the lobby was not full, and the session had not started

  • Starting Match found and the lobby is now full ... the owner should be starting up the network session


Timer

public float Timer => get;

The amount of time since the process started.


Methods

Cancel

public void Cancel();

Stops the process of searching and, if in a lobby, exits the lobby


Run Quick Match

public void RunQuickMatch();

Starts the process of searching for and or creating a session lobby as required.


Set Game Server

public void SetGameServer();
public void SetGameServer(string address, ushort port, CSteamID gameServerId);
public void SetGameServer(string address, ushort port);
public void SetGameServer(CSteamID gameServerId;

This can only be called by the owner of the lobby and should be called when the network session is ready for the members to connect to it.

If no parameter is passed in

SetGameServer();

The system will assume that the owner of the lobby is the server, e.g. a P2P session where the lobby owner is the "Host"

All other overloads require you to indicate what the connection information is for the session.


Party Lobby Control

Create a party lobby and its UI fully featured, including in-game friend invite, chat, and more, with zero code required.

The Party Lobby Control is a UI behaviour component that manages a lobby representing a player's party and the UI elements associated with that. This sort of "Party UI" is common in most team and coop games such as MOBAs, Team Shooters, party games and more. One of the most typical examples of a party lobby can seen in DOTA2.

The purpose of a "party lobby" also known as a "group lobby" is to gather Friends who wish to play together, most typically in a coop game, though you do see Group/Party systems in competitive games as well, particularly party games.

Party or group-type lobbies differ from session-type lobbies in that they only group a set of friends. They do not attempt to matchmake or define the state of a "session".

In this case let "session" refer to a session of gameplay, e.g. a match, mission, race, level, etc.

Session lobbies in contrast, are not typically concerned with friends so much as they are with meaningful matchmaking, e.g. placing players of similar skill, nearby regions and similar game session preferences together to facilitate a timely and entertaining "session". The members in a "Party" would typically join the same "Session" lobby when looking to play a game.

For example, in DOTA 2 up to 5 players can form a group/party, this is a full "team" in DOTA. When the party leader presses the "Play DOTA" button the game performs a quick match looking for a "Session" that can accommodate the party of players. When the session starts the party of players will be placed on the same team.


Features

Create

Automatically handles the creation and exit of a group lobby. You can always fetch the current group lobby from the Lobby structure.

if(Lobby.GroupLobby(out Lobby groupLobby)
{
    //We are in a group lobby
    if(groupLobby.MemberCount > 1)
    {
        //We are not alone at the party
    }
}

Display

Display the user's avatar and the number of slots available to the party/group. When a slot is "filled" that user's avatar will be displayed.

Friend Invite

Chat

When a user is in a party with other player's a simple text-based chat interface is displayed. The chat system is used by other tools to notify party members when they should join a specific session lobby. Heathen's session lobby controls will handle this automatically, or you can do this yourself by prefixing the chat message with `[SessionId]` followed by the ulong id of the session lobby to join


Rich Presence

Optionally sets the `steam_player_group` and `steam_player_group_size` fields in Steam's rich presence, updating the Friend List group display.


Prefab

A production-ready prefab is available and configured with the features displayed above.


Events

Session Lobby Invite

public LobbyDataEvent evtSessionLobbyInvite;

This event is invoked when the user is invited to join a session lobby by the owner of the group lobby. For example, if you are in a party with user A and user A uses Heathen's Quick Match to create or join a session, you will be invited to join that session, and this event will be raised.


Group Lobby Invite

public GameLobbyJoinRequestedEvent evtGroupLobbyInvite;

This event is invoked when the user is invited and accepts a lobby invite to a group lobby.


Fields and Attributes

User Owner Pip

public GameObject userOwnerPip;

A reference to the GameObject that should be toggled on or off to indicate whether the local user is the owner of the party/group lobby or not.


Ready Button

public Button readyButton;

Optional, if null, this feature will be ignored

A reference to the button the user will click to indicate they are ready to play. This is used to update metadata on the lobby and display a "ready" flag on the UI.


Not Ready Button

public Button notReadyButton;

Optional, if null, this feature will be ignored

A reference to the button the user will click to indicate they are not ready to play. This is used to update metadata on the lobby and clear the display of the "ready" flag on the UI.


Leave Button

public Button leaveButton;

A reference to the button the user will click when they want to leave the group/party.


Auto Join On Invite

public bool autoJoinOnInvite;

If toggled to true, then when a GameLobbyJoinRequest event is detected, if the target lobby is of type group, the tool will leave any existing group lobby and join this new lobby.

This is not generally recommended, as you should be validating the game state and lobby state before blindly joining, but it can be useful for quick testing.


Invite Panel

public RectTransfrom invitePanel;

A reference to the root GameObject representing the "invite panel". This will be toggled on if an empty slot is clicked, and toggled off if the control is "clicked off of"


Invite Dropdown

public FriendInviteDropDown inviteDropdown;

Slots

public LobbyMemberSlot[] slots;

Update Rich Presence Group Data

public bool updateRichPResenceGroupData;

If true, then the `steam_player_group` and `steam_player_group_size` rich presence fields will be set based on the current state of this lobby. This is used to group friends in the friends list in the Steam client.


Max Messages

public int maxMessages;

The number of message entries to keep in the chat history. The system will delete the oldest chat message from the chat log when this number is exceeded.


Chat Panel

public GameObject chatPanel;

The root of the chat UI will be enabled when the lobby has 2 or more members, including the local user.


Input Field

public TMP_InputField inputField;

A reference to the TextMesh Pro input field to be used as the chat's input field.


Scroll View

public ScrollRect scrollView;

A reference to the scroll rect wrapping the chat message root. This is used to force the scroll to the bottom so the newest message received is always visible.


Message Root

public Transform messageRoot;

A reference to the transform which will be made the parent of each incoming chat message.


My Chat Template

public GameObject myChatTemplate;

A reference to the GameObject or Prefab that should be instantiated for each message received from the local user.


Their Chat Template

public GameObject theirChatTemplate;

A reference to the GameObject or Prefab that should be instantiated for each message received from users other than the local user.


Lobby

public Lobby Lobby { get; set; }

The lobby (if any) that is being managed by this control


Has Lobby

public bool HasLobby => get;

True if this control is currently managing a lobby


Is Player Owner

public bool IsPlayerOwner => get;

True if the local player is the owner of this lobby


All Players Ready

public bool AllPlayersReady => get;

True if all players in this lobby have indicated they are ready to play


Is Player Ready

public bool IsPlayerReady { get; set; }

Indicates rather or not the local player has been set as ready. This can be read or written to, writing to this field will update the LobbyMetadata of the local user for this lobby.


Last updated