Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Static Public Member Functions | List of all members
Steamworks.SteamMatchmaking Class Reference

Static Public Member Functions

static int AddFavoriteGame (AppId_t nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags, uint rTime32LastPlayedOnServer)
 
static void AddRequestLobbyListCompatibleMembersFilter (CSteamID steamIDLobby)
 
static void AddRequestLobbyListDistanceFilter (ELobbyDistanceFilter eLobbyDistanceFilter)
 
static void AddRequestLobbyListFilterSlotsAvailable (int nSlotsAvailable)
 
static void AddRequestLobbyListNearValueFilter (string pchKeyToMatch, int nValueToBeCloseTo)
 
static void AddRequestLobbyListNumericalFilter (string pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType)
 
static void AddRequestLobbyListResultCountFilter (int cMaxResults)
 
static void AddRequestLobbyListStringFilter (string pchKeyToMatch, string pchValueToMatch, ELobbyComparison eComparisonType)
 
static SteamAPICall_t CreateLobby (ELobbyType eLobbyType, int cMaxMembers)
 
static bool DeleteLobbyData (CSteamID steamIDLobby, string pchKey)
 
static bool GetFavoriteGame (int iGame, out AppId_t pnAppID, out uint pnIP, out ushort pnConnPort, out ushort pnQueryPort, out uint punFlags, out uint pRTime32LastPlayedOnServer)
 
static int GetFavoriteGameCount ()
 
static CSteamID GetLobbyByIndex (int iLobby)
 
static int GetLobbyChatEntry (CSteamID steamIDLobby, int iChatID, out CSteamID pSteamIDUser, byte[] pvData, int cubData, out EChatEntryType peChatEntryType)
 
static string GetLobbyData (CSteamID steamIDLobby, string pchKey)
 
static bool GetLobbyDataByIndex (CSteamID steamIDLobby, int iLobbyData, out string pchKey, int cchKeyBufferSize, out string pchValue, int cchValueBufferSize)
 
static int GetLobbyDataCount (CSteamID steamIDLobby)
 
static bool GetLobbyGameServer (CSteamID steamIDLobby, out uint punGameServerIP, out ushort punGameServerPort, out CSteamID psteamIDGameServer)
 
static CSteamID GetLobbyMemberByIndex (CSteamID steamIDLobby, int iMember)
 
static string GetLobbyMemberData (CSteamID steamIDLobby, CSteamID steamIDUser, string pchKey)
 
static int GetLobbyMemberLimit (CSteamID steamIDLobby)
 
static CSteamID GetLobbyOwner (CSteamID steamIDLobby)
 
static int GetNumLobbyMembers (CSteamID steamIDLobby)
 
static bool InviteUserToLobby (CSteamID steamIDLobby, CSteamID steamIDInvitee)
 
static SteamAPICall_t JoinLobby (CSteamID steamIDLobby)
 
static void LeaveLobby (CSteamID steamIDLobby)
 
static bool RemoveFavoriteGame (AppId_t nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags)
 
static bool RequestLobbyData (CSteamID steamIDLobby)
 
static SteamAPICall_t RequestLobbyList ()
 
static bool SendLobbyChatMsg (CSteamID steamIDLobby, byte[] pvMsgBody, int cubMsgBody)
 
static bool SetLinkedLobby (CSteamID steamIDLobby, CSteamID steamIDLobbyDependent)
 
static bool SetLobbyData (CSteamID steamIDLobby, string pchKey, string pchValue)
 
static void SetLobbyGameServer (CSteamID steamIDLobby, uint unGameServerIP, ushort unGameServerPort, CSteamID steamIDGameServer)
 
static bool SetLobbyJoinable (CSteamID steamIDLobby, bool bLobbyJoinable)
 
static void SetLobbyMemberData (CSteamID steamIDLobby, string pchKey, string pchValue)
 
static bool SetLobbyMemberLimit (CSteamID steamIDLobby, int cMaxMembers)
 
static bool SetLobbyOwner (CSteamID steamIDLobby, CSteamID steamIDNewOwner)
 
static bool SetLobbyType (CSteamID steamIDLobby, ELobbyType eLobbyType)
 

Member Function Documentation

