Co-op Sessions¶
Summary: Two players play together over Steam: one hosts their own running game as a listen server and invites a friend. In the demo and playtests (saved characters off) the friend joins as a preset: the host loads it read-only by path and nothing is saved on either side. With saved characters on, the friend brings one of their own saved characters instead, which travels as a compressed save that the host loads and snapshots back.
UCoopSessionSubsystemowns the session (Steam lobby, runtimeListen, join, leave) and the co-op panel is its UI. Connections run over SteamSockets (relay, no ports or IPs), so it works on the Steam Deck too. Solo never depends on any of it: without Steam the game plays solo and co-op is simply not offered.
Table of Contents¶
- Why This Architecture
- The Steam Stack
- Session Lifecycle
- Invites and the Character to Bring
- Joining, Leaving and Failures
- Two-Player Game Rules
- The Co-op Panel
- Testing Co-op
- Source References
- Related Systems
- Recent Changes
Why This Architecture¶
- 1.0 is Steam-only, offline plus two-player co-op (join any time, shared clears). Dedicated servers come later and are used for internal tests only.
- Playing with a friend is one invite away, with no ports, IPs or server browser, and it must work on the Deck.
- Solo-first: nothing in the solo path may depend on Steam networking, a lobby or a friend. A solo game starts as a
standalone world and only starts listening when the player opens it to a friend (runtime
Listen). - The host owns the world, each player owns their character. The host's run, map and clears are the session's; the guest's character is the guest's own save, brought in and handed back.
- Presets only for the demo (owner, 2026-11-06): playtesters and demo players join as a preset, known by their Steam
account. Copying a preset into a saved character to join confused everyone and skipped the preset's authored start.
One switch,
UPersistenceDevSettings::bSavedCharacters(off inDefaultGame.ini), hides saved characters everywhere: the War Table lists presets only and the co-op panel offers presets only. The save code stays for 1.0.
The Steam Stack¶
| Piece | What it does |
|---|---|
OnlineSubsystemSteam |
Lobbies (bUsesPresence + bUseLobbiesIfAvailable), invites, +connect_lobby cold starts, friends. DefaultPlatformService=Steam, Null as the automatic fallback without Steam |
SteamSockets plugin |
SteamSocketsNetDriver on ISteamNetworkingSockets: relayed P2P with NAT traversal and encryption. A host listens on <SteamID>:7777; guests connect to steam.<SteamID>:7777 |
CoopSteamworks.cpp |
The module's one direct Steamworks link, for the few facts the subsystem does not expose: overlay hooked, relay status, running on a Deck, and a friend's lobby build |
Settings that matter (Config/DefaultEngine.ini, Config/Windows/WindowsEngine.ini):
- bUseSteamNetworking=False. True makes SteamSockets the default socket subsystem, so an IpNetDriver forced for a
dedicated test gets Steam sockets and fails. The SteamSockets driver asks for its subsystem by name, so co-op works.
- bInitServerOnClient off. With it on, a second Steam process on one PC failed the game-server init and shut the whole
Steam subsystem down. Lobbies and SteamSockets need only the client API.
- No SteamAuthComponentModuleInterface packet handler: it broke a Steam client joining a server without Steam, and
SteamSockets already authenticates the peer's Steam identity.
- Internal dedicated tests: a client with -NetDriverOverrides=/Script/OnlineSubsystemUtils.IpNetDriver joins an IP
server. The override is compiled out of Shipping; Shipping playtests use the IpNet custom config (staged binary config).
AppId 5091420. A packaged game quits when the signed-in account does not own the app.
Session Lifecycle¶
UCoopSessionSubsystem (game instance, never on a dedicated server) runs a pure state machine
(FCoopSessionMachine, rules in FCoopRules, CoopSessionTypes.h):
Host: Idle -> Hosting (lobby open) -> Together (guest in) -> Hosting (guest left) -> Idle (End co-op)
Guest: Idle -> Joining -> Together -> Leaving -> Idle (back in its own game)
- Availability is evaluated on every call: Steam present and signed in online.
GetUnavailableReason()says why not; the game menu hides its Co-op entry then. - Hosting needs a running game of the player's own (not the menu, not as a guest): runtime
Listenon the running world, then a two-slot lobby carrying the build id. A world opened for a lobby admits remote players only while the lobby is open (AEternalGameMode::PreLoginasksAcceptsRemotePlayers). - Friends Can Join (remembered setting, off by default): while on, every game of the player's own opens a friends-joinable lobby and Steam's friends list offers Join Game. Ending co-op turns it off.
- The host counts its remote players rather than trusting login/logout order, which a rejoin overlaps.
Invites and the Character to Bring¶
- Sending: the panel's friends list (friends in the game first),
ShowInviteOverlay(Steam's own dialog; only when Steam started the game), or Join Game on a friends-joinable lobby. A friend's row reads "Invite sent" until the lobby closes or a guest has come and gone. - Receiving: an invite accepted in Steam is caught in
Initialize(so+connect_lobbyat a cold start works too). It never joins on its own: in a game, at the menu or at a cold start it stops at the same confirm, Join / Not Now / Bring:, because accepting in Steam says "take me there", not which character goes or "throw away my run". An invite at the menu waits for any modal on screen to close first. - Who joins, saved characters off (
FCoopPanelRules::BuildJoinPresetChoices): Join as:. From a game, the preset in play and nothing else; at the menu, any preset the War Table lists, the War Table's own picked. Nothing is written. A join with no choice made (Steam's Join Game) takes the same preset ( ResolveJoinPreset). - The character to bring, saved characters on (
FCoopPanelRules::BuildBringChoices): the player's saved characters, then New character () made from the preset being played, else from the War Table's starter preset. Picked by default: the character in play; the new one while a preset is played or when nothing is saved; else the one saved last. A new character is written by the roster (CreateCharacterFromPreset) only when the player presses Join. - Version check: the lobby carries the build id. The online subsystem drops a lobby of another build before the game
sees it;
FailJoinThatWasNotReadreads the friend's lobby build through Steam so the player is told "runs a different version of the game." rather than that the game ended.
Joining, Leaving and Failures¶
- Joining saves the run being left, then travels (
SetClientTravel), with the character id in the URL for a saved character. A preset join puts nothing in the URL: the guest sends the preset's path (Server_PlayPreset), the host accepts only a shippedCharacterPreset, plays it read-only with its kits and gives its items new instance ids, so two players on one preset never hold the same item. The preset's own start follows, a Remnant left by the bearer included. The host holds the joiner until its own machine shows the host's world (fixed level, dungeon layout, lighting, realm), spawns it beside the party, and gives short spawn protection. Ordering details: Spawn & Transition Ordering. - The character goes to the host as compressed, checked chunks; the host restores it (
brought character …) and writes the guest's snapshot back to the guest's own file every minute and at every leave. Saves: Persistence. - Leaving: a guest's Leave has the host write its last snapshot, then the guest goes home into its own game with the
character it brought. A host's End co-op flushes the guest ("The host ended co-op. Your progress was saved."), closes
the lobby and plays on. Quitting or returning to the menu with a guest in does the same, behind the "Saving" mark.
A preset guest has nothing to wait for: it leaves at once, without the mark, and lands on the War Table (owner,
2026-11-06), as it does when the host ends co-op ("The host ended co-op.", told by
Client_HostEnding) or the link is lost ("Lost connection to the host."). - A lost peer is noticed by SteamSockets' own timeout, ~15.5 s. The guest lands home with "Lost connection to the host. Progress saved at HH:MM".
- Rejoining after a crash: the host lets the old connection go when the same player comes back: a saved character by
its id, a preset guest by its Steam id (
AEternalGameMode::PreLogin). - Failures end the attempt with an
ECoopErrorand a player-facing line (OnError): Unavailable, NotInGame, WrongState, ListenFailed, LobbyFailed, InviteFailed, VersionMismatch, LobbyFull, JoinFailed, NoHostAddress, ConnectionLost, HostEnded, FriendsUnavailable.
Two-Player Game Rules¶
| Area | Rule |
|---|---|
| Journey | Only the host travels, clears, counts and liberates. Either player's exit portal clears the node for both; both are told |
| Travel | The party moves together; a guest's map is read-only and follows the host's |
| Realms | The whole party enters after a 3 s warning and leaves together; a realm wipe fails the event (a preset starts it again) |
| Downed | A player at 0 health is downed with a 25 s bleed-out (paused while being revived); a partner's revive channel restores 30% health; a hit interrupts it. No heals while down. Enemies let go of a downed player and turn to anyone else they perceive; one left with no target turns back to them when they stand. Numbers: UCoopDefeatSettings |
| Death | A bleed-out sits out the current fight until its encounter gate opens; both down reloads the node; solo death is unchanged. Leaving while down counts as the bleed-out. A preset player (host or guest) still goes down and is revived, but a bleed-out or a wipe respawns at the level's start with the world as it stands; nothing reloads (owner, 2026-11-06) |
| Realm death | Alone: back at the realm's start. With a partner standing: out until the realm ends, so one player can still save it; the boss fight goes on. The whole party down fails the realm. In a preset the whole party down instead stands everyone at the realm's start with the boss reset, as alone (owner, 2026-11-09): a preset is the demo, and the realm is its finale |
| Loot | An item a player drops belongs to the room that player stands in; realm drops follow membership |
| Vendors | Each player buys from a stock of their own, replicated to that player only |
| Targeting | A partner is never a player's lock, aim or auto-acquire target |
| Dev powers | A guest's cheats run in the host's game only after the host grants them (Eternal.Coop.GuestCheats); refused ones are logged on the host |
The Co-op Panel¶
UCoopSessionController → UCoopSessionViewModel → W_CoopPanel (WidgetForge), opened from the game menu's Co-op entry
or by an incoming invite. The view is built by the pure FCoopPanelRules::Build from FCoopPanelInputs (specs in
ProjectEternal.Unit.Coop). Gamepad-first: every screen works with pad keys alone. Toasts announce joins, leaves and
clears; a node clear is told to both players.
Testing Co-op¶
- Specs:
ProjectEternal.Unit.Coop(session rules, panel rules, bring and preset choices, defeat rules for a preset party),ProjectEternal.Persistence.CoopSnapshot(end messages with and without saving); functional replication tests (CoopJoinReplicationTest,CoopDeathReplicationTest,VendorStockReplicationTest) through the project's own runner. Listen-host PIE proves nothing about the guest: acceptance is two machines through Steam, one of them the Deck. - Two machines over Steam: two Steam accounts that are friends, the same packaged Development kit on both
(
Tools/cook_local.ps1). An invite can be accepted on the receiving machine by openingsteam://joinlobby/5091420/<lobby>/<host SteamID>throughsteam.exe(the host logs the lobby id). If the guest logsFindLobbiesForInviteSession … failed in 15 s, that machine's Steam cannot read lobbies at the moment: swap the roles. After a code-only change, copying the newProjectEternal/Binariesover a kit is enough. - Driving a packaged game by console: start it with
-ExecCmds="Eternal.Dev.After 8 DEFER exec ../../Binaries/../Saved/drive/poll.txt", wherepoll.txtholdsexec ../../Binaries/../Saved/drive/inbox.txtand the sameEternal.Dev.After 1 DEFER exec …/poll.txtline; write commands intoinbox.txtand clear it after one poll. The path must contain "Binaries": the local player'sexecprefixes../../Binaries/to any other path.Eternal.Coop.UI key|dump|shotdrives and reads the panel. - The Deck: a devkit-launched build gets the shortcut's own AppId and runs without Steam
(
SteamAPI failed to initialize: ConnectToGlobalUser failed). Register the shortcut withforce_appid5091420 andenv {"SteamAppId": "5091420"}(~/devkit-utils/steam-client-create-shortcut). - Checks without a second account:
-nosteam(co-op off, solo plays),-BuildIdOverride=<n>(a different build for the version message),-NetDriverOverrides=/Script/OnlineSubsystemUtils.IpNetDriverinto a-server -nosteamworld. - Dev commands (
Eternal.Coop.*, non-shipping): Host, Friends, Invite, InviteOverlay, JoinFriend, AcceptInvite, DeclineInvite, Leave, Status, StatusEvery, Listen, Travel, RealmPortal, ReloadNode, RealmExit, Spread, PartnerFalls, ReviveGuest, Where, GuestCheats;Eternal.Roster.New|List|Delete,Eternal.PlayPreset,Eternal.PlaySave,Eternal.JoinAsCharacter <address> [CharacterId].
Source References¶
| File | Purpose |
|---|---|
Public/Coop/CoopSessionSubsystem.h |
Session: lobby, listen, invites, join, leave, errors |
Public/Coop/CoopSessionTypes.h |
State machine, rules, errors, FCoopFriend |
Private/Coop/CoopSteamworks.cpp |
Direct Steamworks facts (overlay, relay, Deck, friend lobby build) |
Private/Coop/CoopSessionCommands.cpp |
Eternal.Coop.* dev commands |
Public/UI/Controllers/CoopSessionController.h |
Panel controller: friends, confirms, bring choices |
Public/UI/ViewModels/Coop/CoopPanelView.h |
Pure panel rules and bring choices |
Public/Persistence/CharacterRosterSubsystem.h |
Saved characters, new characters from presets |
Public/Persistence/Components/PersistenceComponent.h |
Guest upload, restore and snapshots |
Related Systems¶
- Replication Overview · Server Authority
- Spawn & Transition Ordering
- Persistence
- World Map System
- Plans:
ImplementationDocs/CoopSessionFlow.plan.md,ImplementationDocs/CoopLocalSaves.plan.md,ImplementationDocs/RemnantCoopMultiplayer.plan.md
Recent Changes¶
- 2026-11-06: presets-only co-op for the demo (
ImplementationDocs/PresetCoop.plan.md): saved characters off by one setting, a guest joins as a preset, nothing written, preset guests land on the War Table, item ids re-keyed per guest. - 2026-10-21: page written at the end of the co-op session flow work (Steam lobbies, SteamSockets, invites with the character to bring, join any time, downed and revive, per-player vendor stock, Deck verified).