C# 클래스 Steamworks.SteamGameServer

파일 보기 프로젝트 열기: rlabrecque/Steamworks.NET 1 사용 예제들

공개 메소드들

메소드 설명
AssociateWithClan ( CSteamID steamIDClan ) : SteamAPICall_t

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

BLoggedOn ( ) : bool

status functions

BSecure ( ) : bool
BUpdateUserData ( CSteamID steamIDUser, string pchPlayerName, uint uScore ) : bool

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)

BeginAuthSession ( byte pAuthTicket, int cbAuthTicket, CSteamID steamID ) : EBeginAuthSessionResult

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 )

CancelAuthTicket ( HAuthTicket hAuthTicket ) : void

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

ClearAllKeyValues ( ) : void

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

ComputeNewPlayerCompatibility ( CSteamID steamIDNewPlayer ) : SteamAPICall_t

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

CreateUnauthenticatedUserConnection ( ) : CSteamID

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.

EnableHeartbeats ( bool bActive ) : void

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).

EndAuthSession ( CSteamID steamID ) : void

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

ForceHeartbeat ( ) : void

Force a heartbeat to steam at the next opportunity

GetAuthSessionTicket ( byte pTicket, int cbMaxTicket, uint &pcbTicket ) : HAuthTicket

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.

GetGameplayStats ( ) : void

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

they will be removed in a future version of the SDK

GetNextOutgoingPacket ( byte pOut, int cbMaxOut, uint &pNetAdr, ushort &pPort ) : int

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.

GetPublicIP ( ) : uint

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

GetServerReputation ( ) : SteamAPICall_t
GetSteamID ( ) : CSteamID
HandleIncomingPacket ( byte pData, int cbData, uint srcIP, ushort srcPort ) : bool

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.

InitGameServer ( uint unIP, ushort usGamePort, ushort usQueryPort, uint unFlags, AppId_t nGameAppId, string pchVersionString ) : bool

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

LogOff ( ) : void

/ Begin process of logging game server out of steam

LogOn ( string pszToken ) : void

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 SteamServersConnected_t

/ @see SteamServerConnectFailure_t

/ @see SteamServersDisconnected_t

LogOnAnonymous ( ) : void

/ 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.

RequestUserGroupStatus ( CSteamID steamIDUser, CSteamID steamIDGroup ) : bool

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

SendUserConnectAndAuthenticate ( uint unIPClient, byte pvAuthBlob, uint cubAuthBlobSize, CSteamID &pSteamIDUser ) : bool

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)

SendUserDisconnect ( CSteamID steamIDUser ) : void

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.

SetBotPlayerCount ( int cBotplayers ) : void

/ Number of bots. Default value is zero

SetDedicatedServer ( bool bDedicated ) : void

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

SetGameData ( string pchGameData ) : void

/ 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 k_cbMaxGameServerGameData

SetGameDescription ( string pszGameDescription ) : void

/ 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.

SetGameTags ( string pchGameTags ) : void

/ 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 k_cbMaxGameServerTags

SetHeartbeatInterval ( int iHeartbeatInterval ) : void

You usually don't need to modify this.

Pass -1 to use the default value for iHeartbeatInterval.

Some mods change this.

SetKeyValue ( string pKey, string pValue ) : void

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

SetMapName ( string pszMapName ) : void

/ Set name of map to report in the server browser

/

/ @see k_cbMaxGameServerName

SetMaxPlayerCount ( int cPlayersMax ) : void

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

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

SetModDir ( string pszModDir ) : void

/ 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 k_cbMaxGameServerGameDir

SetPasswordProtected ( bool bPasswordProtected ) : void

/ Let people know if your server will require a password

SetProduct ( string pszProduct ) : void

/ 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.

SetRegion ( string pszRegion ) : void

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

SetServerName ( string pszServerName ) : void

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

/

/ @see k_cbMaxGameServerName

SetSpectatorPort ( ushort unSpectatorPort ) : void

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

/ is not used.

SetSpectatorServerName ( string pszSpectatorServerName ) : void

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

/

/ @see k_cbMaxGameServerMapName

UserHasLicenseForApp ( CSteamID steamID, AppId_t appID ) : EUserHasLicenseForAppResult

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.

WasRestartRequested ( ) : bool

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

/ Only returns true once per request.

메소드 상세

AssociateWithClan() 공개 정적인 메소드

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