static int Steamworks.SteamMatchmaking.AddFavoriteGame ( AppId_t  nAppID,
uint  nIP,
ushort  nConnPort,
ushort  nQueryPort,
uint  unFlags,
uint  rTime32LastPlayedOnServer 
)
inlinestatic

adds the game server to the local list; updates the time played of the server if it already exists in the list

static void Steamworks.SteamMatchmaking.AddRequestLobbyListCompatibleMembersFilter ( CSteamID  steamIDLobby)
inlinestatic
static void Steamworks.SteamMatchmaking.AddRequestLobbyListDistanceFilter ( ELobbyDistanceFilter  eLobbyDistanceFilter)
inlinestatic

sets the distance for which we should search for lobbies (based on users IP address to location map on the Steam backed)

static void Steamworks.SteamMatchmaking.AddRequestLobbyListFilterSlotsAvailable ( int  nSlotsAvailable)
inlinestatic

returns only lobbies with the specified number of slots available

static void Steamworks.SteamMatchmaking.AddRequestLobbyListNearValueFilter ( string  pchKeyToMatch,
int  nValueToBeCloseTo 
)
inlinestatic

returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence

static void Steamworks.SteamMatchmaking.AddRequestLobbyListNumericalFilter ( string  pchKeyToMatch,
int  nValueToMatch,
ELobbyComparison  eComparisonType 
)
inlinestatic

numerical comparison

static void Steamworks.SteamMatchmaking.AddRequestLobbyListResultCountFilter ( int  cMaxResults)
inlinestatic

sets how many results to return, the lower the count the faster it is to download the lobby results & details to the client

static void Steamworks.SteamMatchmaking.AddRequestLobbyListStringFilter ( string  pchKeyToMatch,
string  pchValueToMatch,
ELobbyComparison  eComparisonType 
)
inlinestatic

filters for lobbies

this needs to be called before RequestLobbyList() to take effect

these are cleared on each call to RequestLobbyList()

static SteamAPICall_t Steamworks.SteamMatchmaking.CreateLobby ( ELobbyType  eLobbyType,
int  cMaxMembers 
)
inlinestatic

Create a lobby on the Steam servers.

If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID

of the lobby will need to be communicated via game channels or via InviteUserToLobby()

this is an asynchronous request

results will be returned by LobbyCreated_t callback and call result; lobby is joined & ready to use at this point

a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)

static bool Steamworks.SteamMatchmaking.DeleteLobbyData ( CSteamID  steamIDLobby,
string  pchKey 
)
inlinestatic

removes a metadata key from the lobby

static bool Steamworks.SteamMatchmaking.GetFavoriteGame ( int  iGame,
out AppId_t  pnAppID,
out uint  pnIP,
out ushort  pnConnPort,
out ushort  pnQueryPort,
out uint  punFlags,
out uint  pRTime32LastPlayedOnServer 
)
inlinestatic

returns the details of the game server

iGame is of range [0,GetFavoriteGameCount())

*pnIP, *pnConnPort are filled in the with IP:port of the game server

*punFlags specify whether the game server was stored as an explicit favorite or in the history of connections

*pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added

static int Steamworks.SteamMatchmaking.GetFavoriteGameCount ( )
inlinestatic

game server favorites storage

saves basic details about a multiplayer game server locally

returns the number of favorites servers the user has stored

static CSteamID Steamworks.SteamMatchmaking.GetLobbyByIndex ( int  iLobby)
inlinestatic

returns the CSteamID of a lobby, as retrieved by a RequestLobbyList call

should only be called after a LobbyMatchList_t callback is received

iLobby is of the range [0, LobbyMatchList_t::m_nLobbiesMatching)

the returned CSteamID::IsValid() will be false if iLobby is out of range

static int Steamworks.SteamMatchmaking.GetLobbyChatEntry ( CSteamID  steamIDLobby,
int  iChatID,
out CSteamID  pSteamIDUser,
byte[]  pvData,
int  cubData,
out EChatEntryType  peChatEntryType 
)
inlinestatic

Get a chat message as specified in a LobbyChatMsg_t callback

iChatID is the LobbyChatMsg_t::m_iChatID value in the callback

*pSteamIDUser is filled in with the CSteamID of the member

