App.Client
Access the Steam App system with Heathen's Steam API
Last updated
Access the Steam App system with Heathen's Steam API
Last updated
Support us as a and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our ... become a sponsor today!
This leverages the ISteamApp interface from Valve's Steam Client API and exposes every feature of that API in a C# and Unity centric way. Beyond a simple API wrapper the App.Client class provides for basic API initalizations and runs the callback update. It is possible to run Steam API without Steamworks Behaviour using only this class.
This will cause the client API from Valve's Steam API to be initialized to the App ID provided and will start a background worker to run callbacks for you.
The App interface can be used to verify ownership, check for DLC, VAC Ban and more. The main function commonly used in Unity games would be Dlc. You can fetch a list of all DLC, check for ownership of the DLC and more.
Most of this functionality is wrapped up in your SteamSettings making it even easier to leverage.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
This event is raised after the user executes a steam URL with command line or query parameters such as `steam://run/<appId>?param1=value1; while the game is already running. The new params can be queried with the GetLaunchCommandLine and GetLaunchQueryParam methods.
You would add a Listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
Called when a connections to the Steam back-end has been established. This means the Steam client now has a working connection to the Steam servers. Usually this will have occurred before the game has launched, and should only be seen if the user has dropped connection due to a networking issue or a Steam server update.
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
Called if the client has lost connection to the Steam servers. Real-time services will be disabled until a matching EventServersConnected has been posted.
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
Called when a connection attempt has failed. This will occur periodically if the Steam client is not connected, and has failed when retrying to establish a connection.
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
This is a global field located on API.App.Initalized and indicates rather or not the system is initialized.
Indicates rather or not the system is logged on to the Steam backend services. When false this indicates the system is running in "offline mode" and as a result realtime systems like Lobby, parts of Inventory and others will not funciton or will have a limited level of funcitonality.
Check if the active user is subscribed to the current App ID ... in Valve's speak this means that the active user has a license to this app.
You can call this field via
Checks if the active user is accessing the current appID via a temporary Family Shared license owned by another user.
You can call this field via
Checks if the user is subscribed to the current App ID through a free weekend.
You can call this field via
Checks if the user has a VAC (Valve Anti Cheat) ban on their account
You can call this field via
Gets the UserData for the owner of the app, if this is different than the local user then the app is being barrowed.
You can call this field via
Returns a list of languages supported by the app
You can call this field via
Returns true if a beta branch is being used
You can call this field via
Returns a list of languages supported by the app
You can call this field via
Gets the current language that the user has set
You can call this field via
Returns the metadata for all available DLC
You can call this field via
Checks whether the current App ID is for Cyber Cafes.
You can call this field via
Checks if the license owned by the user provides low violence depots.
You can call this field via
Gets the App Id of the current process.
You can call this field via
Gets the build id (aka the Build Number) of this app, may change at any time based on backend updates to the game.
You can call this field via
Gets the buildid of this app, may change at any time based on backend updates to the game.
You can call this field via
Gets the number of DLC pieces for the current app.
You can call this field via
Gets the command line if the game was launched via Steam URL, e.g. steam://run/<appid>//<command line>/. This method is preferable to launching with a command line via the operating system, which can be a security risk. In order for rich presence joins to go through this and not be placed on the OS command line, you must enable "Use launch command line" from the Installation > General page on your app.
You can call this field via
Initializes the the Steam API for client processing. If your using SteamSettings or SteamworksBehaviour this is done for you. You should only call this if you are not using SteamSettings.Initialize or SteamworksBehaviour.
Checks if a specific app is installed.
The app may not actually be owned by the current user, they may have it left over from a free weekend, etc. This only works for base applications, not Downloadable Content(DLC). Use IsDlcInstalled for DLC instead.
Checks if the user owns a specific DLC and if the DLC is installed
Gets the download progress for optional DLC.
Gets the install directory of the app if any
Returns the collection of installed depots in mount order
Parameter names starting with the character '@' are reserved for internal use and will always return an empty string. Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game, but it is advised that you not param names beginning with an underscore for your own features.
Install an optional DLC
Uninstall an optional DLC
Checks if the active user is subscribed to a specified appId.
Is the current license a time trial license
Gets the current beta branch name if any
Gets the time of purchase of the specified app
Asynchronously retrieves metadata details about a specific file in the depot manifest.
If you detect the game is out-of-date (for example, by having the client detect a version mismatch with a server), you can call use MarkContentCorrupt to force a verify, show a message to the user, and then quit.
You can check if the user is currently connected to the Steam backend as a good means to check if the user is "online" at least as far as Steam is concenred.
You can check if the user owns the current app via
There are multiple ways for a user to have legitimate access to your game however so this alone doesn't always tell the full story. For example your player may be barrowing the game from a Steam Family Sharing link.
or perhaps you offered your game via a free weekend promotion
Time trials are another option
Your game could be, being played via a Cybercafe
Finally you may just want to see who the proper owner of this license is
If the owner doesn't match the current user then you know several things
The local user is interested in game and has either barrowed it from a family member, is playing it via a promotion such as a free weekend or is playing it at a Cybercafe
The local user is authenticated to Steam and has a legit path to play your game
The owner of the game has in one way or another promoted your game for you ... you could use that to drive a reward system or simply make note of it for your own marketing
Check when the user first purchased the game (or any app), if you get a date back from the 70s then they purchased the game before Steam started tracking ... or they never purchased the game.
The App interface can check the local user's VAC Ban status via
The App interface is able to list the available languages for this app from Steam
You can also fetch the current game language
The App interface can check if the current build is a beta and if so which one.
Alternatively
Typically you would have done this at development time but you can query for a list of all DLC available to this app at run time.
The returned DownloadableContent objects can further be used to check for ownership and install of a given DLC. Again you would typically do this from your Steam Settings which will already have this information to hand but this can be useful when you want or need to check DLC availability at runtime.
You can also check for ownership of any related app ID
While most modern DLC dont need to install, typically a game always contains all of its content especially if its multiplayer. DLC ownership typically only unlocks the content for the player. That said a DLC is an app and can download new content ... to check for the install of that content use:
Even if your DLC is empty it can still be useful to test this to see if they have the DLC enabled. Some gamers will disable DLC to play the vanilla version that would cause ownership to be true but install to be false.
DLC can be installed or uninstalled from within game, to check the status of the install/download progress use:
To start a DLC install process
You can monitor the installed event to know when the install is complete
To uninstall a DLC
You can also use the App interface to check for depot and file data for a given app.
Understanding where an app is installed can be of use
Getting a list of the depots that are installed for an app can be done with:
You can return the command line the app was launched with
Getting a specific launch parameter can be done with :
While rare it is possible that the user would have tried to relaunch the game with different launch parameters. You can monitor the new URL launch parameters event to react to this case.
Many online games require that the game is up to date, you can fetch the details of a particular file.
If you detect that an update is needed you can mark the project as corrupted forcing Steam client to check for and download the content as needed
This event is invoked when a DLC is installed and has a single parameter of type DlcInstalled_t
. The type DlcInstalled_t
is defined by .
This event has a single parameter of type NewUrlLaunchParameters_t
which is defined by .
You can read more about the .
You can read more about the .
The events and will be invoked as the connection is gained or lost respectively.