VICTORY_MAX_STEP_MS: raise the title's longest simulation step (world near real time below 15 fps) #124

Open
github-bot wants to merge 3 commits from github-bot/gh-124 into main AGit
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 03:09 UTC · original
Geckomacabre:pr/max-step → main · +521 −9 · 5 files · 3 commits · draft

Depends on #123 (the Series S upscaler PR): it needs that PR's known-build entry, and this branch contains its commit. Review that one first; only the last commit is new here.

The title's timer step is max(min(dt, 1/15 s), 1/30 s) (+0x2226040), and the world update clamps to 1/15 s again (+0x8dec0), as does the paused branch (+0x22264d0). So below 15 fps the world runs slow: half speed at 8 fps, a quarter at 4.

VICTORY_MAX_STEP_MS=<66.7..333> (off by default) points the three loads of the shared 1/15 s constant (it has 64 readers, so it stays) at a float in the int3 padding after +0x2226040's ret (+0x2226128). Every site's whole instruction is compared first, all or nothing, only on the known build, written in memory after load. Longer steps mean more of the title's 1/15 s physics substeps per frame; 100 is a good value. VICTORY_STEP_LOG=1 logs game time against wall time every 5 s, with or without the patch.

Tested: played with 100 for days on a sibling tree (RTX 4090, 5-15 fps): the world keeps near real time. Cards at 5-10 fps (e.g. #75) would run at half speed without it.

Checks: cargo check -p victory --features diagnostics --tests passes on this branch. Unit tests (victory-game step tests, victory-loader) are pending; results will follow as a comment.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 03:09 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/124) `Geckomacabre:pr/max-step` → `main` · +521 −9 · 5 files · 3 commits · draft **Depends on #123** (the Series S upscaler PR): it needs that PR's known-build entry, and this branch contains its commit. Review that one first; only the last commit is new here. The title's timer step is `max(min(dt, 1/15 s), 1/30 s)` (+0x2226040), and the world update clamps to 1/15 s again (+0x8dec0), as does the paused branch (+0x22264d0). So below 15 fps the world runs slow: half speed at 8 fps, a quarter at 4. `VICTORY_MAX_STEP_MS=<66.7..333>` (off by default) points the three loads of the shared 1/15 s constant (it has 64 readers, so it stays) at a float in the `int3` padding after +0x2226040's `ret` (+0x2226128). Every site's whole instruction is compared first, all or nothing, only on the known build, written in memory after load. Longer steps mean more of the title's 1/15 s physics substeps per frame; 100 is a good value. `VICTORY_STEP_LOG=1` logs game time against wall time every 5 s, with or without the patch. **Tested:** played with 100 for days on a sibling tree (RTX 4090, 5-15 fps): the world keeps near real time. Cards at 5-10 fps (e.g. #75) would run at half speed without it. **Checks:** `cargo check -p victory --features diagnostics --tests` passes on this branch. Unit tests (`victory-game` step tests, `victory-loader`) are pending; results will follow as a comment. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On a Series S the title can pick AMD FidelityFX (type 7) instead of its own
upscaler (type 6). FidelityFX's output never reaches the screen here and its DLL is
refused by the host policy ("a host DLL outside the host policy: refused
amd_fidelityfx_upscaler_xbox.dll"), so the world stays black. VICTORY_UPSCALER=6
patched only the picker (+0x7e93f0); the title asks a per-frame copy of it
(+0x5400190) again every frame.

- KNOWN_BUILDS gets the master build's hash.
- With --console series-s and that build, the picker and its per-frame copy (now a
  site of its own, 32 bytes compared) return 6. VICTORY_UPSCALER=<kind> still
  overrides, now at both sites; VICTORY_TITLE_PATCHES=0 leaves the title's choice,
  =1 applies it on any console.
- Log: 'resolution: upscaler picker (the per-frame copy) (returns 6) ... Done'.

From fxceless/victory-fork #798 by KyleS98 (both sites).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title's timer step (+0x2226040) is max(min(dt, 1/15 s), 1/30 s); +0x8dec0 clamps
the world update's step to 1/15 s again, and the paused branch of +0x22264d0 too. So a
frame longer than 66.7 ms moves the world only 66.7 ms: at 8 fps it runs at about half
speed, at 4 fps at a quarter. The 1/15 s constant has 64 readers, so it stays; the
three vmovss loads are pointed at a float of ours in the int3 padding after
+0x2226040's ret (+0x2226128). Every site's whole instruction is compared first, all or
nothing, and only on the known build (written in memory after load).
VICTORY_MAX_STEP_MS takes 66.7 to 333 ms (100 is a good value); longer steps mean more
of the title's 1/15 s physics substeps per frame. VICTORY_STEP_LOG=1 logs game time
against wall time every 5 s, with or without the patch.

Needs the known build entry (pull request for the Series S upscaler choice).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:09:37 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 03:13 UTC · original

Thanks for keeping the step change opt-in and calling out the dependency on #123. I reviewed the step commit on its own.

  • write_all_checked compares all the expected bytes up front, then changes the protection and writes each site in turn. If a later protection change fails, the earlier writes remain and the launch message says the step was left alone. Please make that failure leave the original bytes in every site, and add a loader test for a failure after the first site.
  • VICTORY_STEP_LOG reads a fixed timer offset on any executable large enough to contain it. Please gate the logger on the matching build and collect the timer fields where the title updates them. The detached thread's volatile reads have no synchronization with those writes.

Once #123 lands, could you rebase and share the focused test results and one matched game/wall comparison with the patch off and on? At 5 FPS, a 100 ms cap still allows only 100 ms of simulation per roughly 200 ms frame, so the trace would help pin down where the setting gets close to real time.

**@⁠TaynanGT** on GitHub · 2026-11-27 03:13 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7208810803) Thanks for keeping the step change opt-in and calling out the dependency on #123. I reviewed the step commit on its own. - `write_all_checked` compares all the expected bytes up front, then changes the protection and writes each site in turn. If a later protection change fails, the earlier writes remain and the launch message says the step was left alone. Please make that failure leave the original bytes in every site, and add a loader test for a failure after the first site. - `VICTORY_STEP_LOG` reads a fixed timer offset on any executable large enough to contain it. Please gate the logger on the matching build and collect the timer fields where the title updates them. The detached thread's volatile reads have no synchronization with those writes. Once #123 lands, could you rebase and share the focused test results and one matched `game/wall` comparison with the patch off and on? At 5 FPS, a 100 ms cap still allows only 100 ms of simulation per roughly 200 ms frame, so the trace would help pin down where the setting gets close to real time.
Author
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 03:34 UTC · original