*pvData is filled in with the message itself

return value is the number of bytes written into the buffer

static string Steamworks.SteamMatchmaking.GetLobbyData ( CSteamID  steamIDLobby,
string  pchKey 
)
inlinestatic

Get data associated with this lobby

takes a simple key, and returns the string associated with it

"" will be returned if no value is set, or if steamIDLobby is invalid

static bool Steamworks.SteamMatchmaking.GetLobbyDataByIndex ( CSteamID  steamIDLobby,
int  iLobbyData,
out string  pchKey,
int  cchKeyBufferSize,
out string  pchValue,
int  cchValueBufferSize 
)
inlinestatic

returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount())

static int Steamworks.SteamMatchmaking.GetLobbyDataCount ( CSteamID  steamIDLobby)
inlinestatic

returns the number of metadata keys set on the specified lobby

static bool Steamworks.SteamMatchmaking.GetLobbyGameServer ( CSteamID  steamIDLobby,
out uint  punGameServerIP,
out ushort  punGameServerPort,
out CSteamID  psteamIDGameServer 
)
inlinestatic

returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist

static CSteamID Steamworks.SteamMatchmaking.GetLobbyMemberByIndex ( CSteamID  steamIDLobby,
int  iMember 
)
inlinestatic

returns the CSteamID of a user in the lobby

iMember is of range [0,GetNumLobbyMembers())

note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby

static string Steamworks.SteamMatchmaking.GetLobbyMemberData ( CSteamID  steamIDLobby,
CSteamID  steamIDUser,
string  pchKey 
)
inlinestatic

Gets per-user metadata for someone in this lobby

static int Steamworks.SteamMatchmaking.GetLobbyMemberLimit ( CSteamID  steamIDLobby)
inlinestatic

returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined

static CSteamID Steamworks.SteamMatchmaking.GetLobbyOwner ( CSteamID  steamIDLobby)
inlinestatic

returns the current lobby owner

you must be a member of the lobby to access this

there always one lobby owner - if the current owner leaves, another user will become the owner

it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner

static int Steamworks.SteamMatchmaking.GetNumLobbyMembers ( CSteamID  steamIDLobby)
inlinestatic

Lobby iteration, for viewing details of users in a lobby

only accessible if the lobby user is a member of the specified lobby

persona information for other lobby members (name, avatar, etc.) will be asynchronously received

and accessible via ISteamFriends interface

returns the number of users in the specified lobby

static bool Steamworks.SteamMatchmaking.InviteUserToLobby ( CSteamID  steamIDLobby,
CSteamID  steamIDInvitee 
)
inlinestatic

Invite another user to the lobby

the target user will receive a LobbyInvite_t callback

will return true if the invite is successfully sent, whether or not the target responds

returns false if the local user is not connected to the Steam servers

if the other user clicks the join link, a GameLobbyJoinRequested_t will be posted if the user is in-game,

or if the game isn't running yet the game will be launched with the parameter +connect_lobby <64-bit lobby id>

static SteamAPICall_t Steamworks.SteamMatchmaking.JoinLobby ( CSteamID  steamIDLobby)
inlinestatic

Joins an existing lobby

this is an asynchronous request

results will be returned by LobbyEnter_t callback & call result, check m_EChatRoomEnterResponse to see if was successful

lobby metadata is available to use immediately on this call completing

static void Steamworks.SteamMatchmaking.LeaveLobby ( CSteamID  steamIDLobby)
inlinestatic

Leave a lobby; this will take effect immediately on the client side

other users in the lobby will be notified by a LobbyChatUpdate_t callback

static bool Steamworks.SteamMatchmaking.RemoveFavoriteGame ( AppId_t  nAppID,
uint  nIP,
ushort  nConnPort,
ushort  nQueryPort,
uint  unFlags 
)
inlinestatic

removes the game server from the local storage; returns true if one was removed

static bool Steamworks.SteamMatchmaking.RequestLobbyData ( CSteamID  steamIDLobby)
inlinestatic

Refreshes metadata for a lobby you're not necessarily in right now

you never do this for lobbies you're a member of, only if your

this will send down all the metadata associated with a lobby

this is an asynchronous call

