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

Closed
Geckomacabre wants to merge 430 commits from upstream-pr/124 into main
Geckomacabre commented 2026-11-27 03:09:03 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Geckomacabre on 2026-11-27T03:09:03Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5520498792 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/124). Originally posted by [Geckomacabre](https://github.com/Geckomacabre) on 2026-11-27T03:09:03Z. --- **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)
TaynanGT commented 2026-11-27 03:13:38 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T03:13:38Z.


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.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7208810803 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7208810803). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T03:13:38Z. --- 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.
Geckomacabre commented 2026-11-27 03:34:11 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Geckomacabre on 2026-11-27T03:34:11Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7209094557 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209094557). Originally posted by [Geckomacabre](https://github.com/Geckomacabre) on 2026-11-27T03:34:11Z. --- 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)
TaynanGT commented 2026-11-27 04:01:28 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T04:01:28Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7209457039 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209457039). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T04:01:28Z. --- 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)
Geckomacabre commented 2026-11-27 04:07:05 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Geckomacabre on 2026-11-27T04:07:05Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7209533707 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209533707). Originally posted by [Geckomacabre](https://github.com/Geckomacabre) on 2026-11-27T04:07:05Z. --- 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)
Geckomacabre commented 2026-11-27 04:13:47 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Geckomacabre on 2026-11-27T04:13:47Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7209627404 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209627404). Originally posted by [Geckomacabre](https://github.com/Geckomacabre) on 2026-11-27T04:13:47Z. --- 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)
TaynanGT commented 2026-11-27 04:18:22 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T04:18:22Z.


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.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7209690929 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/124#issuecomment-7209690929). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T04:18:22Z. --- Thanks for separating the timing question from the patch, @Geckomacabre. [Draft #150](https://github.com/TaynanGT/Vice-Tay/pull/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.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
TaynanGT/Vice-Tay!124
No description provided.