Game Server
Only available in the GodotSteam Server branches
Functions
associateWithClan
associateWithClan( uint64_t
clan_id )
Associate this game server with this clan for the purposes of computing player compatibility.
Triggers a associate_clan callback.
Returns: void
beginAuthSession
beginAuthSession( int
auth_ticket, uint64_t
steam_id )
Authenticate the ticket from the entity Steam ID to be sure it is valid and isn't reused. The ticket is created on the entity with getAuthSessionTicket and then needs to be provided over the network for the other end to validate. This registers for validate_auth_ticket_response callbacks if the entity goes offline or cancels the ticket. See EAuthSessionResponse for more information. When the multiplayer session terminates you must call endAuthSession.
Returns: int
cancelServerAuthTicket
cancelAuthTicket( uint32
auth_ticket )
Cancel auth ticket from getAuthSessionTicket; called when no longer playing game with the entity you gave the ticket to.
Returns: void
clearAllKeyValues
clearAllKeyValues()
Call this to clear the whole list of key/values that are sent in rule queries.
Returns: void
computeNewPlayerCompatibility
computeNewPlayerCompatibility( uint64_t
steam_id )
Ask if any of the current players dont want to play with this new player - or vice versa. Triggers a player_compat callback.
Returns: void
endAuthSession
endAuthSession( uint64_t
steam_id )
Stop tracking started by beginAuthSession; called when no longer playing game with this entity.
Returns: void
getAuthSessionTicket
getAuthSessionTicket()
Retrieve a authentication ticket to be sent to the entity who wishes to authenticate you. After calling this you can send the ticket to the entity where they can then call beginAuthSession to verify this entities integrity. When creating a ticket for use by the ISteamUserAuth/AuthenticateUserTicket Web API, the calling application should wait for the get_auth_session_ticket_response callback generated by the API call before attempting to use the ticket to ensure that the ticket has been communicated to the server. If this callback does not come in a timely fashion (10 - 20 seconds), then your client is not connected to Steam, and the AuthenticateUserTicket call will fail because it can not authenticate the user.
Triggers a get_auth_session_ticket_response callback.
Returns: dictionary
Contains the following keys:
- id (uint32_t)
- buffer (PoolByteArray)
- ticket_size (uint32_t)
getNextOutgoingPacket
getNextOutgoingPacket()
Gets a packet that the master server updater needs to send out on UDP when in GameSocketShare mode. GameSocketShare mode can be enabled when calling serverInit.
Note: This should only ever be called after calling handleIncomingPacket for any packets that came in that frame.
Note: This must be called repeatedly each frame until it returns 0 when in GameSocketShare mode.
Returns: dictionary
- length (int)
- out (PoolByteArray)
- address (uint32)
- port (uint16)
getPublicIP
getPublicIP()
Gets the public IP of the server according to Steam. This is useful when the server is behind NAT and you want to advertise its IP in a lobby for other clients to directly connect to.
Returns: dictionary
Contains the following keys:
- ipv4 (int)
- ipv6 (int)
- type (int)
getSteamID
getSteamID()
Gets the Steam ID of the game server.
Returns: uint64_t
handleIncomingPacket
handleIncomingPacket( int
packet, string
ip, int
port )
Handles a Steam master server packet when in GameSocketShare mode. When in GameSocketShare mode, 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. This should be called whenever a packet that starts with 0xFFFFFFFF comes in. That means it's for us. The IP and port parameters 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 engine games use this to simplify the job of the server admins, so they don't have to open up more ports on their firewalls. Only after calling this, you should call getNextOutgoingPacket. GameSocketShare mode can be enabled when calling serverInit or serverInitEx.
Returns: dictionary
Contains the following key:
- data (PoolByteArray)
loggedOn
logOff
logOff()
Begin process of logging game server out of Steam.
Triggers a server_connect_failure, server_connected, or server_disconnected callbacks.
Returns: void
logOn
logOn( string
token )
Begin process to login to a persistent game server account.
Triggers a server_connect_failure, server_connected, or server_disconnected callbacks.
Returns: void
logOnAnonymous
logOnAnonymous()
Login to a generic, anonymous account.
Triggers a server_connect_failure, server_connected, or server_disconnected callbacks.
Returns: void
requestUserGroupStatus
requestUserGroupStatus( uint64_t
steam_id, int
group_id )
Ask if user is in specified group; results returned by client_group_status.
Triggers a client_group_status callback.
Returns: bool
secure
secure()
Checks whether the game server is in "Secure" mode.
Returns: bool
setAdvertiseServerActive
setAdvertiseServerActive( bool
active )
Tells the Steam master servers whether or not you want to be active. If this is enabled then the server will talk to the master servers, if it's not then incoming messages are ignored and heartbeats will not be sent.
Returns: void
Note: This function is called EnableHeartbeats in the Steamworks documentation but is called SetAdvertiseServerAction in the SDK header file.
setBotPlayerCount
setBotPlayerCount( int
bots )
Sets the number of bot/AI players on the game server. The default value is 0.
Returns: void
setDedicatedServer
setDedicatedServer( bool
dedicated )
Sets the whether this is a dedicated server or a listen server. The default is listen server.
Returns: void
Note: This only be set before calling logOn or logOnAnonymous.
setGameData
setGameData( string
data )
Sets a string defining the "gamedata" for this server, this is optional, but if set it allows users to filter in the matchmaking/server-browser interfaces based on the value. This is usually formatted as a comma or semicolon separated list. Don't set this unless it actually changes, its only uploaded to the master once; when acknowledged.
Returns: void
setGameDescription
setGameDescription( string
description )
Sets the game description. Setting this to the full name of your game is recommended.
Returns: void
Note: This is required for all game servers and can only be set before calling logOn or logOnAnonymous.
setGameTags
setGameTags( string
tags )
Sets a string defining the "gametags" for this server, this is optional, but if set it allows users to filter in the matchmaking/server-browser interfaces based on the value. This is usually formatted as a comma or semicolon separated list. Don't set this unless it actually changes, its only uploaded to the master once; when acknowledged.
Returns: void
setKeyValue
setKeyValue( string
key, string
value )
Add/update a rules key/value pair.
Returns: void
setMapName
setMapName( string
map )
Sets the name of map to report in the server browser.
Returns: void
setMaxPlayerCount
setMaxPlayerCount( int
players_max )
Max player count that will be reported to server browser and client queries.
Returns: void
setModDir
setModDir( string
modDir )
Sets the game directory. This should be the same directory game where gets installed into. Just the folder name, not the whole path. e.g. "Spacewar".
Returns: void
Note: This is required for all game servers and can only be set before calling logOn or logOnAnonymous.
setPasswordProtected
setPasswordProtected( bool
password_protected )
Set whether the game server will require a password once when the user tries to join.
Returns: void
setProduct
setProduct( string
product )
Sets the game product identifier. This is currently used by the master server for version checking purposes. Converting the game's app ID to a string for this is recommended.
Returns: void
Note: This is required for all game servers and can only be set before calling logOn or logOnAnonymous.
setRegion
setRegion( string
region )
Region identifier. This is an optional field, the default value is an empty string, meaning the "world" region.
Returns: void
setServerName
setServerName( string
name )
Sets the name of server as it will appear in the server browser.
Returns: void
setSpectatorPort
setSpectatorPort( int
port )
Spectator server. Default is zero, meaning it is now used.
Returns: void
setSpectatorServerName
setSpectatorServerName( string
name )
Sets the name of the spectator server. This is only used if spectator port is non-zero.
Returns: void
userHasLicenceForApp
userHasLicenseForApp( uint64_t
steam_id, uint32
app_id )
Checks if the user owns a specific piece of Downloadable Content (DLC). This can only be called after sending the users auth ticket to beginAuthSession.
Returns: int
wasRestartRequested()
wasRestartRequested()
Checks if the master server has alerted us that we are out of date. This reverts back to false after calling this function.
Returns: bool
Signals
These callbacks require you to run Steam.run_callbacks()
in your _process()
function to receive them.
associate_clan
client_approved
client_approved
Client has been approved to connect to this game server.
Emits signal in response to function sendUserConnectAndAuthenticate (currently missing from Server).
Returns:
- steam_id (uint64_t)
- owner_id (uint64_t)
client_denied
client_denied
Client has been denied to connection to this game server.
Emits signal in response to function sendUserConnectAndAuthenticate (currently missing from Server).
Returns:
- steam_id (uint64_t)
- reason (int)
client_group_status
client_group_status
Sent as a reply to requestUserGroupStatus.
Returns:
- steam_id (uint64_t)
- group_id (uint64_t)
- member (bool)
- officer (bool)
client_kick
client_kick
Request the game server should kick the user.
Returns:
- steam_id (uint64_t)
- reason (int)
player_compat
player_compat
Sent as a reply to computeNewPlayerCompatibility.
Returns:
- result (int)
- players_dont_like_candidate (int)
- players_candidate_doesnt_like (int)
- clan_players_dont_like_candidate (int)
- steam_id (uint64_t)
policy_response
policy_response
Received when the game server requests to be displayed as secure (VAC protected).
Returns:
- secure (uint8)
Secure is true if the game server should display itself as secure to users, false otherwise.
server_connect_failure
server_connect_failure
Logging the game server onto Steam.
Emits signal in response to functions logOff, logOn, or logOnAnonymous.
Returns:
- result (int)
- retrying (bool)
server_connected
server_connected
Server has connected to the Steam back-end.
Emits signal in response to functions logOff, logOn, or logOnAnonymous.
Results: nothing
server_disconnected
server_disconnected
Called if the client has lost connection to the Steam servers. Real-time services will be disabled until a matching server_connected has been posted.
Emits signal in response to functions logOff, logOn, or logOnAnonymous.
Returns:
- result (int)