Scenario benchmark: the title drives and fights by itself, measured unattended (scripts\autotest.ps1, script commands from our side, build 1.0.2.1) #4941

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

@⁠bentsignal on GitHub · 2026-12-01 14:55 UTC · original
bentsignal:scenario-bench → main · +4204 −3 · 14 files · 3 commits · open

What it changes

A benchmark for A/B measurements that needs nobody at the PC and repeats: scripts\autotest.ps1 -Scenario drive-downtown-calm
boots the title from a fixed save, and once the world is live starts a scenario through the title's own script
commands
: the player is seated in his car and the title's own driving task takes it round a loop of downtown streets
through its traffic (or over the bridges and the highway, or 8 armed peds fight around him). Every frame of a fixed window
is measured, and the run is checked for validity (still in his car, alive, not wrecked, not standing). The car, its
physics, the route, the traffic, the AI and the streaming are the title's; recorded pad input could not do that (a
replay parts from its recording within seconds, and a walk never reaches downtown traffic).

Nothing changes for players: every part is off unless its switch is set, and only the runner sets them.

Layer (Rust):

  • crates/victory-loader/src/script_calls.rs (+ direct.rs, legs.rs): with VICTORY_TITLE_HOOKS=<file> the title's
    script machine's one call of a command's handler goes through us (a call-site redirect, bytes checked first; another
    build is refused and nothing is changed). There the lines of VICTORY_SCRIPT_CALLS_FILE run on the title's script
    thread between two of its commands: commands and actions named in the hooks file, every (the title's "this frame"
    commands held), until (wait for a result), legs (a route handed to the title's go-to driving a leg at a time),
    call (a title function the file names, bytes checked before every call). VICTORY_NATIVE_CENSUS=<file> counts every
    command the title's scripts call, to find new ones. Called from run.rs next to write_sites::apply_asked.
  • host.rs: VICTORY_SCENE_FILE (the first second with 1000+ draws a frame: "scene live", logged and written as a Unix
    ms time, which the runner times everything from) and VICTORY_FRAME_TIMES_FILE (every present interval, a line a
    second, for exact percentiles over any window).
  • xgamesave.rs: VICTORY_SAVES_READONLY=1 gives the title a throwaway copy of its saves (of VICTORY_SAVES_FROM, under
    VICTORY_SAVES_THROWAWAY): every run starts from the same save and its autosaves never reach the real ones.

Runner and data:

  • scripts\autotest.ps1 (runs victory play <exe> --set ..., presses Enter through the menus, writes the command lines
    as the run goes, takes shots, summarises), scripts\issue-scenarios.ps1 (worst-case places, night and rain; not for
    A/B). A machine-wide lock (Global\victory-autotest) queues runs from several checkouts.
  • scripts\bench\title-hooks.toml: the commands' places for game_scarlett_master.exe 1.0.2.1 only, checked by bytes.
    scripts\bench\spots.toml: places, routes and scenario presets in that build's world. Values are places, our own names
    and short byte signatures (as victory-loader's scenes.rs has); cargo xtask policy passes.
  • docs/benchmark.md: setup, scenarios, validity, how the commands are called, credits.

Credits: the commands' places in this build and their argument layouts come from the tables of modpapi/scripthook-vi,
ifBars/palmhook, viper-community/viper and fraustiz/fro-trainer (facts only; none of their code is here).

How it was tested

  • GPU and profile: RTX 5070 Ti 16 GB, Ryzen 9 9900X, Windows 11, title 1.0.2.1; Series X 1440p, DLSS Quality, no frame
    generation, no frame cap: victory play's defaults. Release build of this branch on 5fabb46e (in the runs below
    merged with one other, off-by-default change whose switches were off in these runs).

  • 7 runs of -Scenario drive-downtown-calm with nothing else set, 2026-12-01, over ~1.5 hours with other test runs
    between them: every run valid (in his car, alive, never stood), the car moved 2-3 s after the order and drove 830 m in the 75 s window. Run to run:

    run fps p50 ms p85 p99 frames over 50 ms over 100 ms submitting thread ms draws a frame (median)
    1 22.6 42.0 57.9 84.7 477 6 39.6 7,057
    2 22.6 41.9 59.6 87.2 464 8 39.3 7,099
    3 22.4 41.7 60.6 95.1 495 10 38.3 7,041
    4 22.9 41.8 57.8 88.6 464 8 39.1 7,327
    5 20.4 45.9 67.8 115.2 600 38 40.7 7,024
    6 23.2 40.8 59.0 91.9 452 9 37.4 7,322
    7 23.3 40.6 58.2 89.2 450 10 36.8 7,064

    Six of seven within 22.4-23.3 fps and 450-495 frames over 50 ms; one run 10% slower. So: A B B A, three or four runs
    a side. One error line in every run's log: Streamline's "presentCommon() was not observed" notice.

  • Launch to the measured window ~50 s (boot to scene live ~21-25 s, the car carried downtown and ordered 25 s after live);
    a run ~2.5 min.

  • cargo test --locked -p victory-loader (83 passed; script_calls' own: the stub, argument slots, rooms, every,
    hooks files, legs, direct calls), cargo test --locked -p victory-hle --lib xgamesave (17 passed), cargo xtask policy
    (ok). cargo clippy --workspace --all-targets --locked -- -D warnings fails on main already (host/font.rs
    too_many_arguments x2, host/menu.rs manual_is_multiple_of, host/panel.rs collapsible_if x2, from #4635); with those
    three lints allowed it passes with this branch.

  • 1 run of -Scenario fight-calm: valid, 8 fighters made (10 with replacements, 0 refused), 28.9 fps, p50 34.2 ms, p85
    43.5, p99 65.8, 108 frames over 50 ms, submitting thread 30.9 ms, 5,835 draws a frame; launch to the measured window
    39 s, the run 84 s.

  • Not tested on this branch: the spots, teleport drives and issue scenarios (they ran on our fork for two days with the
    same code), other builds of the title (refused by design), AMD cards, Series S, frame generation on.

Size

~4,100 lines, most of them the runner script (970), the data files (910) and script_calls.rs (1,330). It splits
cleanly if that is easier to review: (1) the layer support (script calls, scene-live and frame-times files, throwaway
saves: ~1,850 lines of Rust, nothing on without a switch), then (2) the runner, data and docs (~2,350).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #2825
    (victory-probe-mod: a mod DLL with teleports, a held clock and unattended test plans, by debug-register breakpoints,
    outside the workspace). This one is in the layer (one call-site redirect, off without its switch) and has the title's
    own driving and combat tasks do the moving, which is where frames are worst; the two do not touch the same files.
    scripts\bench.ps1 measures the free-roaming world from frame lines and is left as it is.

🤖 Generated with Claude Code

**@⁠bentsignal** on GitHub · 2026-12-01 14:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4940) `bentsignal:scenario-bench` → `main` · +4204 −3 · 14 files · 3 commits · open ## What it changes A benchmark for A/B measurements that needs nobody at the PC and repeats: `scripts\autotest.ps1 -Scenario drive-downtown-calm` boots the title from a fixed save, and once the world is live starts a scenario through the title's **own script commands**: the player is seated in his car and the title's own driving task takes it round a loop of downtown streets through its traffic (or over the bridges and the highway, or 8 armed peds fight around him). Every frame of a fixed window is measured, and the run is checked for validity (still in his car, alive, not wrecked, not standing). The car, its physics, the route, the traffic, the AI and the streaming are the title's; recorded pad input could not do that (a replay parts from its recording within seconds, and a walk never reaches downtown traffic). Nothing changes for players: every part is off unless its switch is set, and only the runner sets them. Layer (Rust): - `crates/victory-loader/src/script_calls.rs` (+ `direct.rs`, `legs.rs`): with `VICTORY_TITLE_HOOKS=<file>` the title's script machine's one call of a command's handler goes through us (a call-site redirect, bytes checked first; another build is refused and nothing is changed). There the lines of `VICTORY_SCRIPT_CALLS_FILE` run on the title's script thread between two of its commands: commands and actions named in the hooks file, `every` (the title's "this frame" commands held), `until` (wait for a result), `legs` (a route handed to the title's go-to driving a leg at a time), `call` (a title function the file names, bytes checked before every call). `VICTORY_NATIVE_CENSUS=<file>` counts every command the title's scripts call, to find new ones. Called from `run.rs` next to `write_sites::apply_asked`. - `host.rs`: `VICTORY_SCENE_FILE` (the first second with 1000+ draws a frame: "scene live", logged and written as a Unix ms time, which the runner times everything from) and `VICTORY_FRAME_TIMES_FILE` (every present interval, a line a second, for exact percentiles over any window). - `xgamesave.rs`: `VICTORY_SAVES_READONLY=1` gives the title a throwaway copy of its saves (of `VICTORY_SAVES_FROM`, under `VICTORY_SAVES_THROWAWAY`): every run starts from the same save and its autosaves never reach the real ones. Runner and data: - `scripts\autotest.ps1` (runs `victory play <exe> --set ...`, presses Enter through the menus, writes the command lines as the run goes, takes shots, summarises), `scripts\issue-scenarios.ps1` (worst-case places, night and rain; not for A/B). A machine-wide lock (`Global\victory-autotest`) queues runs from several checkouts. - `scripts\bench\title-hooks.toml`: the commands' places for **game_scarlett_master.exe 1.0.2.1** only, checked by bytes. `scripts\bench\spots.toml`: places, routes and scenario presets in that build's world. Values are places, our own names and short byte signatures (as `victory-loader`'s `scenes.rs` has); `cargo xtask policy` passes. - `docs/benchmark.md`: setup, scenarios, validity, how the commands are called, credits. Credits: the commands' places in this build and their argument layouts come from the tables of modpapi/scripthook-vi, ifBars/palmhook, viper-community/viper and fraustiz/fro-trainer (facts only; none of their code is here). ## How it was tested - GPU and profile: RTX 5070 Ti 16 GB, Ryzen 9 9900X, Windows 11, title 1.0.2.1; Series X 1440p, DLSS Quality, no frame generation, no frame cap: `victory play`'s defaults. Release build of this branch on `5fabb46e` (in the runs below merged with one other, off-by-default change whose switches were off in these runs). - 7 runs of `-Scenario drive-downtown-calm` with nothing else set, 2026-12-01, over ~1.5 hours with other test runs between them: every run valid (in his car, alive, never stood), the car moved 2-3 s after the order and drove 830 m in the 75 s window. Run to run: | run | fps | p50 ms | p85 | p99 | frames over 50 ms | over 100 ms | submitting thread ms | draws a frame (median) | |---|---|---|---|---|---|---|---|---| | 1 | 22.6 | 42.0 | 57.9 | 84.7 | 477 | 6 | 39.6 | 7,057 | | 2 | 22.6 | 41.9 | 59.6 | 87.2 | 464 | 8 | 39.3 | 7,099 | | 3 | 22.4 | 41.7 | 60.6 | 95.1 | 495 | 10 | 38.3 | 7,041 | | 4 | 22.9 | 41.8 | 57.8 | 88.6 | 464 | 8 | 39.1 | 7,327 | | 5 | 20.4 | 45.9 | 67.8 | 115.2 | 600 | 38 | 40.7 | 7,024 | | 6 | 23.2 | 40.8 | 59.0 | 91.9 | 452 | 9 | 37.4 | 7,322 | | 7 | 23.3 | 40.6 | 58.2 | 89.2 | 450 | 10 | 36.8 | 7,064 | Six of seven within 22.4-23.3 fps and 450-495 frames over 50 ms; one run 10% slower. So: A B B A, three or four runs a side. One error line in every run's log: Streamline's "presentCommon() was not observed" notice. - Launch to the measured window ~50 s (boot to scene live ~21-25 s, the car carried downtown and ordered 25 s after live); a run ~2.5 min. - `cargo test --locked -p victory-loader` (83 passed; script_calls' own: the stub, argument slots, rooms, `every`, hooks files, legs, direct calls), `cargo test --locked -p victory-hle --lib xgamesave` (17 passed), `cargo xtask policy` (ok). `cargo clippy --workspace --all-targets --locked -- -D warnings` fails on `main` already (host/font.rs too_many_arguments x2, host/menu.rs manual_is_multiple_of, host/panel.rs collapsible_if x2, from #4635); with those three lints allowed it passes with this branch. - 1 run of `-Scenario fight-calm`: valid, 8 fighters made (10 with replacements, 0 refused), 28.9 fps, p50 34.2 ms, p85 43.5, p99 65.8, 108 frames over 50 ms, submitting thread 30.9 ms, 5,835 draws a frame; launch to the measured window 39 s, the run 84 s. - Not tested on this branch: the spots, teleport drives and issue scenarios (they ran on our fork for two days with the same code), other builds of the title (refused by design), AMD cards, Series S, frame generation on. ## Size ~4,100 lines, most of them the runner script (970), the data files (910) and `script_calls.rs` (1,330). It splits cleanly if that is easier to review: (1) the layer support (script calls, scene-live and frame-times files, throwaway saves: ~1,850 lines of Rust, nothing on without a switch), then (2) the runner, data and docs (~2,350). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #2825 (victory-probe-mod: a mod DLL with teleports, a held clock and unattended test plans, by debug-register breakpoints, outside the workspace). This one is in the layer (one call-site redirect, off without its switch) and has the title's own driving and combat tasks do the moving, which is where frames are worst; the two do not touch the same files. `scripts\bench.ps1` measures the free-roaming world from frame lines and is left as it is. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With VICTORY_TITLE_HOOKS=<file> the title's script machine's one call of a
command's handler is changed at load to go through us (the call site's bytes
are checked first: another build is refused and nothing is changed). There
the command lines of VICTORY_SCRIPT_CALLS_FILE (appended while the title
runs) are run on the title's own script thread, between two of its
commands: the commands and actions the hooks file names, `every` (a line
again every n ms: the title's "this frame" commands held), `until` (a line
polled until its result is as wanted, logged when met), `legs` (a route
handed to the title's go-to driving a leg at a time, the next when the player
is near the current one, the order again when stuck), and `call` (a title
function the hooks file names, its first bytes checked before every call).
VICTORY_NATIVE_CENSUS=<file> counts every command the title's scripts call,
with argument and result samples, to find new ones.

