Matchmaking.Client
Unity centric wrapper around the ISteamMatchmaking API
Last updated
Unity centric wrapper around the ISteamMatchmaking API
Last updated
Support us as a 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 ... become a sponsor today!
The whole of the matchmaking system is only accessible from the Client API as a result you will always be using the form:
The matchmaking system is fundamentally a system for getting player's together in order to play games. The main feature of the system is the Steam Lobby. Steam Lobbies can be searched for based on the metadata of a lobby, they can be advertised via Party Beacons, on the friends list and direct invites can be sent to targeted players.
Steam Lobby can be used for more than a simple game lobby, depending on your games specific needs they can provide for teams, party/groups, session merging and more. Valve allows a user to be a member of 1 "normal" lobby and up to 2 additional "invisible" lobbies. Each lobby has its own set of metadata for the lobby its self and for each of its members and each lobby includes a simple chat system.
Occurs when a lobby enter callback is received and the response code is a success
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
Occurs when a lobby enter callback is received and the response code is not a success.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
Occurs when the lobby metadata has changed.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
Occurs when a chat (text or binary) message for this lobby has been received. After getting this you must use GetLobbyChatEntry to retrieve the contents of this message.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
A server was added/removed from the favorites list, you should refresh now.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behviour using it is destroyed
A lobby chat room state has changed, this is usually sent when a user has joined or left the lobby.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
Someone has invited you to join a Lobby. Normally you don't need to do anything with this, as the Steam UI will also display a '<user> has invited you to the lobby, join?' notification and message.
If the user outside a game chooses to join, your game will be launched with the parameter +connect_lobby <64-bit lobby id>
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
Invoked when API.Matchmaking.Client.LeaveLobby is called
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
The local user has been asked to leave a lobby. In general you should handle this event and leave when asked assuming your game has implemented kick lobby.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behavior using it is destroyed
This list is populated by the system as the user creates, joins and leaves lobbies. It is a list of lobbies the user is currently a member of.
You can call this field via
Adds the game server to the local favorites list or updates the time played of the server if it already exists in the list.
Adds the game server to the local favorites list or updates the time played of the server if it already exists in the list.
Adds the game server to the local favorites list or updates the time played of the server if it already exists in the list.
Adds the game server to the local favorites list or updates the time played of the server if it already exists in the list.
Sets the physical distance for which we should search for lobbies, this is based on the users IP address and a IP location map on the Steam backed.
Filters to only return lobbies with the specified number of open slots available.
Sorts the results closest to the specified value.
Near filters don't actually filter out values, they just influence how the results are sorted. You can specify multiple near filters, with the first near filter influencing the most, and the last near filter influencing the least.
Adds a numerical comparison filter to the next RequestLobbyList call.
Sets the maximum number of lobbies to return. The lower the count the faster it is to download the lobby results & details to the client.
Adds a string comparison filter to the next RequestLobbyList call.
Removes a metadata key from the lobby.
Gets the details of the favorite game server by index.
Returns the collection of favorite game entries
Gets the number of favorite and recent game servers the user has stored locally.
Gets the metadata associated with the specified key from the specified lobby.
Gets the details of a game server set in a lobby.
The current user must be in the lobby to retrieve the Steam IDs of other users in that lobby.
Returns a list of user IDs for the members of the indicated lobby
The current limit on the # of users who can join the lobby.
Returns the current lobby owner.
Invite another user to the lobby.
Joins an existing lobby.
Leave a lobby that the user is currently in; this will take effect immediately on the client side, other users in the lobby will be notified by a LobbyChatUpdate_t callback.
Removes the game server from the local favorites list.
Removes the game server from the local history list.
Refreshes all of the metadata for a lobby that you're not in right now.
Get a filtered list of relevant lobbies.
There can only be one active lobby search at a time. The old request will be canceled if a new one is started. Depending on the users connection to the Steam back-end, this call can take from 300ms to 5 seconds to complete, and has a timeout of 20 seconds.
Broadcasts a chat (text or binary data) message to the all of the users in the lobby.
Sets a key/value pair in the lobby metadata. This can be used to set the the lobby name, current map, game mode, etc.
Sets the game server associated with the lobby.
Either the IP/Port or the Steam ID of the game server must be valid, depending on how you want the clients to be able to connect.
A LobbyGameCreated_t callback will be sent to all players in the lobby, usually at this point, the users will join the specified game server.
Sets whether or not a lobby is joinable by other players. This always defaults to enabled for a new lobby.
If joining is disabled, then no players can join, even if they are a friend or have been invited.
Gets per-user metadata from another player in the specified lobby.
Get the LobbyMember object for a given user
Checks if a user is a member of this lobby
Sets per-user metadata for the local user.
Each user in the lobby will be receive notification of the lobby data change via a LobbyDataUpdate_t callback, and any new users joining will receive any existing data.
Set the maximum number of players that can join the lobby.
Changes who the lobby owner is.
This can only be set by the owner of the lobby. This will trigger a LobbyDataUpdate_t for all of the users in the lobby, each user should update their local state to reflect the new owner. This is typically accomplished by displaying a crown icon next to the owners name.
Updates what type of lobby this is.
Cancel an outstanding server list request.
Cancel an outstanding individual server query.
Gets the number of servers in the given list.
Get the details of a given server in the list. or get all servers as an array
Checks if the server list request is currently refreshing.
Queries an individual game servers directly via IP/Port to request an updated ping time and other details from the server.
Queries an individual game servers directly via IP/Port to request the list of players currently playing on the server.
Ping every server in your list again but don't update the list of servers.
Refreshes a single server inside of a query.
Releases the asynchronous server list request object and cancels any pending query on it if there's a pending query in progress.
Request a new list of game servers from the 'favorites' server list.
Request a new list of game servers from the 'friends' server list.
Request a new list of game servers from the 'history' server list.
Request a new list of game servers from the 'internet' server list.
Request a new list of game servers from the 'LAN' server list.
Request a new list of game servers from the 'favorites' server list.
Queries an individual game servers directly via IP/Port to request the list of rules that the server is running. (See ISteamGameServer::SetKeyValue to set the rules on the server side.)
Leaves all lobbies the user is a member of if any
To join a lobby you need to know that lobby's ID and can simply call
Crete a new matcmaking lobby
This will create a new lobby of the type indicated, the local user will be automatically joined to the lobby and the callback will contains the Lobby reference of the lobby created in the result.
The Lobby Manager tool can help you create a lobby UI and simplify the various interactions with the lobby system. Alternatively you can search for a lobby manually.
To search manually you will call the various "Add Request" methods to build up your search parameters those include
Add Request Lobby List Distance Filter
Add Request Lobby List Filter Slots Available
Add Request Lobby List Near Value Filter
Add Request lobby List Numerical Filter
Add Request Lobby list result Count Filter
Add Request Lobby List String Filter
When you have built up the desired search parameters you will need to call
The callback will contain an array of the lobbies found.
The query parameters are cleared on each call to Request Lobby List
There is no way to remove parameters other than to request the lobby list and then start again from scratch.
TO invite a user to a lobby you only need to know which lobby you and which user you wish to perform the operation on
This sets the game server associated with the lobby. When its first set it will raise the Lobby Game Server set event for all members. That event will contain connection information or user's can read the connection information from the lobby via the GetLobbyGameServer
feature.
A game server has been set via for all of the members of the lobby to join. It's up to the individual clients to take action on this; the typical game behavior is to leave the lobby and connect to the specified game server; but the lobby may stay open throughout the session if desired.
Create a new lobby and set the max members allowed. The callback will report success or failure and the reason why via the value.