Test results for this branch (Windows 11, RTX 4090, toolchain 1.98.1, --test-threads=1):

  • cargo check -p victory --features diagnostics --tests: clean.
  • cargo test -p victory-loader -p victory-game -- --test-threads=1 step resolution: all passed (victory-game 2, victory-loader 6; 0 failed): step::tests::the_loads_read_the_titles_fifteenth_and_then_ours, step::tests::the_switch_range, and the resolution tests the checked writer (write_all_checked) sits beside.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 03:34 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209094557) Test results for this branch (Windows 11, RTX 4090, toolchain 1.98.1, `--test-threads=1`): - `cargo check -p victory --features diagnostics --tests`: clean. - `cargo test -p victory-loader -p victory-game -- --test-threads=1 step resolution`: all passed (victory-game 2, victory-loader 6; 0 failed): `step::tests::the_loads_read_the_titles_fifteenth_and_then_ours`, `step::tests::the_switch_range`, and the resolution tests the checked writer (`write_all_checked`) sits beside. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 04:01 UTC · original

Thanks for posting the focused test results, @⁠Geckomacabre. I approved the Windows workflow. Clippy caught a constant-only assert! in step.rs:106 under -D warnings. A compile-time assertion can keep that range check. The earlier review still needs the all-or-nothing writes and build-specific timer handling before we can evaluate the opt-in step change. CI run

