steamintegration

In this post we’re going to integrate Steam into the Third Person C++ Project Template that comes with UE4. The end result is shown in the picture above.

Download the source code from my github repo

Requirements

In order to integrate Steam in your game, you need to download the Steamworks SDK and have steam as a client, installed in your PC. Keep in mind that you can integrate the required SDK even if your game is not officially greenlit yet. Steam provides a sample game, named Spacewars which contains all the features offered in its SDK. In the end result, Steam is going to recognize your game as Spacewars. This post was written in 4.14 version, in case you’re using a different version of the engine the following workflow might differ a bit.

Please note that in 4.14 version of the engine, Steamworks 1.32 is included. You don’t have to download the latest SDK if that version offers all the required features you wish to include in your game.

Modifying your engine – Skip this step if you’re using the included Steamworks version

Once you have the latest Steamworks SDK, copy and paste the “sdk” folder in the following path:

[Your_EpicGames_Path]\Engine\Source\ThirdParty\Steamworks\Steamv132

and rename the Steamv132 to SteamvXXX where XXX equals the latest SDK number. Then, open up the Steamworks.build.cs file which is located in the following path:

[Your_EpicGames_Path]\Engine\Source\ThirdParty\Steamworks\

and make sure to edit the following line to match your current version:

Adding the necessary Binaries

At this point, you need to add certain binaries to our engine. To do that, go to [Your_EpicGames_Path]/Engine/Binaries/ThirdParty/Steamworks/SteamvXXX and you will notice that there are two folders, named Win64, Win32. We need to add certain binaries in each folder.

Inside Win64, add the following files:

  • steam_api64.dll (in case you’re using an updated Steamworks SDK – this file is included inside the redistributable_bin folder that is located inside the sdk folder you’ve downloaded through steam)
  • steamclient64.dll (this file is located inside your steam’s client installation folder)
  • tier0_s64.dll (this file is located inside your steam’s client installation folder)
  • vstdlib_s64.dll (this file is located inside your steam’s client installation folder)

Inside Win32, add the following files:

  • steam_api.dll (in case you’re using an updated Steamworks SDK – this file is included inside the redistributable_bin folder that is located inside the sdk folder you’ve downloaded through steam)
  • steamclient.dll (this file is located inside your steam’s client installation folder)
  • tier0_s.dll (this file is located inside your steam’s client installation folder)
  • vstdlib_s.dll (this file is located inside your steam’s client installation folder)

Adding Steam support in your game

At this point, you’re ready to add Steam support in your game. To do that, open up the [YourProjectName].Build.cs file and add the following code:

Then, inside [YourProjectName].Target.cs file, tell your project that you’re using steam:

The last thing we need is to add specific settings to DefaultEngine.ini which is located inside the Config folder of your project:

At this point, to test your game’s Steam functionality, you can either enable the Online Subsystem Steam plugin (found in Online Platform category) from within the editor and launch a Standalone version of your game or you can package your game and then try playing. Please note that in both cases, you need to be logged into your Steam account.

In any case, Steam will detect that you’re play Spacewar (since we used Spacewar’s DevAppId for this project) overlay by pressing Shift + Tab:

steamintegration

In the next part, we’re going to integrate Steam Achievements in our game too, so stay tuned!

Share postShare on Facebook10Tweet about this on TwitterShare on LinkedIn0Share on Reddit26