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.
As of 2.24, the steps to take:
[/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"
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.
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 thePlay
button in the Editor, and you should see this option. PressShift+Tab
once the game opens, and you should see the Steam overlay.