Add Steam yourself¶
The template does not ship Steam. It plays over the local network and
by direct IP address, with the engine's Null online subsystem. Steam
plugs in at three places: two engine plugins, a few lines of Config/DefaultEngine.ini and two
check boxes on each of two session nodes.
Nobody has run these steps with version 1.0: they follow Epic's documentation for Unreal Engine 5.8 (Online Subsystem Steam and Using Steam Sockets), so take them as a starting point and test on two PCs before you rely on them.
Before you start¶
- Two PCs, each with the Steam client running and signed in, with two different Steam accounts. Steam sessions cannot be tested with one account on one PC.
- The tools to package a build: Visual Studio's C++ workload and a Windows SDK. Steam never starts in Play In Editor, so the real test is a packaged build on both PCs.
- For a release, your own Steam AppID from Steamworks. AppID 480 (Valve's Spacewar test app) is enough to test.
How the template finds games¶
All session logic is in one Blueprint, Content/ZombieSurvival/Blueprints/Core/BP_ZSGameInstance.
The widgets only call its events.
Event in BP_ZSGameInstance |
Engine node it calls | Used by |
|---|---|---|
CreateHostSession |
Create Session, with Public Connections = MaxPlayers |
HOST, then START |
FindLanSessions |
Find Sessions, with Max Results = LanSearchMaxResults |
JOIN and REFRESH |
JoinPendingSession |
Join Session | a click on a game of the list |
JoinByAddress |
Open Level (by Name) on an IP address | the address field of JOIN |
LeaveSession |
Destroy Session | every return to the main menu |
MaxPlayers and LanSearchMaxResults are in
Content/ZombieSurvival/DataAssets/Session/Childs/DA_Session_Default. The session nodes speak to
whatever subsystem is active, so adding Steam is mostly configuration.
Steps¶
1. Enable the two plugins¶
- Open the project, then Edit > Plugins.
- Search Online Subsystem Steam (category Online Platform) and tick it.
- Search Steam Sockets (category Networking) and tick it. It needs Online Subsystem Steam and enables it with it.
- Restart the editor when asked.
2. Point the engine at Steam¶
Close the editor. Open Config/DefaultEngine.ini in a text editor and find this block:
Replace it with:
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
Keep the [/Script/OnlineSubsystemUtils.IpNetDriver] block that follows in the file: it still
applies when the game falls back to IP.
The fallback differs from Epic's Using Steam Sockets page
That page writes the fallback as /Script/SteamSockets.SteamNetSocketsNetDriver, and no class
of that name exists in the Unreal Engine 5.8 source: a game started without Steam would have no
network driver at all. With IpNetDriver, the fallback of Epic's Online Subsystem Steam page,
the game still hosts and joins over IP when Steam is not there.
!NetDriverDefinitions=ClearArray is in Epic's example. It also clears the engine's beacon and
replay drivers, which the template does not use.
3. Search Steam instead of the local network¶
- Open
Content/ZombieSurvival/Blueprints/Core/BP_ZSGameInstanceand its EventGraph. - Find the custom event
CreateHostSessionand its Create Session node. As shipped, Use LAN is ticked and Use Lobbies If Available is not: untick the first and tick the second. - Find the custom event
FindLanSessionsand its Find Sessions node. In the same way, untick Use LAN and tick Use Lobbies. - Compile and Save.
The Join Session node (under JoinPendingSession) and the Destroy Session node have no such
option. Do not rename FindLanSessions: the Join menu calls the event by that name.
With lobbies on both sides, Epic's page says the Steam setting bInitServerOnClient is not needed.
4. Make room in the search results while you use AppID 480¶
AppID 480 is shared by every developer who tests with it. Steam returns the lobbies of all of them, and the engine then drops those of another build. With the template's 20 results, other people's games can push your host out of the list.
Open DA_Session_Default and raise LanSearchMaxResults, for example to 200.
5. Keep the version in step¶
The host refuses a player whose game version differs. The version is ProjectVersion, in
Edit > Project Settings > Description (Config/DefaultGame.ini). Package both PCs from the same
project, and increase it at each build you hand out.
6. Package a Development build¶
Package for Windows in the Development configuration, and copy the packaged folder to the second PC.
A Development build writes steam_appid.txt by itself, next to the game's executable
(Windows/ZombieSurvival/Binaries/Win64/), from SteamDevAppId, and deletes it when the game
closes. If the log says it could not create it, create it by hand in that folder, with the single
line 480.
Check that it works¶
- On both PCs, start Steam and sign in, each with its own account.
- On PC 1, start the game. HOST, pick a world, START. The Steam overlay should be available (Shift + Tab).
- On PC 2, start the game. JOIN, then REFRESH. The host's game appears in the list.
- Click it. PC 2 loads the world and, the first time, opens character creation.
If both survivors see each other move, open doors and pick up items, co-op runs over Steam.
If it does not work¶
- The game starts without Steam: check that the Steam client runs before the game. In the game's
log (
Saved/Logs/of the packaged game), look for lines starting withLogOnlineandLogSteamShared. - The list stays empty: both PCs must run the same build (same
ProjectVersion) and the same AppID. RaiseLanSearchMaxResults(step 4). Steam's default lobby search also keeps to nearby regions. - Join by address does nothing: the address field joins by IP. Over Steam, join from the list. Epic notes that Steam Sockets builds only connect to other Steam Sockets builds, and joining one by IP is not tested.
- It works in the editor but not packaged, or the opposite: Play In Editor never starts Steam. The editor's Standalone Game mode does, on one PC.
When you have your own AppID¶
- Replace
SteamDevAppId=480with your AppID. - Put
LanSearchMaxResultsback to a small number. - Do not ship a
steam_appid.txtin your Steam depots. A Shipping build does not write one: Steam itself starts the game with your AppID, and checks that the signed-in account owns it. - Start Shipping builds from Steam. The engine can make a Shipping build relaunch itself through
Steam when it is started from its folder, but that AppID is a C++ build setting
(
UE_PROJECT_STEAMSHIPPINGID), which a Blueprint project leaves at 0.
What this does not change¶
Hosting, saving, chat, host commands, PvP safety and the password work as before. They belong to the template, whatever the subsystem.
The template has no Steam friends list, invites, rich presence or overlay join: the engine's Blueprint session nodes do not expose them, and they need C++ or a plugin. Achievements, stats, cloud saves and Steam authentication are not wired. Epic Online Services are not covered: they need product credentials of your own and an integration that goes beyond Blueprint alone.