Facepunch.Steamworks Wiki

Steamworks.SteamServer

Provides the core of the Steam Game Servers API

Events

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<Result> OnSteamServersDisconnected
Disconnected from Steam
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 GameDescription { get; }
Gets or sets the current Product
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 IsValid { get; }
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 string MapName { get; set; }
Gets or sets the current Map Name.
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 string ModDir { get; }
Gets or sets the current ModDir
static bool Passworded { get; set; }
Set whether the server should report itself as passworded
static string Product { get; }
Gets the current product
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.
static string ServerName { get; set; }
Gets or sets the current ServerName
static SteamId SteamId { get; }
Gets the Steam ID of the server. A Steam ID is a unique identifier for Steam accounts, Steam groups, Servers, Lobbies and Chat rooms, and used to differentiate users in all parts of the Steamworks API.

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 ClearKeys()
Remove all key values
static void EndSession( SteamId steamid )
Forget this guy. They're no longer in the game.
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)
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 LogOff()
Log onto Steam anonymously.
static void LogOnAnonymous()
Log onto Steam anonymously.
static void RunCallbacks()
Run the callbacks. This is also called in Async callbacks.
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 Shutdown()
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.
Does the user own this app (which could be DLC)