Steamworks.SteamServer
Provides the core of the Steam Game Servers API
Events
static event Action<SteamNetworkingAvailability> OnSteamNetAuthenticationStatus
This will run several times while the server is authenticating with Steam. When the supplied availability is equal to SteamNetworkingAvailability.Current, the server has been assigned a SteamId and SteamServer.SteamId is available.
static event Action<Result, bool> OnSteamServerConnectFailure
This will occur periodically if the Steam client is not connected, and has failed when retrying to establish a connection (result, stilltrying)
static event Action OnSteamServersConnected
Called when a connections to the Steam back-end has been established.
This means the server now is logged on and has a working connection to the Steam master server.
static event Action<SteamId, SteamId, AuthResponse> OnValidateAuthTicketResponse
User has been authed or rejected
Properties
static int AutomaticHeartbeatRate { set; }
Set heartbeat interval, if automatic heartbeats are enabled.
You can leave this at the default.
static bool AutomaticHeartbeats { set; }
Enable or disable heartbeats, which are sent regularly to the master server.
Enabled by default.
static int BotCount { get; set; }
Gets or sets the current BotCount.
This doesn't enforce any kind of limit, it just updates the master server.
static bool DedicatedServer { get; set; }
Sets whether this should be marked as a dedicated server.
If not, it is assumed to be a listen server.
static string GameTags { get; set; }
Gets or sets the current GameTags. This is a comma seperated list of tags for this server.
When querying the server list you can filter by these tags.
static bool LoggedOn { get; }
Returns true if the server is connected and registered with the Steam master server
You should have called LogOnAnonymous etc on startup.
static int MaxPlayers { get; set; }
Gets or sets the current MaxPlayers.
This doesn't enforce any kind of limit, it just updates the master server.
static System.Net.IPAddress PublicIp { get; }
To the best of its ability this tries to get the server's
current public ip address. Be aware that this is likely to return
null for the first few seconds after initialization.
Methods
static bool BeginAuthSession( byte[] data, SteamId steamid )
Start authorizing a ticket. This user isn't authorized yet. Wait for a call to OnAuthChange.
static void ForceHeartbeat()
Force send a heartbeat to the master server instead of waiting
for the next automatic update (if you've left them enabled)
static bool GetOutgoingPacket( Data.OutgoingPacket packet )
If true, Steam wants to send a packet. You should respond by sending
this packet in an unconnected way to the returned Address and Port.
static void HandleIncomingPacket( System.IntPtr ptr, int size, uint address, ushort port )
We have received a server query on our game port. Pass it to Steam to handle.
static void Init( AppId appid, SteamServerInit init, bool asyncCallbacks = True )
Initialize the steam server.
If asyncCallbacks is false you need to call RunCallbacks manually every frame.
static void SetKey( string Key, string Value )
Sets a Key Value. These can be anything you like, and are accessible
when querying servers from the server list.
Information describing gamemodes are common here.
static void UpdatePlayer( SteamId steamid, string name, int score )
Update this connected player's information. You should really call this
any time a player's name or score changes. This keeps the information shown
to server queries up to date.
static UserHasLicenseForAppResult UserHasLicenseForApp( SteamId steamid, AppId appid )
Does the user own this app (which could be DLC)