public static AssociateWithClan ( CSteamID steamIDClan ) : SteamAPICall_t
steamIDClan CSteamID
리턴 SteamAPICall_t

BLoggedOn() 공개 정적인 메소드

status functions

public static BLoggedOn ( ) : bool
리턴 bool

BSecure() 공개 정적인 메소드

public static BSecure ( ) : bool
리턴 bool

BUpdateUserData() 공개 정적인 메소드

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)

public static BUpdateUserData ( CSteamID steamIDUser, string pchPlayerName, uint uScore ) : bool
steamIDUser CSteamID
pchPlayerName string
uScore uint
리턴 bool

BeginAuthSession() 공개 정적인 메소드

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 )

public static BeginAuthSession ( byte pAuthTicket, int cbAuthTicket, CSteamID steamID ) : EBeginAuthSessionResult
pAuthTicket byte
cbAuthTicket int
steamID CSteamID
리턴 EBeginAuthSessionResult

CancelAuthTicket() 공개 정적인 메소드

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

public static CancelAuthTicket ( HAuthTicket hAuthTicket ) : void
hAuthTicket HAuthTicket
리턴 void

ClearAllKeyValues() 공개 정적인 메소드

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

public static ClearAllKeyValues ( ) : void
리턴 void

ComputeNewPlayerCompatibility() 공개 정적인 메소드

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

public static ComputeNewPlayerCompatibility ( CSteamID steamIDNewPlayer ) : SteamAPICall_t
steamIDNewPlayer CSteamID
리턴 SteamAPICall_t

CreateUnauthenticatedUserConnection() 공개 정적인 메소드

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.

public static CreateUnauthenticatedUserConnection ( ) : CSteamID
리턴 CSteamID

EnableHeartbeats() 공개 정적인 메소드

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).

public static EnableHeartbeats ( bool bActive ) : void
bActive bool
리턴 void

EndAuthSession() 공개 정적인 메소드

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

public static EndAuthSession ( CSteamID steamID ) : void
steamID CSteamID
리턴 void

ForceHeartbeat() 공개 정적인 메소드

Force a heartbeat to steam at the next opportunity

public static ForceHeartbeat ( ) : void
리턴 void

GetAuthSessionTicket() 공개 정적인 메소드

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.

public static GetAuthSessionTicket ( byte pTicket, int cbMaxTicket, uint &pcbTicket ) : HAuthTicket
pTicket byte
cbMaxTicket int
pcbTicket uint
리턴 HAuthTicket

GetGameplayStats() 공개 정적인 메소드

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

they will be removed in a future version of the SDK

public static GetGameplayStats ( ) : void
리턴 void

GetNextOutgoingPacket() 공개 정적인 메소드

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.

public static GetNextOutgoingPacket ( byte pOut, int cbMaxOut, uint &pNetAdr, ushort &pPort ) : int
pOut byte
cbMaxOut int
pNetAdr uint
pPort ushort
리턴 int

GetPublicIP() 공개 정적인 메소드

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

public static GetPublicIP ( ) : uint
리턴 uint

GetServerReputation() 공개 정적인 메소드

public static GetServerReputation ( ) : SteamAPICall_t
리턴 SteamAPICall_t

GetSteamID() 공개 정적인 메소드

public static GetSteamID ( ) : CSteamID
리턴 CSteamID

HandleIncomingPacket() 공개 정적인 메소드

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.

public static HandleIncomingPacket ( byte pData, int cbData, uint srcIP, ushort srcPort ) : bool
pData byte
cbData int
srcIP uint
srcPort ushort
리턴 bool

InitGameServer() 공개 정적인 메소드

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

public static InitGameServer ( uint unIP, ushort usGamePort, ushort usQueryPort, uint unFlags, AppId_t nGameAppId, string pchVersionString ) : bool
unIP uint
usGamePort ushort
usQueryPort ushort
unFlags uint
nGameAppId AppId_t
pchVersionString string
리턴 bool

LogOff() 공개 정적인 메소드

/ Begin process of logging game server out of steam

public static LogOff ( ) : void
리턴 void

LogOn() 공개 정적인 메소드

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 SteamServersConnected_t

/ @see SteamServerConnectFailure_t

/ @see SteamServersDisconnected_t

public static LogOn ( string pszToken ) : void
pszToken string
리턴 void

LogOnAnonymous() 공개 정적인 메소드

