Add an experimental co-op through Steam: rooms, invites, names in the world, chat and shared progress.

Up to four players, each in their own game and save, meet in a room. Rooms are Steam lobbies and the games talk through Steam's networking, so nobody forwards a port and nobody runs a server. The game signs in to Steam as its test app (480), so Steam shows the player as playing Spacewar. Off by default; the menu has a Co-op tab with Create a room, Join a room by its ID, Invite a friend, the players, chat and Leave, in English, Russian, Brazilian Portuguese and Simplified Chinese.

runtime/steam.c loads steam_api64.dll from beside the exe at run time and declares the C functions it calls itself; nothing of the Steamworks SDK is in the repository, and a player copies the file from a Steam game they have. runtime/coop.c is the room: the lobby's owner is the host, lets games of the same protocol and game build in and lists them, and every game takes positions, chat and progress only from the players on that list. runtime/coop_game.c reads Link from the Player actor and shares progress, items, songs and quest items through the game's own flag routines, each value only ever raised; small keys, rupees, ammunition and hearts stay each player's own, and the save is copied to coop-backup before anything of a room reaches it. The other players show as a name with a distance where their Link stands, projected with the upscaler's camera.

One Steam account cannot be in a lobby twice, and this PC has not the memory for two games, so the room and the game side were run with one game and tests/coop_peer.py as the second player over runtime/coop_local.c, a stand-in for Steam on 127.0.0.1 that only the environment turns on: the peer was let in, saw the game's Link in Hyrule Field, chat went both ways, the save was copied, one flag the save lacked was set and a flag the game does not share was refused. On Steam itself one game signed in as app 480, made a room, showed its ID and the player's Steam name on the Co-op tab and left. Not run: two Steam accounts in one room, an invite, a join by room ID over Steam, a host that leaves, a removal, and the menu's text probe on this build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
epicmeme546
2026-11-13 04:16:17 -05:00
parent c84c035939
commit cd2f9f12be
29 changed files with 3638 additions and 17 deletions

View File

@@ -19,6 +19,20 @@
`replay_pipe = 4`, 63.2 with `replay_small = 16` added, against 45.4 with all four settings off. The pictures matched
there and through warps to five areas.
## New
- **Experimental: co-op through Steam** (the menu's new Co-op tab; off by default; `coop = 1` in nx2navi.ini). Up to
four players, each in their own game and save, meet in a room: *Create a room* gives a room ID to pass on, *Join a
room* takes one, and *Invite a friend* sends a Steam invite. Nobody forwards a port and nobody runs a server: rooms
are Steam lobbies and the games talk through Steam's network. NX2navi signs in to Steam as its test app, so Steam
shows you as playing Spacewar. In a room you see the other players' names where their Link stands (with DLSS, FSR
or TAA on), you can chat, and progress is shared: story, chests, doors, items and songs count for everyone, while
small keys, rupees, ammunition and hearts stay each player's own. Your save is copied to `coop-backup` in the
profile folder before anything of a room reaches it. It needs Steam running and Steam's library file
`steam_api64.dll` beside `ocarina.exe` (copy one from any recent Steam game's folder; NX2navi may not ship it). Not
yet: the other players as a Link model, shared enemies, and invites that start the game for a friend who has it
closed. Everyone needs the same NX2navi version. `docs/coop.md` has the details and how to go back to a save.
## Changed
- **The draw replay on several CPU cores is off by default again** (`replay_workers = 0`). With three workers on by
@@ -27,7 +41,6 @@
- **The other experimental performance settings have rows there too**: *Helpers work ahead* (`replay_pipe`, 0 to 4),
*Helpers take small jobs* (`replay_small`, 0 to 64) and *Start next frame early* (`tail_early`). A row whose setting
does nothing without another one is greyed out and says which it needs.
- **The hidden co-op beta is gone.** The co-op of 0.8.0 (shown only with `coop_beta = 1`) shared story progress
through a relay a player had to run and never showed the other players. Its code, its settings (the `[coop]` section
of nx2navi.ini), its relay script and its menu tab are removed; lines of it left in an nx2navi.ini do nothing, and a
bug report still keeps their values out. A new co-op is being built in its place.
- **The co-op beta of 0.8.0 is replaced.** It shared story progress through a relay a player had to run, with a
forwarded port, and never showed the other players. Its relay, its rules and pools, its settings and its hidden tab
are gone; lines of it left in an nx2navi.ini do nothing, and a bug report still keeps their values out. See "New".