Connecting to Steam with Unreal Engine 4

March 8, 2020

Connecting Unreal Engine 4 to Steam seems way harder than it should be, and there are plenty of conflicting resources online. This guide will walk through the steps that are necessary to implement Steam in your game.

Enabling Steam for Blueprints

As of 2.24, the steps to take:

  1. Create a fresh project.
  2. Open the Editor, and enable the Online Subsystem Steam plugin. (The Online Subsystem plugin should already be enabled.)
  3. Copy and paste the following code (sourced here) into the bottom of DefaultEngine.ini, found in your project's Config folder:
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
  1. Start the Steam client. (It just needs to be running in the background, and you need to be logged in.)

That's it - now the Steam backend is initialized.

As of (at least) 2.24, you don't need to manually install the Steamworks SDK, despite what the official documentation says, as it is already included with the Unreal Engine 4 binary installation. Confirm this by going to your Unreal Engine 4 install directory and ensuring that the Steamworks binary is in there. I found mine at D:/EpicGames/UE_4.24/Engine/Binaries/ThirdParty/Steamworks/Steamv146. The version number shouldn't matter - presume that Epic is taking care of keeping us up to date.

Add C++ Access

To work with Steam in C++, follow the above steps and then add public dependencies to your project's build.cs file (or the respective build.cs file for the module you're working in):

PublicDependencyModuleNames.AddRange(new string[] {"OnlineSubsystem", "OnlineSubsystemSteam"});

You can only test Steam functionality (i.e. multiplayer) outside of the Editor. The easiest way to do this is by opening a Standalone Game. Click the dropdown next to the Play button in the Editor, and you should see this option. Press Shift+Tab once the game opens, and you should see the Steam overlay.



© 2021 Mustafa Moiz.