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.SteamGameServer Class Reference

Static Public Member Functions

static SteamAPICall_t AssociateWithClan (CSteamID steamIDClan)
 
static EBeginAuthSessionResult BeginAuthSession (byte[] pAuthTicket, int cbAuthTicket, CSteamID steamID)
 
static bool BLoggedOn ()
 
static bool BSecure ()
 
static bool BUpdateUserData (CSteamID steamIDUser, string pchPlayerName, uint uScore)
 
static void CancelAuthTicket (HAuthTicket hAuthTicket)
 
static void ClearAllKeyValues ()
 
static SteamAPICall_t ComputeNewPlayerCompatibility (CSteamID steamIDNewPlayer)
 
static CSteamID CreateUnauthenticatedUserConnection ()
 
static void EnableHeartbeats (bool bActive)
 
static void EndAuthSession (CSteamID steamID)
 
static void ForceHeartbeat ()
 
static HAuthTicket GetAuthSessionTicket (byte[] pTicket, int cbMaxTicket, out uint pcbTicket)
 
static void GetGameplayStats ()
 
static int GetNextOutgoingPacket (byte[] pOut, int cbMaxOut, out uint pNetAdr, out ushort pPort)
 
static uint GetPublicIP ()
 
static SteamAPICall_t GetServerReputation ()
 
static CSteamID GetSteamID ()
 
static bool HandleIncomingPacket (byte[] pData, int cbData, uint srcIP, ushort srcPort)
 
static bool InitGameServer (uint unIP, ushort usGamePort, ushort usQueryPort, uint unFlags, AppId_t nGameAppId, string pchVersionString)
 
static void LogOff ()
 
static void LogOn (string pszToken)
 
static void LogOnAnonymous ()
 
static bool RequestUserGroupStatus (CSteamID steamIDUser, CSteamID steamIDGroup)
 
static bool SendUserConnectAndAuthenticate (uint unIPClient, byte[] pvAuthBlob, uint cubAuthBlobSize, out CSteamID pSteamIDUser)
 
static void SendUserDisconnect (CSteamID steamIDUser)
 
static void SetBotPlayerCount (int cBotplayers)
 
static void SetDedicatedServer (bool bDedicated)
 
static void SetGameData (string pchGameData)
 
static void SetGameDescription (string pszGameDescription)
 
static void SetGameTags (string pchGameTags)
 
static void SetHeartbeatInterval (int iHeartbeatInterval)
 
static void SetKeyValue (string pKey, string pValue)
 
static void SetMapName (string pszMapName)
 
static void SetMaxPlayerCount (int cPlayersMax)
 
static void SetModDir (string pszModDir)
 
static void SetPasswordProtected (bool bPasswordProtected)
 
static void SetProduct (string pszProduct)
 
static void SetRegion (string pszRegion)
 
static void SetServerName (string pszServerName)
 
static void SetSpectatorPort (ushort unSpectatorPort)
 
static void SetSpectatorServerName (string pszSpectatorServerName)
 
static EUserHasLicenseForAppResult UserHasLicenseForApp (CSteamID steamID, AppId_t appID)
 
static bool WasRestartRequested ()
 

Member Function Documentation

static SteamAPICall_t Steamworks.SteamGameServer.AssociateWithClan ( CSteamID  steamIDClan)
inlinestatic

associate this game server with this clan for the purposes of computing player compat

static EBeginAuthSessionResult Steamworks.SteamGameServer.BeginAuthSession ( byte[]  pAuthTicket,
int  cbAuthTicket,
CSteamID  steamID 
)
inlinestatic

Authenticate ticket ( from GetAuthSessionTicket ) from entity steamID to be sure it is valid and isnt reused

Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )

static bool Steamworks.SteamGameServer.BLoggedOn ( )
inlinestatic

status functions

static bool Steamworks.SteamGameServer.BSecure ( )
inlinestatic
static bool Steamworks.SteamGameServer.BUpdateUserData ( CSteamID  steamIDUser,
string  pchPlayerName,
uint  uScore 
)
inlinestatic

Update the data to be displayed in the server browser and matchmaking interfaces for a user

currently connected to the server. For regular users you must call this after you receive a

GSUserValidationSuccess callback.