This is what scripts\autotest.ps1's scenarios use: the title drives, fights
and moves the player by itself. Called from run.rs beside the write sites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What a test runner needs from the layer, each off without its switch:
- scene live: the first second whose frames had VICTORY_SCENE_DRAWS (1000)
  draws or more on average (the title screen, menus and loading text draw
  under 100), logged once and, with VICTORY_SCENE_FILE=<file>, written there
  as a Unix ms time: a runner times its keys, command lines and window from
  it instead of from the start.
- VICTORY_FRAME_TIMES_FILE=<file>: every interval between presents, a line a
  second (Unix ms, then the intervals), for exact percentiles over any window
  of a run.
- VICTORY_SAVES_READONLY=1: the title is given a fresh copy of its saves (of
  VICTORY_SAVES_FROM if set, under VICTORY_SAVES_THROWAWAY): every run starts
  from the same save, and its autosaves never reach the real ones.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scripts\autotest.ps1 runs the title unattended through `victory play` from a
fixed save (a throwaway copy each run), presses Enter through the menus,
and once the scene is live starts a scenario through the title's own script
commands: the player seated in his car and driven by the title's driving
task through its traffic (drive-downtown-calm, drive-highway-calm, -fast,
-stress, -gentle), armed peds fighting around him (fight-calm, ...), or the
player put at a named place (-Spot) or hopped along a route (-Drive). It
measures every frame of a fixed window (fps, median, p85, p99, frames over
33.3 / 50 / 100 ms, the submitting thread, draws), checks the run is valid
(in his car, alive, not wrecked, not standing; INVALID exits 3, -Retries
runs it again), and takes a machine-wide lock so several checkouts can queue
runs. scripts\issue-scenarios.ps1 adds the worst-case kinds (look,
region-drive, session) for finding issues, not for A/B.

scripts\bench\title-hooks.toml names the commands' places for
game_scarlett_master.exe 1.0.2.1 only (the call site's and every function's
bytes are checked: another build is refused); scripts\bench\spots.toml holds
the places, routes and presets. The places and argument layouts come from
the tables of scripthook-vi, palmhook, VIper and fro-trainer (credited in
the files and docs/benchmark.md).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 14:56:35 +00:00
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/4941/head:github-bot/gh-4940'
git switch 'github-bot/gh-4940'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4940'
git switch 'github-bot/gh-4940'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4940'
git switch 'github-bot/gh-4940'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4940'
git switch 'main'
git merge --squash 'github-bot/gh-4940'
git switch 'main'
git merge --ff-only 'github-bot/gh-4940'
git switch 'main'
git merge 'github-bot/gh-4940'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4941
No description provided.