/ 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.

public static LogOnAnonymous ( ) : void
리턴 void

RequestUserGroupStatus() 공개 정적인 메소드

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

public static RequestUserGroupStatus ( CSteamID steamIDUser, CSteamID steamIDGroup ) : bool
steamIDUser CSteamID
steamIDGroup CSteamID
리턴 bool

SendUserConnectAndAuthenticate() 공개 정적인 메소드

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)

public static SendUserConnectAndAuthenticate ( uint unIPClient, byte pvAuthBlob, uint cubAuthBlobSize, CSteamID &pSteamIDUser ) : bool
unIPClient uint
pvAuthBlob byte
cubAuthBlobSize uint
pSteamIDUser CSteamID
리턴 bool

SendUserDisconnect() 공개 정적인 메소드

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.

public static SendUserDisconnect ( CSteamID steamIDUser ) : void
steamIDUser CSteamID
리턴 void

SetBotPlayerCount() 공개 정적인 메소드

/ Number of bots. Default value is zero

public static SetBotPlayerCount ( int cBotplayers ) : void
cBotplayers int
리턴 void

SetDedicatedServer() 공개 정적인 메소드

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

public static SetDedicatedServer ( bool bDedicated ) : void
bDedicated bool
리턴 void

SetGameData() 공개 정적인 메소드

/ 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 k_cbMaxGameServerGameData

public static SetGameData ( string pchGameData ) : void
pchGameData string
리턴 void

SetGameDescription() 공개 정적인 메소드

/ 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.

public static SetGameDescription ( string pszGameDescription ) : void
pszGameDescription string
리턴 void

SetGameTags() 공개 정적인 메소드

/ 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 k_cbMaxGameServerTags

public static SetGameTags ( string pchGameTags ) : void
pchGameTags string
리턴 void

SetHeartbeatInterval() 공개 정적인 메소드

You usually don't need to modify this.

Pass -1 to use the default value for iHeartbeatInterval.

Some mods change this.

public static SetHeartbeatInterval ( int iHeartbeatInterval ) : void
iHeartbeatInterval int
리턴 void

SetKeyValue() 공개 정적인 메소드

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

public static SetKeyValue ( string pKey, string pValue ) : void
pKey string
pValue string
리턴 void

SetMapName() 공개 정적인 메소드

/ Set name of map to report in the server browser

/

/ @see k_cbMaxGameServerName

public static SetMapName ( string pszMapName ) : void
pszMapName string
리턴 void

SetMaxPlayerCount() 공개 정적인 메소드

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

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

public static SetMaxPlayerCount ( int cPlayersMax ) : void
cPlayersMax int
리턴 void

SetModDir() 공개 정적인 메소드

/ 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 k_cbMaxGameServerGameDir

public static SetModDir ( string pszModDir ) : void
pszModDir string
리턴 void

SetPasswordProtected() 공개 정적인 메소드

/ Let people know if your server will require a password

public static SetPasswordProtected ( bool bPasswordProtected ) : void
bPasswordProtected bool
리턴 void

SetProduct() 공개 정적인 메소드

/ 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.

public static SetProduct ( string pszProduct ) : void
pszProduct string
리턴 void

SetRegion() 공개 정적인 메소드

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

public static SetRegion ( string pszRegion ) : void
pszRegion string
리턴 void

SetServerName() 공개 정적인 메소드

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

/

/ @see k_cbMaxGameServerName

public static SetServerName ( string pszServerName ) : void
pszServerName string
리턴 void

SetSpectatorPort() 공개 정적인 메소드

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

/ is not used.

public static SetSpectatorPort ( ushort unSpectatorPort ) : void
unSpectatorPort ushort
리턴 void

SetSpectatorServerName() 공개 정적인 메소드

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

/

/ @see k_cbMaxGameServerMapName

public static SetSpectatorServerName ( string pszSpectatorServerName ) : void
pszSpectatorServerName string
리턴 void

UserHasLicenseForApp() 공개 정적인 메소드

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.

public static UserHasLicenseForApp ( CSteamID steamID, AppId_t appID ) : EUserHasLicenseForAppResult
steamID CSteamID
appID AppId_t
리턴 EUserHasLicenseForAppResult

WasRestartRequested() 공개 정적인 메소드

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

/ Only returns true once per request.

public static WasRestartRequested ( ) : bool
리턴 bool