|
@@ -0,0 +1,57 @@
|
|
|
|
+## Overview
|
|
|
|
+
|
|
|
|
+The Steamworks API allows your game to take full advantage of Steam by accessing all of the underlying systems provided through the API.
|
|
|
|
+This includes things such as pausing your game when the user opens the [Steam Overlay](https://partner.steamgames.com/doc/features/overlay), inviting friends to play, allowing players to unlock [Steam Achievements](https://partner.steamgames.com/doc/features/achievements),
|
|
|
|
+letting players compete on the [Steam Leaderboards](https://partner.steamgames.com/doc/features/leaderboards) and much more.
|
|
|
|
+
|
|
|
|
+The [Steamworks API Reference](https://partner.steamgames.com/doc/api) catalogs and documents every interface, function, callback, and type supported in the API.
|
|
|
|
+
|
|
|
|
+Integration with the Steamworks API is never required to ship your product on Steam, but it is highly recommended as it allows you to accomplish many interactions that Steam users expect.
|
|
|
|
+
|
|
|
|
+## Initialization and Shutdown
|
|
|
|
+
|
|
|
|
+### SteamInit
|
|
|
|
+
|
|
|
|
+After you have the Steamworks API set up within your project you can start using it by calling #SteamInit function to initialize the API.
|
|
|
|
+This will set up the global state and populate the interface pointers which are accessible via the global functions which match the name of the interface.
|
|
|
|
+This MUST be called and return successfully prior to accessing any of the Steamworks Interfaces!
|
|
|
|
+
|
|
|
|
+The Steamworks API will not initialize if it does not know the App ID of your game. When you launch your app from Steam itself then it will automatically have the App ID available.
|
|
|
|
+While developing you will need to hint this to Steam with a text file. Create the a text file called `steam_appid.txt` next to your executable containing just the App ID and nothing else.
|
|
|
|
+This overrides the value that Steam provides. You should not ship this with your builds. Example:
|
|
|
|
+```
|
|
|
|
+480
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+A return of #False indicates one of the following conditions:
|
|
|
|
+* The Steam client isn't running. A running Steam client is required to provide implementations of the various Steamworks interfaces.
|
|
|
|
+* The Steam client couldn't determine the App ID of game. If you're running your application from the executable or debugger directly then you must have a steam_appid.txt in your game directory next to the executable, with your app ID in it and nothing else. Steam will look for this file in the current working directory. If you are running your executable from a different directory you may need to relocate the `steam_appid.txt` file.
|
|
|
|
+* Your application is not running under the same OS user context as the Steam client, such as a different user or administration access level.
|
|
|
|
+* Ensure that you own a license for the App ID on the currently active Steam account. Your game must show up in your Steam library.
|
|
|
|
+* Your App ID is not completely set up, i.e. in `Release State: Unavailable`, or it's missing default packages.
|
|
|
|
+* If you're running into initialization issues then see the Debugging the Steamworks API documentation to learn about the various methods of debugging the Steamworks API.
|
|
|
|
+
|
|
|
|
+### SteamRestartAppIfNecessary
|
|
|
|
+
|
|
|
|
+#SteamRestartAppIfNecessary checks if your executable was launched through Steam and relaunches it through Steam if it wasn't.
|
|
|
|
+
|
|
|
|
+This is optional but highly recommended as the Steam context associated with your application (including your App ID) will not be set up if the user launches the executable directly.
|
|
|
|
+If this occurs then #SteamInit will fail and you will be unable to use the Steamworks API.
|
|
|
|
+If you choose to use this then it should be the first Steamworks function call you make, right before #SteamInit.
|
|
|
|
+
|
|
|
|
+If this returns true then it starts the Steam client if required and launches your game again through it, and you should quit your process as soon as possible. This effectively
|
|
|
|
+runs `steam://run/<AppID>` so it may not relaunch the exact executable that called this function (for example, if you were running from your debugger). It will always relaunch from
|
|
|
|
+the version installed in your Steam library folder.
|
|
|
|
+
|
|
|
|
+Otherwise, if it returns #False, then your game was launched by the Steam client and no action needs to be taken. One exception is if a `steam_appid.txt` file is present then this will
|
|
|
|
+return #False regardless. This allows you to develop and test without launching your game through the Steam client. Make sure to remove the steam_appid.txt file when uploading the game
|
|
|
|
+to your Steam depot!
|
|
|
|
+
|
|
|
|
+> NOTE: If you use the Steam DRM wrapper on your primary executable file, this check is unnecessary as the DRM wrapper will perform this internally.
|
|
|
|
+
|
|
|
|
+### SteamShutdown
|
|
|
|
+
|
|
|
|
+When you are done using the Steamworks API you should call #SteamShutdown to release the resources used by your application internally within Steam. You should call this during process shutdown
|
|
|
|
+if possible.
|
|
|
|
+
|
|
|
|
+This will not unhook the Steam Overlay from your game as there's no guarantee that your rendering API is done using it.
|