Return Value: true if successful, false if failure (ie, steamIDUser wasn't for an active player)

static void Steamworks.SteamGameServer.CancelAuthTicket ( HAuthTicket  hAuthTicket)
inlinestatic

Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to

static void Steamworks.SteamGameServer.ClearAllKeyValues ( )
inlinestatic

/ Call this to clear the whole list of key/values that are sent in rules queries.

static SteamAPICall_t Steamworks.SteamGameServer.ComputeNewPlayerCompatibility ( CSteamID  steamIDNewPlayer)
inlinestatic

ask if any of the current players dont want to play with this new player - or vice versa

static CSteamID Steamworks.SteamGameServer.CreateUnauthenticatedUserConnection ( )
inlinestatic

Creates a fake user (ie, a bot) which will be listed as playing on the server, but skips validation.

Return Value: Returns a SteamID for the user to be tracked with, you should call HandleUserDisconnect()

when this user leaves the server just like you would for a real user.

static void Steamworks.SteamGameServer.EnableHeartbeats ( bool  bActive)
inlinestatic

Control heartbeats / advertisement with master server

Call this as often as you like to tell the master server updater whether or not

you want it to be active (default: off).

static void Steamworks.SteamGameServer.EndAuthSession ( CSteamID  steamID)
inlinestatic

Stop tracking started by BeginAuthSession - called when no longer playing game with this entity

static void Steamworks.SteamGameServer.ForceHeartbeat ( )
inlinestatic

Force a heartbeat to steam at the next opportunity

static HAuthTicket Steamworks.SteamGameServer.GetAuthSessionTicket ( byte[]  pTicket,
int  cbMaxTicket,
out uint  pcbTicket 
)
inlinestatic

New auth system APIs - do not mix with the old auth system APIs.

-------------------------------------------------------------—

Retrieve ticket to be sent to the entity who wishes to authenticate you ( using BeginAuthSession API ).

pcbTicket retrieves the length of the actual ticket.

static void Steamworks.SteamGameServer.GetGameplayStats ( )
inlinestatic

these two functions s are deprecated, and will not return results

they will be removed in a future version of the SDK

static int Steamworks.SteamGameServer.GetNextOutgoingPacket ( byte[]  pOut,
int  cbMaxOut,
out uint  pNetAdr,
out ushort  pPort 
)
inlinestatic

AFTER calling HandleIncomingPacket for any packets that came in that frame, call this.

This gets a packet that the master server updater needs to send out on UDP.

It returns the length of the packet it wants to send, or 0 if there are no more packets to send.

Call this each frame until it returns 0.

static uint Steamworks.SteamGameServer.GetPublicIP ( )
inlinestatic

Returns the public IP of the server according to Steam, useful when the server is

behind NAT and you want to advertise its IP in a lobby for other clients to directly

connect to

static SteamAPICall_t Steamworks.SteamGameServer.GetServerReputation ( )
inlinestatic
static CSteamID Steamworks.SteamGameServer.GetSteamID ( )
inlinestatic
static bool Steamworks.SteamGameServer.HandleIncomingPacket ( byte[]  pData,
int  cbData,
uint  srcIP,
ushort  srcPort 
)
inlinestatic

These are in GameSocketShare mode, where instead of ISteamGameServer creating its own

socket to talk to the master server on, it lets the game use its socket to forward messages

back and forth. This prevents us from requiring server ops to open up yet another port

in their firewalls.

the IP address and port should be in host order, i.e 127.0.0.1 == 0x7f000001

These are used when you've elected to multiplex the game server's UDP socket

rather than having the master server updater use its own sockets.

Source games use this to simplify the job of the server admins, so they

don't have to open up more ports on their firewalls.

Call this when a packet that starts with 0xFFFFFFFF comes in. That means

it's for us.

static bool Steamworks.SteamGameServer.InitGameServer ( uint  unIP,
ushort  usGamePort,
ushort  usQueryPort,
uint  unFlags,
AppId_t  nGameAppId,
string  pchVersionString 
)
inlinestatic

Basic server data. These properties, if set, must be set before before calling LogOn. They

may not be changed after logged in.

/ This is called by SteamGameServer_Init, and you will usually not need to call it directly

static void Steamworks.SteamGameServer.LogOff ( )
inlinestatic

/ Begin process of logging game server out of steam

static void Steamworks.SteamGameServer.LogOn ( string  pszToken)
inlinestatic

Login

/ Begin process to login to a persistent game server account

/

/ You need to register for callbacks to determine the result of this operation.

/

See also
SteamServersConnected_t

/

See also
SteamServerConnectFailure_t

/

See also
SteamServersDisconnected_t
static void Steamworks.SteamGameServer.LogOnAnonymous ( )
inlinestatic

/ Login to a generic, anonymous account.

/

/ Note: in previous versions of the SDK, this was automatically called within SteamGameServer_Init,

/ but this is no longer the case.

static bool Steamworks.SteamGameServer.RequestUserGroupStatus ( CSteamID  steamIDUser,
CSteamID  steamIDGroup 
)
inlinestatic

Ask if a user in in the specified group, results returns async by GSUserGroupStatus_t

returns false if we're not connected to the steam servers and thus cannot ask

static bool Steamworks.SteamGameServer.SendUserConnectAndAuthenticate ( uint  unIPClient,
byte[]  pvAuthBlob,
uint  cubAuthBlobSize,
out CSteamID  pSteamIDUser 
)
inlinestatic

Player list management / authentication

Handles receiving a new connection from a Steam user. This call will ask the Steam

servers to validate the users identity, app ownership, and VAC status. If the Steam servers

are off-line, then it will validate the cached ticket itself which will validate app ownership

and identity. The AuthBlob here should be acquired on the game client using SteamUser()->InitiateGameConnection()

and must then be sent up to the game server for authentication.

Return Value: returns true if the users ticket passes basic checks. pSteamIDUser will contain the Steam ID of this user. pSteamIDUser must NOT be NULL

If the call succeeds then you should expect a GSClientApprove_t or GSClientDeny_t callback which will tell you whether authentication

for the user has succeeded or failed (the steamid in the callback will match the one returned by this call)

static void Steamworks.SteamGameServer.SendUserDisconnect ( CSteamID  steamIDUser)
inlinestatic

Should be called whenever a user leaves our game server, this lets Steam internally

track which users are currently on which servers for the purposes of preventing a single

account being logged into multiple servers, showing who is currently on a server, etc.

static void Steamworks.SteamGameServer.SetBotPlayerCount ( int  cBotplayers)
inlinestatic

/ Number of bots. Default value is zero

static void Steamworks.SteamGameServer.SetDedicatedServer ( bool  bDedicated)
inlinestatic

/ Is this is a dedicated server? The default value is false.

static void Steamworks.SteamGameServer.SetGameData ( string  pchGameData)
inlinestatic

/ Sets a string defining the "gamedata" for this server, this is optional, but if it is set

/ it allows users to filter in the matchmaking/server-browser interfaces based on the value

/ don't set this unless it actually changes, its only uploaded to the master once (when

/ acknowledged)

