Online Subsystem Steam
Information contained here pertains specifically to the Steam implementation. Any additional setup steps, tips & tricks, and workarounds can be found here.
The Steam module implements most of the interfaces exposed through the online subsystem and supports most of what Valve offers through the Steamworks SDK.
Matchmaking (Lobbies / GameServer APIs)
All games must have a valid Steam App ID. During development, this App ID is exposed to the SDK via a file called steam_appid.txt which must reside in the same directory as the executable. The file is generated by Unreal Engine at launch and deleted during graceful shutdown of the engine. This makes it unnecessary to launch the game via the Steam client (although it must be running). The file should not be included in any Steam images.
In shipping builds, the engine will also check to make sure the logged in user is properly subscribed to the game and will shutdown the engine if not. This is but one way to help secure the game. Using Steam DRM (see the Steamworks SDK) should further protect the game from tampering.
The Steam subsystem requires some additional setup through Valve. Contact Valve and use their documentation to make sure you are setup on their end before attempting to use Steam in the Unreal Engine.
Installing the Steamworks SDK
For legal reasons, using Steam requires downloading the latest SDK from Valve. Currently this is v1.29a, but any future update should be a straightforward change to the path name. See Steamworks.build.cs in the ThirdParty/Steamworks directory
Using Steam against the precompiled version of the engine should only require copying some of the DLLs from Valve's SDK into the appropriate places. If you intend to recompile the engine against the source, putting the SDK in the right place is required as well.
The SDK needs to be unzipped/copied to this path
Find the following binaries from the /redistributable_bin/ directory of the SDK and copy them to their noted locations.
Note: Some of the 64bit dlls can be found in your normal Steam client directory. Valve for some reason does not include all of them in the SDK.
libsteam_api.dylib (from /redistributable_bin/osx32 - single dylib has both 32 and 64 bit support)
If you are compiling the entire engine, you will want to modify the following line in OnlineSubsystemSteam\Private\OnlineSubsystemSteamPrivatePCH.h
define STEAM_SDK_VER TEXT("Steamv130")
to make sure it references the new SDK directory location / version
Turn on some settings in the game's
The SteamDevAppId of 480 is Valve's test app id, shared by everyone. You will need your own app id eventually, but most features of Steam should work before then.
[/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"
Make sure to include the Unreal Engine Steam module as part of your project. (see 虚幻引擎编译系统的目标文件 for additional help)
Adding the following should be enough to make sure that the Steam module is built along with your game. It goes inside the constructor of mygame.build.cs
Steam Overlay on Mac
Contrary to Windows, Steam Overlay on Mac requires game to be launched using Steam client. For this you first need to add the game to your library using "Add a Non-Steam Game to My Library" option from Steam's Games menu.