mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 06:59:57 -04:00
Bring public main's bug capture on F8 and its removal of the Steam co-op into the 0.10.0 line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/architecture.md # launcher/steamlib.py # launcher/ui/app.py # runtime/boot.c # runtime/cfg.c # runtime/flight.c # runtime/flight.h # runtime/gfx_present.c # tests/launcher_test.py
This commit is contained in:
@@ -46,8 +46,6 @@ from other projects, with its license, is listed in [THIRD_PARTY_NOTICES.md](../
|
||||
lines reach the log in the order it logged them: a line waits for the queue's lock, and one that finds the queue
|
||||
full is written after everything queued before it. A fatal error, the crash report and the end of the process write
|
||||
the queue out first (`rt_log_sync`). `NX2NAVI_LOG_ASYNC=0` writes each line where it is logged.
|
||||
- Co-op (`coop.c`, `steam.c`, `coop_game.c`, [coop.md](coop.md)): a host thread that owns the Steam library and a room of
|
||||
up to four players; the game side reads Link and the game's flags at the present. It never holds a virtual core.
|
||||
- OS calls the host makes go through `runtime/platform/` (`platform.h`, `win32.c`).
|
||||
|
||||
#### Threads and cores
|
||||
@@ -308,8 +306,9 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
|
||||
is tight and after 1 s while it is critical. `mem_budget_test_vram_mb` and `mem_budget_test_ram_mb` pretend a side is
|
||||
that small, to test what gives memory back on a large machine; they leave the texture cache's own rules alone.
|
||||
- Allocation: Vulkan Memory Allocator. Debugging: Vulkan validation layers, per-pass frame dumps (`NX2NAVI_DUMP`,
|
||||
`vk_dump.c`), a sampling profiler (`NX2NAVI_PROFILE`, `tools/prof_report.py`) and a flight recorder
|
||||
(`NX2NAVI_FLIGHT`). RenderDoc cannot capture, because it hides `VK_EXT_external_memory_host` from the application.
|
||||
`vk_dump.c`), a sampling profiler (`NX2NAVI_PROFILE`, `tools/prof_report.py`), a flight recorder
|
||||
(`NX2NAVI_FLIGHT`) and bug captures, which a player's F8 writes and a test run starts from (`bugcap.c`,
|
||||
[bug-capture.md](bug-capture.md)). RenderDoc cannot capture, because it hides `VK_EXT_external_memory_host` from the application.
|
||||
|
||||
Maxwell behaviour the back end has to match: [maxwell.md](maxwell.md).
|
||||
|
||||
|
||||
130
docs/bug-capture.md
Normal file
130
docs/bug-capture.md
Normal file
@@ -0,0 +1,130 @@
|
||||
# Bug captures
|
||||
|
||||
A bug capture records where and how the game was when a player saw something wrong, so that the bug can be looked for
|
||||
again at that place instead of somewhere else. The player presses **F8**; a test run then starts from what the press
|
||||
wrote. Code: `runtime/bugcap.c`, `tools/capture_run.py`. Ocarina of Time 1.1.1 (the place and the camera come from the
|
||||
debug tools, `runtime/debug_tools.c`); on other game versions a capture still has the picture, the timing, the
|
||||
settings and the save.
|
||||
|
||||
## For the player
|
||||
|
||||
When you see a bug, press **F8** while the game window is in front. About a second later a note at the top of the
|
||||
screen says *Bug capture 3 saved* with the folder's name. Tell whoever looks into the bug the number ("capture 3") and
|
||||
what you saw; nothing else is needed. Press it as often as you like: each press is its own capture, and a press while
|
||||
the one before is still being written is skipped.
|
||||
|
||||
The captures are in the game folder under `logs\captures`, one folder each, named by number and time
|
||||
(`003-20261113-141502`). *Menu > Open log folder* shows `logs`. A capture is a few megabytes, most of it the picture (about
|
||||
9 MB at 3440x1440 with HDR); delete old ones whenever you like. Nothing leaves your PC: a capture is files on your disk.
|
||||
|
||||
## What a capture holds
|
||||
|
||||
| File | What |
|
||||
|---|---|
|
||||
| `capture.txt` | Written last: a folder that has it is complete. `key = value` lines under `[sections]`, see below |
|
||||
| `frame.png` | The frame on screen as the window got it, the overlay included, without the capture's own note (an HDR picture converted to sRGB) |
|
||||
| `frames.tsv` | The last 600 presents before the press and the 30 after: frame, interval and replay time in ms |
|
||||
| `log-tail.txt` | The last 256 KB of the run's log |
|
||||
| `settings.ini` | Every setting that had a value (from `nx2navi.ini`, the menu or the environment) as `nx2navi.ini` lines, without the private ones (`runtime/cfg_private.h`) |
|
||||
| `NX2navi-save-<time>.zip` | The save the game would load next, as *Menu > Export save* writes it |
|
||||
| `flags.tsv`, `texts.tsv` | The game's on/off flags and its 64-character texts, by the hash of their names |
|
||||
| `flight/` | With `flight = 1`: the flight recorder's dump of the same moment (`tools/flight_view.py` reads it) |
|
||||
|
||||
`capture.txt`:
|
||||
|
||||
- `[capture]`: `number`, `name`, `time`, `time_utc`, `trigger` (`F8`, `NX2NAVI_CAPTURE_AT`, `replay`), the NX2navi and
|
||||
game versions, the presented `frame`, `run_seconds`, `menu_open`.
|
||||
- `[place]`: `area` (the game's own name, which says child or adult for the outdoor areas: `HyruleField_Adult`),
|
||||
`player_pos` in metres (`none` at the title screen and while loading), `player_rot` (Link's 3x3 rotation by rows) and
|
||||
`player_yaw`, and `nearest_start`, the area's start position nearest to him, when the list of start positions was
|
||||
read (the debug menu or a test reads it).
|
||||
- `[camera]`: `camera_pos`, `camera_dir`, `camera_yaw` and `camera_pitch` (radians; the camera looks along
|
||||
`(cos pitch sin yaw, sin pitch, cos pitch cos yaw)`, the free camera's convention) with `camera_source`: the frame on
|
||||
screen when DLSS, DLAA or FSR runs (then also `camera_fov_y_degrees`, `camera_aspect`, the near and far planes),
|
||||
else the free camera when it is on, else the game's own camera. `game_camera_pos` / `game_camera_target` and
|
||||
`event_camera_pos` / `event_camera_target` are the game's two scene cameras as its camera update chose them in the
|
||||
frames after the press, whatever was drawn.
|
||||
- `[picture]`: the window's size, the game image's size, HDR, the scaler, the present mode, the display's rate.
|
||||
- `[timing]`: over the presents before the press: the average frame rate, the median, 95th and 99th percentile and
|
||||
the longest frame time, how many frames took over 33 and 50 ms, the last 30 intervals before and the first after,
|
||||
and the performance overlay's numbers when it was on.
|
||||
- `[system]`: OS, CPU, RAM, GPU, driver.
|
||||
- `[settings that differ from the defaults]`: the settings whose value is not the default; a private one shows only
|
||||
that it is set.
|
||||
|
||||
Position, rotation, area and the camera of the frame on screen are read on the render thread at the press, so they
|
||||
belong to the frame the timing ends with; the picture is the next present.
|
||||
|
||||
## Starting a test run from a capture
|
||||
|
||||
```
|
||||
python tools/capture_run.py 3
|
||||
python tools/capture_run.py "C:\...\game\logs\captures\003-20261113-141502" --set FSR4=0 --hold 30
|
||||
```
|
||||
|
||||
The argument is a capture's folder or its number under the installed game's `logs\captures` (`--game` names another
|
||||
game folder). The script
|
||||
|
||||
1. refuses to start while a game is running (one game at a time);
|
||||
2. makes a throwaway profile: the game's own profile without its saves, with the capture's save as a waiting import,
|
||||
which the game makes the save when it starts;
|
||||
3. starts the game with `NX2NAVI_CAPTURE_REPLAY=<the capture's folder>`, in a window of the capture's size that takes
|
||||
neither the focus nor your input (`--foreground` and `--fullscreen` change that), co-op and Discord off;
|
||||
4. waits while the game presses A through the title screen and the file menu, teleports to the capture's area,
|
||||
walks Link to where he stood, puts the free camera where the camera was and takes a capture of its own;
|
||||
5. closes the game and prints both captures side by side: area, positions, the distance between them, cameras, and
|
||||
the mean difference of the two pictures.
|
||||
|
||||
The run's log and its capture are in `<capture>/replays` (`--out` names another folder). `--set KEY=VALUE` puts one
|
||||
setting on top of the capture's for this run, which is how a suspected setting is tried: run once as captured and
|
||||
once with `--set`. `--hold <seconds>` keeps the game open after its capture; `--no-camera` leaves the camera to the
|
||||
game, for a bug that is about the camera itself. Any other test setting can ride along with `--set` (`DUMP`, `SHOT_DIR`
|
||||
and `SHOT_EVERY`, `DBG_TEST`, `TRACE`).
|
||||
|
||||
What the game does in such a run (`NX2NAVI_CAPTURE_REPLAY`, environment only):
|
||||
|
||||
- The capture's `settings.ini` stands in for `nx2navi.ini`, which is neither read nor written; the environment still
|
||||
wins over it. The log's first lines say so and list the settings.
|
||||
- Until Link appears the pad presses A (four reads in every hundred).
|
||||
- Three seconds later the game changes area as its own doors do (`dbg_warp`), to the start position of the capture's
|
||||
area that is nearest to the captured place; when the save already starts within 60 m of it, there is no teleport.
|
||||
A refused teleport (an event still running after the load) is asked again, up to six times.
|
||||
- Link runs to the captured `x z` (`dbg_route_to`), steered by the game's own camera and walking the last three
|
||||
metres, and counts as there within half a metre. He is walked, not put: his position cannot be written
|
||||
(`debug_tools.c`). When something is in the way he sidesteps, and after ten tries the walk is given up where he is.
|
||||
When he does not move at all for two seconds, the game holds him (a conversation that began where the teleport
|
||||
arrived, on a save that had not been there): A is pressed until he moves, and the walk is asked for again.
|
||||
- The free camera is turned on standing (the pad still plays the game) and put at `camera_pos`, `camera_yaw`,
|
||||
`camera_pitch`. `NX2NAVI_CAPTURE_REPLAY_CAMERA=0` leaves the game's camera.
|
||||
- Three seconds later the log says `capture: replay of <name> ready: ...` with how far Link is from the captured
|
||||
place, and the run takes its own capture (`trigger = replay`), whose `capture.txt` adds `replay_of`,
|
||||
`replay_player_off_metres`, `replay_walk` and `replay_camera`.
|
||||
|
||||
What a replay does not bring back: the time of day, enemies and other actors, Link's pose and what he holds, an event
|
||||
or cutscene that was running, the camera's field of view where the game had changed it (the comparison shows both),
|
||||
and progress made since the last save (the save is the one on disk at the press; the flags that differed are in
|
||||
`flags.tsv`). A capture taken at the title screen or while loading has no area: its replay applies the settings and
|
||||
stops.
|
||||
|
||||
Measured on the PC the feature was written on (RX 7900 XT, HDR on): in a 3232x1352 window a capture is written in
|
||||
1.2 s and holds about 9 MB, eight of them the picture; in a 1720x720 window 0.6 to 0.8 s and 3.5 MB. The frame after
|
||||
the press is some 10 ms longer, for the read-back of the picture. A replay of a capture taken three metres from where
|
||||
the save starts took 45 s from start to its own capture, with Link 0.4 to 0.5 m from the captured place and the
|
||||
camera's position and angles equal to the last digit; one that teleports to another area and ends a conversation on
|
||||
the way took about 100 s.
|
||||
|
||||
Without the script: set `NX2NAVI_CAPTURE_REPLAY` to the folder and start the game with `--profile <a copy of a
|
||||
profile>`; `NX2NAVI_CAPTURE_DIR` says where the run's own capture goes (default `<capture>/replays`).
|
||||
|
||||
## Test settings
|
||||
|
||||
Environment or `nx2navi.ini`, for runs without a keyboard:
|
||||
|
||||
- `NX2NAVI_CAPTURE_AT=<frame>[,<frame>...]`: a capture at each of those presented frames (up to 16).
|
||||
- `NX2NAVI_CAPTURE_DIR=<folder>`: the folder captures go to, in place of `logs/captures`.
|
||||
|
||||
## The flight recorder
|
||||
|
||||
`flight = 1` keeps a ring of the last frames with a small picture each (`runtime/flight.c`). Its dump on F8 now
|
||||
belongs to the capture: it goes to the capture's `flight` folder. Its other dumps (a frame over `flight_spike_ms`,
|
||||
`NX2NAVI_FLIGHT_AT`, `NX2NAVI_FLIGHT_EVERY`) go to the `flight` folder beside the game folder as before.
|
||||
@@ -545,9 +545,7 @@ No game files.
|
||||
|
||||
A change to the button prompts (`tools/make_romfs_patches.py --prompts`, `tools/button_icons.py`) passes
|
||||
`.venv-py314\Scripts\python tests\romfs_prompts_test.py`, which runs the tool on a RomFS it makes itself (no game
|
||||
files); a change to the settings passes `nx2navi.exe --probe-cfg`; a change to co-op (`runtime/coop*.c`,
|
||||
`runtime/steam.c`, `runtime/ui/coop_page.cpp`) is run with one game and `python tests\coop_peer.py` as the second player
|
||||
([coop.md](coop.md), "Checks").
|
||||
files); a change to the settings passes `nx2navi.exe --probe-cfg`.
|
||||
|
||||
A change to the action prompt's diamond of face buttons (`runtime/action_prompt.c`) or to the SARC and zstd dictionary
|
||||
helpers (`runtime/sarc.c`) passes `python tests\action_prompt_check.py`. It builds them alone, with the
|
||||
|
||||
@@ -89,6 +89,7 @@ The game's *Swap Jump Controls* option trades B and X (jump on B, put away on X)
|
||||
| Key | Gamepad | Action |
|
||||
|---|---|---|
|
||||
| F1 or Esc | Minus and Plus together | open or close the settings menu; the game gets no input while it is open |
|
||||
| F8 | | bug capture: saves where you are, the camera, the picture, the settings, the log's end and your save into `logs\captures`, and a note on screen names it ([bug-capture.md](bug-capture.md)) |
|
||||
| F10 | L3 + R3 (both stick clicks) | performance overlay: off, frame rate, full panel |
|
||||
| F11 | | borderless fullscreen on or off, saved to `nx2navi.ini`; not with Ctrl, Shift or Alt held, which overlays and capture tools use |
|
||||
|
||||
@@ -102,7 +103,7 @@ The sound plays on the system default device, and follows it when the Windows de
|
||||
|
||||
## Remapping
|
||||
|
||||
The *Controls* tab of the settings menu lists, under the button layout, every Switch button and the eight stick directions the keys drive (movement and camera), each with two key cells and a controller cell. Each row's description says what the button does in the game. Select a cell, press A or Enter, then press the new key, mouse button or controller button; Esc or five seconds without a press cancel, and a controller button cancels a key cell. Delete, Backspace or X clears the selected cell. A key another action has moves to the new one (the description names the action it left); a controller button swaps with the one it replaces. A remapped controller button is physical: from then on the face buttons (A B X Y) stay where they are in both layouts, until the buttons are put back as the layout in use has them or *Reset all buttons* is chosen. F1, F8, F10, F11 and Esc cannot be bound (the menu, the flight recorder and the window keep them). Punctuation keys are named by their place on a US keyboard; the menu shows the character the keyboard layout in use puts there.
|
||||
The *Controls* tab of the settings menu lists, under the button layout, every Switch button and the eight stick directions the keys drive (movement and camera), each with two key cells and a controller cell. Each row's description says what the button does in the game. Select a cell, press A or Enter, then press the new key, mouse button or controller button; Esc or five seconds without a press cancel, and a controller button cancels a key cell. Delete, Backspace or X clears the selected cell. A key another action has moves to the new one (the description names the action it left); a controller button swaps with the one it replaces. A remapped controller button is physical: from then on the face buttons (A B X Y) stay where they are in both layouts, until the buttons are put back as the layout in use has them or *Reset all buttons* is chosen. F1, F8, F10, F11 and Esc cannot be bound (the menu, the bug capture and the window keep them). Punctuation keys are named by their place on a US keyboard; the menu shows the character the keyboard layout in use puts there.
|
||||
|
||||
The tab writes `nx2navi.ini` lines, one per Switch button or stick direction: `bind_<button> = <entry>, <entry>, ...`. The button is `A B X Y L R ZL ZR PLUS MINUS LEFT UP RIGHT DOWN LCLICK RCLICK`, or a stick direction `LSTICK_LEFT LSTICK_UP LSTICK_RIGHT LSTICK_DOWN` (movement, W A S D by default) and `RSTICK_...` (camera, the arrow keys). An entry is `pad:<name>` or `key:<name>`:
|
||||
|
||||
|
||||
154
docs/coop.md
154
docs/coop.md
@@ -1,154 +0,0 @@
|
||||
# Co-op
|
||||
|
||||
Up to four players, each in their own game with their own save, meet in a room through Steam. In a room you see the
|
||||
other players' names where their Link stands in your world, you can chat, and progress is shared: what anyone achieves
|
||||
counts for everyone.
|
||||
|
||||
**Co-op is experimental and off by default.** Turn it on in the menu's Co-op tab (*Co-op (experimental)*), or with
|
||||
`coop_steam = 1` under `[coop]` in `nx2navi.ini`. With it off the game uses no network at all.
|
||||
|
||||
Not in this version: the other players are shown as a name with a distance, not as a Link model, and enemies, pots
|
||||
and the time of day are each game's own.
|
||||
|
||||
## What you need
|
||||
|
||||
- **Steam, running and signed in.** NX2navi is no Steam game of its own: it signs in to Steam as *Spacewar* (app 480),
|
||||
the test app Valve gives every account. While co-op is on, Steam shows you as playing Spacewar. Nobody forwards a
|
||||
port on a router and nobody runs a server: the room is a Steam lobby and the games talk through Steam's own network,
|
||||
which finds a direct path between them or relays for them.
|
||||
- **At least one Steam game from 2021 or later installed** (Windows). Co-op uses Steam's library file,
|
||||
`steam_api64.dll`, which NX2navi may not ship; every Steam game has one in its folder. The launcher fetches it for
|
||||
you: each time it starts the game and the file is not beside `ocarina.exe`, it looks through your Steam libraries
|
||||
for the newest one that Valve signed and that has the calls co-op uses, and copies it there (a second or two, once;
|
||||
`launcher/steamlib.py`). You can also copy one there yourself. The Co-op tab says when the file is missing or too
|
||||
old; the game loads it from that one place only.
|
||||
- **The same NX2navi version and game version (1.1.1)** as the others. A game of another version is told so and does
|
||||
not get into the room.
|
||||
|
||||
## Rooms
|
||||
|
||||
- **Create a room** makes a room and shows its **room ID**, eight letters and digits as `XXXX-XXXX`. A press on the row
|
||||
copies it. Your game is the room's host.
|
||||
- **Join a room** takes a room ID (typed in any case, with or without the dash; Paste takes the clipboard's text).
|
||||
- **Invite a friend** lists your Steam friends, those in co-op first, and sends a Steam invite to the one you choose.
|
||||
The invite reaches a friend whose NX2navi is running with co-op on: it shows at the top of their screen and on their
|
||||
Co-op tab, where *Join their room* accepts it. A friend whose game is not running gets Steam's own invite, which
|
||||
would start Spacewar, not NX2navi: tell them the room ID instead. When the game was started from Steam (the
|
||||
launcher's *Add to Steam*), Steam's own invite window is offered as well.
|
||||
- **Players** lists who is in the room and the area each one's Link is in. The host can press a player to remove
|
||||
them; a removed player cannot come back into that room.
|
||||
- **Leave the room** asks first. When the host leaves, Steam hands the room to another player, whose game is the host
|
||||
from then on.
|
||||
|
||||
A room ID is the number of the Steam lobby. Anyone who has it can join while the room is open, so pass it on only to
|
||||
the people you want in your game; the room is also visible to your Steam friends, who may join it from Steam. To be
|
||||
rid of someone, the host removes them; to be sure, leave and create a new room.
|
||||
|
||||
## What joining a room means for your save
|
||||
|
||||
- **Your save is copied first.** When your game starts to share in a room (you are in the room and playing a save),
|
||||
it copies your whole save (every slot) to `coop-backup/<date-time>` in the profile folder, and takes nothing from
|
||||
the room until the copy is made. The newest twelve copies are kept. "Going back" below says how to restore one.
|
||||
- **Progress is shared while *Share progress* is on** (it is, by default): story, world and dungeon flags (events,
|
||||
talks, chests, doors, switches, bosses, maps and compasses), items and equipment, songs, quest items, wallet, bag and
|
||||
quiver sizes. A flag anyone has set is set for everyone, and of a count the highest wins. A player who joins later
|
||||
gets what the room has, and the room what the joiner brings. Your game saves it as its own progress.
|
||||
- **Each player keeps their own** small keys, rupees, ammunition, heart pieces and containers, gold skulltula tokens,
|
||||
bottle contents, the trade sequence, the equipment worn, life and magic.
|
||||
- **Nothing is undone.** Leaving a room keeps what was shared. A player in the room plays with you: what they do in
|
||||
their world happens in yours, and a game that wants to can send progress it did not play for. Join rooms of people
|
||||
you trust with your save, as you would hand them your controller, and go back to the copy if you regret it.
|
||||
- With *Share progress* off, your game sends and takes no progress: only names, positions and chat.
|
||||
|
||||
Every value from the room is checked against your game's own table of what is shared before it is used: the flag must
|
||||
be one of the shared ones, an on/off flag can only be set to "done", an item count only up to 999. Anything else is
|
||||
dropped and counted in the log.
|
||||
|
||||
### Going back to your save from before a room
|
||||
|
||||
1. Close the game.
|
||||
2. In the profile folder, open `coop-backup` and pick the copy to go back to (the time is UTC).
|
||||
3. Delete the folder `save-tx` (it may hold a save that was being written; it would otherwise be finished over the
|
||||
copy at the next start).
|
||||
4. Move the folder `save/<numbers>` aside (keep it until you are sure), and copy the contents of the backup folder
|
||||
into a new `save/<numbers>` of the same name.
|
||||
5. Start the game: every slot is as it was before the room's progress reached it.
|
||||
|
||||
## Who can see what
|
||||
|
||||
| Who | Sees |
|
||||
|---|---|
|
||||
| The players in the room | your Steam name, the area your Link is in and where he stands, your chat lines, the progress your game shares |
|
||||
| Your Steam friends | that you play Spacewar, and the room (they may join it) |
|
||||
| Valve | what Steam sees of any game that uses its lobbies and network: who is in which lobby, and the traffic's size and timing. Steam encrypts the traffic between the games |
|
||||
| Your log (`logs/nx2navi.log`) and "Copy system info" | that a room was made or joined, the other players' Steam names, and the lines below; never a room ID or a Steam id. Steam's library prints lines of its own, one with your Steam id, to the console the game was started from; they are not in the log file, but they are in a file you redirect the game's output to yourself |
|
||||
|
||||
## Settings
|
||||
|
||||
`nx2navi.ini`, section `[coop]`; the menu's Co-op tab has a row for each. The environment variable is the key with
|
||||
`NX2NAVI_`.
|
||||
|
||||
| Key | Default | |
|
||||
|---|---|---|
|
||||
| `coop_steam` | `0` | on or off, at once. On: the game signs in to Steam; off: no network. (`coop`, the switch of the co-op of versions up to 0.9.2, does nothing: a line of it left in a file turns nothing on) |
|
||||
| `coop_share` | `1` | in a room, share progress, items and songs (above) |
|
||||
| `coop_names` | `1` | show the other players' names where they stand. Needs DLSS, FSR or TAA on: only then does the menu know where the camera looks |
|
||||
| `coop_chat` | `1` | show new chat lines, and who joined or left, over the game for a few seconds while the menu is closed |
|
||||
|
||||
A settings file cannot put a game into a room: a room is made or joined only from the menu.
|
||||
|
||||
## In the log
|
||||
|
||||
`coop: on, signed in to Steam as app 480`, `coop: Steam is not available: <why>`, `coop: room made`, `coop: in the
|
||||
lobby; asking the host`, `coop: joined the room`, `<name> joined the room`, `<name> left the room`, `coop: the host
|
||||
left; this game is the host now`, `coop: left the room`, `coop: the save as it was before this room is in <folder>`,
|
||||
`coop: a save is played: N flags and counts can be shared`, `coop: took N values of progress from the room`, `coop: N
|
||||
values from the room were not ones this game shares; dropped`.
|
||||
|
||||
## How it works
|
||||
|
||||
For a reviewer. The code is `runtime/steam.c` (the Steam library), `runtime/coop.c` (the room), `runtime/coop_game.c`
|
||||
(the game side) and `runtime/ui/coop_page.cpp` (the menu's tab and the names over the game).
|
||||
|
||||
**The Steam library.** `steam.c` loads `steam_api64.dll` from beside the exe at run time and calls the plain C
|
||||
functions it exports; it declares them itself, and nothing of the Steamworks SDK is in this repository. It sets
|
||||
`SteamAppId` and `SteamGameId` to 480 in its own environment before the library loads. Callbacks are taken with the
|
||||
library's manual dispatch on the co-op thread, the only thread that uses the library. A library that lacks one of the
|
||||
calls is refused as too old.
|
||||
|
||||
**The room.** A room is a friends-only Steam lobby that carries the note `nx2navi = 1`; a lobby without it belongs to
|
||||
some other program that uses the test app and is left at once. The lobby's owner is the host. A game that entered the
|
||||
lobby says HELLO to the host with its protocol number and game build; the host answers WELCOME or REFUSED and sends
|
||||
everyone the list of the players it let in. Every game takes positions, chat and progress only from the players on
|
||||
the host's list, and only a lobby member's session is accepted, so a stranger on Steam, a player the host removed and
|
||||
a game of another version reach nobody.
|
||||
|
||||
**Messages** go through Steam's networking messages (datagrams to a Steam id): positions unreliable, twenty a second
|
||||
while Link is in the world; everything else reliable. Steam vouches for the sender's id and encrypts. Each message is
|
||||
one kind byte and a body whose length is checked before it is read; `coop.c`'s header comment lists them.
|
||||
|
||||
**Progress.** The game keeps its progress as flags in a database keyed by 32-bit hashes of flag names
|
||||
(`coop_game.c`'s header comment has the layout). Between two frames the runtime reads the flags that changed and sends
|
||||
the ones that rose; it sets the ones the room has and this game lacks through the game's own set routines, as if the
|
||||
player had done it, at most sixteen a frame. Nothing is read or set on the title screen, while a save loads or an area
|
||||
changes. A game that starts to share asks the others for their whole state and sends its own. Games merge only when
|
||||
their tables of what is shared are the same (a sum over the table travels with every message).
|
||||
|
||||
**The host's part is small**: it decides who is in the room. Progress has no arbiter, because every shared value only
|
||||
ever rises: two games that set the same flag agree whatever the order.
|
||||
|
||||
## Checks
|
||||
|
||||
- Two games on one PC cannot both sign in to one Steam account, so the room, the messages and the game side are
|
||||
tested with a stand-in for Steam: `NX2NAVI_COOP_LOCAL=<port>` in the environment (never from `nx2navi.ini`) makes a
|
||||
game the player whose id is that UDP port on 127.0.0.1; `NX2NAVI_COOP_LOCAL_MAKE=1` makes its room at once and
|
||||
`NX2NAVI_COOP_LOCAL_JOIN=<port>` joins another game's. `NX2NAVI_COOP_TRACE=1` logs every two seconds where this
|
||||
game's Link is and where it has the others.
|
||||
- `python tests/coop_peer.py --host <port>` is a second player without a second game (two games need twice the
|
||||
memory): it joins the room of a game started with `NX2NAVI_COOP_LOCAL=<port>` and `NX2NAVI_COOP_LOCAL_MAKE=1`,
|
||||
stands two metres beside the game's Link so that its name shows there, says a chat line, asks for the game's
|
||||
progress and, with `--flags`, sends flags as set. It ends with `peer: ok` when it was let in, saw the game's Link
|
||||
in the world and got its progress. Run it on a copy of a profile: the flags it sends reach that save.
|
||||
- `NX2NAVI_MENU_TEST_SET=<frame>:COOP_DO=create | leave | join:<room id> | chat:<text> | page:join | page:invite |
|
||||
page:chat | page:leave` (environment only) does what the Co-op tab's row or window does.
|
||||
- `ocarina --probe-services` checks, among the rest, that every text of the tab has its four languages.
|
||||
@@ -65,11 +65,6 @@ Customize Launcher (on the home screen) makes the look the player's own:
|
||||
it is silent until the player's game has been read. Moving the cursor makes no sound. They are played from memory
|
||||
(PlaySound on Windows; `pw-play`, `paplay` or `aplay` elsewhere).
|
||||
|
||||
- Steam's library file for co-op (Windows, `launcher/steamlib.py`, [coop.md](coop.md)): before Play and before a start
|
||||
from the Steam shortcut, when `steam_api64.dll` is not beside the game, the launcher copies one there: one a release
|
||||
ships in its `bin` folder if it has one, else the newest one in the games of the player's Steam libraries that Valve
|
||||
signed (WinVerifyTrust and the signer's name) and that has every call `runtime/steam.c` uses. Nothing is downloaded.
|
||||
With no Steam or no suitable file the game starts as before and co-op says what is missing.
|
||||
- Add to Steam (Windows): the game in the player's Steam library as *The Legend of Zelda Ocarina of Time*, started
|
||||
from there without the launcher's window (`launcher/steam.py`). Its pictures are made from the player's game when
|
||||
the row is selected (`launcher/gameart.py`): Navi as the game's HUD draws her for the icon, the title screen's logo,
|
||||
|
||||
@@ -21,18 +21,12 @@
|
||||
|
||||
## New
|
||||
|
||||
- **Experimental: co-op through Steam** (the menu's new Co-op tab; off by default; `coop_steam = 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 one Steam game from 2021 or later
|
||||
installed: co-op uses Steam's library file, `steam_api64.dll`, which NX2navi may not ship, so the launcher copies
|
||||
it beside the game from your own Steam library when it starts the game. 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.
|
||||
- **F8 saves a bug capture.** When you see something wrong, press F8: the game writes where Link stands, the area,
|
||||
the camera, the picture on screen, your settings, the frame times around the press, the end of the log and your
|
||||
save into one folder under `logs\captures`, and a note on screen gives the capture its number. Telling us "capture
|
||||
3" is then enough: a test run starts at that place with that camera and those settings
|
||||
(`python tools/capture_run.py 3`, `docs/bug-capture.md`) instead of somewhere else on another save. Until now F8
|
||||
did something only with the flight recorder on (`flight = 1`); its F8 dump now goes into the capture's folder.
|
||||
|
||||
## Changed
|
||||
|
||||
@@ -42,6 +36,7 @@
|
||||
- **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 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 (its `coop = 1` does not turn the new co-op on), and a bug report still keeps their values out. See "New".
|
||||
- **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.
|
||||
|
||||
Reference in New Issue
Block a user