Now that you have your Steamworks Partner account and your application all set up you'll need to obtain the Steamworks SDK. Since the GameMaker Studio 2 runtime is built to use specific SDKs you'll need to make sure that you are using the correct version of the SDK for the correct version of the GameMaker Studio 2 runner. This information can be found on our Required SDKs page.
NOTE: If you have not yet registered as a Steamworks Partner please see the following articles:
Once you know which version you need then navigate to https://partner.steamgames.com/downloads and select the correct version.
Once you have obtained the correct Steamworks SDK you'll need to extract it to a location which GameMaker Studio 2 can point to. It's advised you put it in a location which is easy to reach such as <drive>:\Steamworks as you'll need to access this for multiple things later in this tutorial.
Within GameMaker Studio 2, you need to open the Preferences and navigate to the Steam tab. Point the Steamworks SDK Location field to where you previously extracted the SDK:
Set Up Your Project To Work With Steam
Now that you have the Steam SDK installed, you'll need to configure your GameMaker Studio 2 project to know about Steam and communicate with the SDK. This is done by opening your Game Options on the Main window, where you'll see that it has a field for supplying the Steam ID:
Once you have added the Steam ID for the project here, you then need to open the Game Options for each of the platforms you want to target and on the General page, select the Enable Steam checkbox, as illustrated in the image below for Windows:
Uploading Your Project To Steam
Now that you have set up Steam and GameMaker Studio 2 to both communicate with each other it's time to upload your game. This is done using a tool within the Steamworks SDK which we downloaded previously.
Navigate to the Steamworks SDK folder and open the Tools folder. This contains the two sub folders Content Builder and Content Server.. Content Builder is what we use to upload our applications to Steam whereas Content Server allows us to emulate the Steam Servers but run our content locally before uploading. As we only care about the Content Builder for now, open this folder and you'll see three further folders which are important: builder (Choose the builder folder relevant for your operating system), content and scripts.
First open the relevant builder folder and then run steamcmd, this will build the steam content builder upon first run which we need for future use, although we won't need to run it specifically as we have a batch file which runs this for us. Navigate up a folder and open the scripts folder, you'll see two *.vdf files, one is relevant for your game and the other is for a specific Depot. It's highly advised that you rename each script to contain the relevant AppID or DepotID.
Open your app_build_AppID.vdf script first in a text editor, and change the AppID to your AppID as it is shown on the Steamworks site. In the depots section change the DepotID to to the relevant DepotID shown on the Steamworks site as well, and make sure that the depot script is named correctly. If you plan to upload more than one Depot then add in more lines with the correct DepotID as well as script names. Once you've finished editing this script save it, and it should look something like the following:
Open one of your depot_build_DepotID.vdf scripts and change the DepotID to your DepotID shown on the Steamworks site. Then change the ContentRoot folder location to the content folder within your Steamworks folder such as C:\Steamworks\steamworks_sdk_133b\tools\ContentBuilder\content. Next change the LocalPath to be a relevant folder such as ".\Windows_Content\*" as per the above example of a Depot. Once you've filled out all your Depot scripts correctly save them.
Navigate up a folder and now open the content folder. This is where your game content goes, based on what you put as the LocalPath in the Depot Scripts. These folders should exist here as this is where we will export our game. Open up GameMaker Studio 2 now and you'll want to compile your application for the relevant platforms. It is advised you export using the following formats:
- Windows - Compressed Applications zip
- Mac OSX - .app.zip (Note that in your Global Game Settings build for Mac App Store needs to be disabled else this will not build an App but a PKG instead)
- Linux (Ubuntu) - .zip
When you have built all your relevant compiled applications check that the contents of the .zip files are extracted within the correct content folders as this is what is uploaded to Steam. Your folders should look something like this for each platform (the exact contents may differ depending on whether you have compiled with the VM or the YYC):
Once you have the content folders ready, navigate up to the ContentBuilder folder and edit the run_build.bat file. This will run steamcmd, login with your account and run the app_build_AppID script to upload our build to Steam. First though, you'll need to edit the information within this file to match your user name, password as well as the correct app_build script:
Once the batch file has been run it will upload your build to Steamworks and you will receive a message stating whether this was successful or a failure and information about why it failed.
Assuming it was successful, navigate back to the Steamworks site and open the landing page for your application. Click on Edit the Steamworks Settings of your application and click the Builds tab. This will show you what was uploaded as well as the Depots Included. You will then need to set the app branch which allows your app to become "live":
The final task is to set up the Launch Options within the Steamworks developer console. This is found under App Admin > [YourAppName] > Installation > General section:
In the following image you can see how this should look for the three main platforms:
Once all of this has been completed, if you run your compiled executable that you just uploaded to Steam (from within the Content folder or anywhere else), it will now attempt to restart your application and run it under Steam or alternatively you can use the Content Server which was previously mentioned to get the same outcome. With all that working, your game is now integrated with the Steam API and you can begin to add in the functions you want to use (you can find out more information on the Steam API functions from the manual, here: Steam API Functions). Note that from now on when testing the game within GameMaker Studio 2 the project will connect to the Steam API too and behave the same as if it had been launched from Steam.
You can test if your game is working correctly as a Run of your application will pop up the Steam API notification depending on the platform:
IMPORTANT! When testing the Steam API integration in your games, you must have the Steam Client app open, otherwise it will not work.