/

/

See also
k_cbMaxGameServerGameData
static void Steamworks.SteamGameServer.SetGameDescription ( string  pszGameDescription)
inlinestatic

/ Description of the game. This is a required field and is displayed in the steam server browser....for now.

/ This is a required field, but it will go away eventually, as the data should be determined from the AppID.

static void Steamworks.SteamGameServer.SetGameTags ( string  pchGameTags)
inlinestatic

/ Sets a string defining the "gametags" for this server, this is optional, but if it is set

/ it allows users to filter in the matchmaking/server-browser interfaces based on the value

/

/

See also
k_cbMaxGameServerTags
static void Steamworks.SteamGameServer.SetHeartbeatInterval ( int  iHeartbeatInterval)
inlinestatic

You usually don't need to modify this.

Pass -1 to use the default value for iHeartbeatInterval.

Some mods change this.

static void Steamworks.SteamGameServer.SetKeyValue ( string  pKey,
string  pValue 
)
inlinestatic

/ Call this to add/update a key/value pair.

static void Steamworks.SteamGameServer.SetMapName ( string  pszMapName)
inlinestatic

/ Set name of map to report in the server browser

/

/

See also
k_cbMaxGameServerName
static void Steamworks.SteamGameServer.SetMaxPlayerCount ( int  cPlayersMax)
inlinestatic

Server state. These properties may be changed at any time.

/ Max player count that will be reported to server browser and client queries

static void Steamworks.SteamGameServer.SetModDir ( string  pszModDir)
inlinestatic

/ If your game is a "mod," pass the string that identifies it. The default is an empty string, meaning

/ this application is the original game, not a mod.

/

/

See also
k_cbMaxGameServerGameDir
static void Steamworks.SteamGameServer.SetPasswordProtected ( bool  bPasswordProtected)
inlinestatic

/ Let people know if your server will require a password

static void Steamworks.SteamGameServer.SetProduct ( string  pszProduct)
inlinestatic

/ Game product identifier. This is currently used by the master server for version checking purposes.

/ It's a required field, but will eventually will go away, and the AppID will be used for this purpose.

static void Steamworks.SteamGameServer.SetRegion ( string  pszRegion)
inlinestatic

/ Region identifier. This is an optional field, the default value is empty, meaning the "world" region

static void Steamworks.SteamGameServer.SetServerName ( string  pszServerName)
inlinestatic

/ Set the name of server as it will appear in the server browser

/

/

See also
k_cbMaxGameServerName
static void Steamworks.SteamGameServer.SetSpectatorPort ( ushort  unSpectatorPort)
inlinestatic

/ Spectator server. The default value is zero, meaning the service

/ is not used.

static void Steamworks.SteamGameServer.SetSpectatorServerName ( string  pszSpectatorServerName)
inlinestatic

/ Name of the spectator server. (Only used if spectator port is nonzero.)

/

/

See also
k_cbMaxGameServerMapName
static EUserHasLicenseForAppResult Steamworks.SteamGameServer.UserHasLicenseForApp ( CSteamID  steamID,
AppId_t  appID 
)
inlinestatic

After receiving a user's authentication data, and passing it to SendUserConnectAndAuthenticate, use this function

to determine if the user owns downloadable content specified by the provided AppID.

static bool Steamworks.SteamGameServer.WasRestartRequested ( )
inlinestatic

/ Returns true if the master server has requested a restart.

/ Only returns true once per request.


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