**@⁠TaynanGT** on GitHub · 2026-11-27 04:01 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209457039) Thanks for posting the focused test results, @⁠Geckomacabre. I approved the Windows workflow. Clippy caught a constant-only `assert!` in `step.rs:106` under `-D warnings`. A compile-time assertion can keep that range check. The earlier review still needs the all-or-nothing writes and build-specific timer handling before we can evaluate the opt-in step change. [CI run](https://github.com/TaynanGT/Vice-Tay/actions/runs/45932473555)
github-bot force-pushed github-bot/gh-124 from b1c8081ebf to 27c91ae828 2026-11-27 04:10:13 +00:00 Compare
Author
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 04:07 UTC · original

Thanks for the review. Pushed 27c91ae (rebased onto the updated #123 branch; the step commit is the last one):

  • Rollback: the four sites now go through #123's write_all(): all compared up front, and if a later site cannot be made writable, the sites already written get their original bytes back before the error is reported. Test: a_failed_step_site_after_the_first_rolls_all_back (the writer fails on the 2nd, 3rd and 4th write in turn; every site is checked back to its original bytes).
  • VICTORY_STEP_LOG: runs only on the known build (it says so and stops otherwise). The detached thread still samples the title's words without a lock; a sample is kept only when the time word reads the same before and after the frame count and step (acquire fences between the reads), so a sample torn by the title's update is taken again. Collecting the fields where the title updates them would need a hook at that site; I kept the logger as a read-only diagnostic instead. Happy to drop the logger from this PR if you prefer it separate.

Status: cargo check and the unit tests of this revision are not run yet; results will follow after the next build window, together with a matched game/wall pair (patch off, patch at 100) from the same spot once #123 lands. Your point about 5 fps stands: at ~200 ms frames a 100 ms cap still allows about half of real time, so the trace should show where it gets close.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 04:07 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209533707) Thanks for the review. Pushed 27c91ae (rebased onto the updated #123 branch; the step commit is the last one): - **Rollback:** the four sites now go through #123's `write_all()`: all compared up front, and if a later site cannot be made writable, the sites already written get their original bytes back before the error is reported. Test: `a_failed_step_site_after_the_first_rolls_all_back` (the writer fails on the 2nd, 3rd and 4th write in turn; every site is checked back to its original bytes). - **`VICTORY_STEP_LOG`:** runs only on the known build (it says so and stops otherwise). The detached thread still samples the title's words without a lock; a sample is kept only when the time word reads the same before and after the frame count and step (acquire fences between the reads), so a sample torn by the title's update is taken again. Collecting the fields where the title updates them would need a hook at that site; I kept the logger as a read-only diagnostic instead. Happy to drop the logger from this PR if you prefer it separate. Status: `cargo check` and the unit tests of this revision are not run yet; results will follow after the next build window, together with a matched `game/wall` pair (patch off, patch at 100) from the same spot once #123 lands. Your point about 5 fps stands: at ~200 ms frames a 100 ms cap still allows about half of real time, so the trace should show where it gets close. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 04:13 UTC · original

Results for 27c91ae (Windows 11, RTX 4090, toolchain 1.98.1, --test-threads=1):

  • cargo check -p victory --features diagnostics --tests: clean, no warnings.
  • cargo test -p victory-loader -p victory-game -- --test-threads=1 step resolution: 11 passed, 0 failed (victory-game 2, victory-loader 9), including the new a_failed_step_site_after_the_first_rolls_all_back.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 04:13 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209627404) Results for 27c91ae (Windows 11, RTX 4090, toolchain 1.98.1, `--test-threads=1`): - `cargo check -p victory --features diagnostics --tests`: clean, no warnings. - `cargo test -p victory-loader -p victory-game -- --test-threads=1 step resolution`: 11 passed, 0 failed (victory-game 2, victory-loader 9), including the new `a_failed_step_site_after_the_first_rolls_all_back`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 04:18 UTC · original

Thanks for separating the timing question from the patch, @⁠Geckomacabre. Draft #150 carries your opt-in step change with the compile-time range check and the four-site preflight. The loader, game and app checks passed locally. The detached timer reader is split out so the pacing change and the measurement approach can be reviewed independently. A matched off/on gameplay run would help once #149 is ready.

**@⁠TaynanGT** on GitHub · 2026-11-27 04:18 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209690929) Thanks for separating the timing question from the patch, @⁠Geckomacabre. [Draft #150](https://git.gtahub.st/github/TaynanGT--Vice-Tay/pulls/150) carries your opt-in step change with the compile-time range check and the four-site preflight. The loader, game and app checks passed locally. The detached timer reader is split out so the pacing change and the measurement approach can be reviewed independently. A matched off/on gameplay run would help once #149 is ready.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/124/head:github-bot/gh-124'
git switch 'github-bot/gh-124'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-124'
git switch 'github-bot/gh-124'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-124'
git switch 'github-bot/gh-124'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-124'
git switch 'main'
git merge --squash 'github-bot/gh-124'
git switch 'main'
git merge --ff-only 'github-bot/gh-124'
git switch 'main'
git merge 'github-bot/gh-124'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.