returns false if the local user is not connected to the Steam servers

results will be returned by a LobbyDataUpdate_t callback

if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false

static SteamAPICall_t Steamworks.SteamMatchmaking.RequestLobbyList ( )
inlinestatic

/////

Game lobby functions

Get a list of relevant lobbies

this is an asynchronous request

results will be returned by LobbyMatchList_t callback & call result, with the number of lobbies found

this will never return lobbies that are full

to add more filter, the filter calls below need to be call before each and every RequestLobbyList() call

use the CCallResult<> object in steam_api.h to match the SteamAPICall_t call result to a function in an object, e.g.

class CMyLobbyListManager

{

CCallResult<CMyLobbyListManager, LobbyMatchList_t> m_CallResultLobbyMatchList;

void FindLobbies()

{

// SteamMatchmaking()->AddRequestLobbyListFilter*() functions would be called here, before RequestLobbyList()

SteamAPICall_t hSteamAPICall = SteamMatchmaking()->RequestLobbyList();

m_CallResultLobbyMatchList.Set( hSteamAPICall, this, &CMyLobbyListManager::OnLobbyMatchList );

}

void OnLobbyMatchList( LobbyMatchList_t *pLobbyMatchList, bool bIOFailure )

{

// lobby list has be retrieved from Steam back-end, use results

}

}

static bool Steamworks.SteamMatchmaking.SendLobbyChatMsg ( CSteamID  steamIDLobby,
byte[]  pvMsgBody,
int  cubMsgBody 
)
inlinestatic

Broadcasts a chat message to the all the users in the lobby

users in the lobby (including the local user) will receive a LobbyChatMsg_t callback

returns true if the message is successfully sent

pvMsgBody can be binary or text data, up to 4k

if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator

static bool Steamworks.SteamMatchmaking.SetLinkedLobby ( CSteamID  steamIDLobby,
CSteamID  steamIDLobbyDependent 
)
inlinestatic

link two lobbies for the purposes of checking player compatibility

you must be the lobby owner of both lobbies

static bool Steamworks.SteamMatchmaking.SetLobbyData ( CSteamID  steamIDLobby,
string  pchKey,
string  pchValue 
)
inlinestatic

Sets a key/value pair in the lobby metadata

each user in the lobby will be broadcast this new value, and any new users joining will receive any existing data

this can be used to set lobby names, map, etc.

to reset a key, just set it to ""

other users in the lobby will receive notification of the lobby data change via a LobbyDataUpdate_t callback

static void Steamworks.SteamMatchmaking.SetLobbyGameServer ( CSteamID  steamIDLobby,
uint  unGameServerIP,
ushort  unGameServerPort,
CSteamID  steamIDGameServer 
)
inlinestatic

sets the game server associated with the lobby

usually at this point, the users will join the specified game server

either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect

static bool Steamworks.SteamMatchmaking.SetLobbyJoinable ( CSteamID  steamIDLobby,
bool  bLobbyJoinable 
)
inlinestatic

sets whether or not a lobby is joinable - defaults to true for a new lobby

if set to false, no user can join, even if they are a friend or have been invited

static void Steamworks.SteamMatchmaking.SetLobbyMemberData ( CSteamID  steamIDLobby,
string  pchKey,
string  pchValue 
)
inlinestatic

Sets per-user metadata (for the local user implicitly)

static bool Steamworks.SteamMatchmaking.SetLobbyMemberLimit ( CSteamID  steamIDLobby,
int  cMaxMembers 
)
inlinestatic

set the limit on the # of users who can join the lobby

static bool Steamworks.SteamMatchmaking.SetLobbyOwner ( CSteamID  steamIDLobby,
CSteamID  steamIDNewOwner 
)
inlinestatic

changes who the lobby owner is

you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby

after completion, the local user will no longer be the owner

static bool Steamworks.SteamMatchmaking.SetLobbyType ( CSteamID  steamIDLobby,
ELobbyType  eLobbyType 
)
inlinestatic

updates which type of lobby it is

only lobbies that are k_ELobbyTypePublic or k_ELobbyTypeInvisible, and are set to joinable, will be returned by RequestLobbyList() calls


The documentation for this class was generated from the following file: