mirror of
https://github.com/lobomfz/VIctory-xmem.git
synced 2026-12-06 05:48:38 +00:00
feat(run): add BENCH_NO_RESTART and document automated benchmark routes
This commit is contained in:
16
AGENTS.md
16
AGENTS.md
@ -77,6 +77,22 @@ The user plays; the agent arms, marks and analyses.
|
||||
|
||||
Output of `run.sh shaders`, `warm` and `play` goes to a file. Take the exit code and the summary lines from it with `tail`, `grep` or `awk`; only figures reach the context.
|
||||
|
||||
### Automated benchmark routes (`VICTORY_BENCH_ROUTE`)
|
||||
|
||||
Unattended, reproducible benchmarks use `VICTORY_BENCH=nort|rt`, `VICTORY_BENCH_ROUTE=downtown` (one full 2400 m lap takes ~5 min 20 s plus ~30 s warm-up skip → use `VICTORY_BENCH_MINUTES=6`; `drive` is experimental and non-comparable), and **`BENCH_NO_RESTART=1`**:
|
||||
|
||||
```sh
|
||||
./run.sh play VICTORY_BENCH=nort VICTORY_BENCH_MINUTES=6 VICTORY_BENCH_ROUTE=downtown BENCH_NO_RESTART=1 > local/run/play-bench-nort.log 2>&1
|
||||
```
|
||||
|
||||
- **Why `BENCH_NO_RESTART=1` matters:** by default, `VICTORY_BENCH` closes the game after `VICTORY_BENCH_MINUTES`, writes `local/benchmark/<ts>-<mode>/bench_stats.txt` + `bench_results.txt` + `screenshot.png`, and then **`run.sh` automatically restarts the game into normal play**. Passing `BENCH_NO_RESTART=1` stops `run.sh` cleanly right after `bench_results.txt` is written.
|
||||
- **Standalone routes never auto-close:** running `VICTORY_BENCH_ROUTE=downtown` (or `drive`) *without* `VICTORY_BENCH=nort|rt` does not stop the game on its own — stop it explicitly once done.
|
||||
- **Closing the game reliably (scope vs. gamescope / manual launches):**
|
||||
- Always verify no game process remains after any automated or aborted run before finishing or starting another run.
|
||||
- When started via `./run.sh play`, Wine runs inside a transient user scope `um-play-<pid>.scope`: check `systemctl --user list-units --state=active 'um-*.scope'` and stop it with `systemctl --user stop 'um-play-*.scope'`.
|
||||
- When started manually or wrapped in `gamescope`, the process tree, PID, or systemd unit differs from a direct `./run.sh` launch. Do not assume a single hardcoded PID or unit name: also check `pgrep -af 'victory\.exe|game_scarlett_master'` and terminate any leftover `victory.exe` process cleanly (e.g. `pkill -TERM -f 'victory\.exe run'`, waiting for it to exit so `wineserver` flushes saves cleanly before escalating to `-KILL`).
|
||||
- Arm `./tools/sample.sh` alongside automated benchmarks just like manual runs, and take the route start timestamp from the log (`bench_route:` line) for `tools/analyze.py` beside `bench_stats.txt`.
|
||||
|
||||
The trace needs the user's sudo: `sudo ./local/perf/wine-trace.sh --check`, then `sudo ./local/perf/wine-trace.sh` before the game. It writes `local/perf/wine-trace-<UTC>.log`; its offsets are for the ntdll.so of GE-Proton11-16.
|
||||
|
||||
## Recording
|
||||
|
||||
32
README.md
32
README.md
@ -349,6 +349,35 @@ the card was, and one line for every five seconds. That output is short
|
||||
enough to paste into an issue. The runs in this project's record are a minute
|
||||
on foot and a minute driving, measured this way.
|
||||
|
||||
### Benchmark routes
|
||||
|
||||
```sh
|
||||
./run.sh play VICTORY_BENCH=nort VICTORY_BENCH_MINUTES=6 VICTORY_BENCH_ROUTE=downtown BENCH_NO_RESTART=1
|
||||
./run.sh play VICTORY_BENCH=rt VICTORY_BENCH_MINUTES=6 VICTORY_BENCH_ROUTE=downtown BENCH_NO_RESTART=1
|
||||
./run.sh play VICTORY_BENCH_ROUTE=downtown # watch the route without benchmark timing
|
||||
```
|
||||
|
||||
`VICTORY_BENCH_ROUTE` moves the player along a fixed route built into VIctory
|
||||
(no mods needed, game build 1.0.2.1; credit in [THIRD-PARTY.md](THIRD-PARTY.md)).
|
||||
After a 15 s settle and streaming in the ground/car, it pauses the clock at
|
||||
12:00, holds clear sunny weather, disables wanted level, and makes the player
|
||||
invincible:
|
||||
|
||||
- `downtown`: a noclip flight around a 2400 m square over the city (`-2600, -1000`),
|
||||
at 30 m/s, 40 m above smoothed ground in a Dinka Blista with camera sweep.
|
||||
One lap is about 5 min 20 s; the first 30 s are skipped from benchmark
|
||||
figures, so use `VICTORY_BENCH_MINUTES=6` for a full lap.
|
||||
- `drive`: **experimental, not comparable across runs.** The game's AI drives a
|
||||
Blista with traffic between fixed road points and may pick different routes.
|
||||
|
||||
With `VICTORY_BENCH=nort|rt`, benchmark runs force `VICTORY_FRAME_INTERVAL_MS=0`
|
||||
(uncapped), press Enter automatically from 5 to 65 s, save `screenshot.png`,
|
||||
`bench_stats.txt` and `bench_results.txt` under `local/benchmark/`, and close
|
||||
the game after `VICTORY_BENCH_MINUTES`. Add `BENCH_NO_RESTART=1` for unattended
|
||||
runs so `run.sh` exits immediately instead of restarting the game with your
|
||||
normal settings. Standalone `VICTORY_BENCH_ROUTE=...` runs (without
|
||||
`VICTORY_BENCH`) do not close automatically.
|
||||
|
||||
### Working on the code
|
||||
|
||||
Open questions that someone could pick up are filed as
|
||||
@ -492,7 +521,8 @@ VICTORY_FRAME_INTERVAL_MS=10
|
||||
| `VICTORY_RECORD_PLACES=0`, `VICTORY_RECORD_RANGES=0` | Both on by default (`1`): textures read their slot-table places from their record (`2` for typed buffers too when ranges are off), and raw/constant buffers read their address range from their record without the host range table. Changing either changes the shader cache key |
|
||||
| `VICTORY_EARLY_DEPTH=0` | On by default: emit `ForceEarlyDepthStencil` on every pixel shader that asks for early depth without exporting depth/stencil/coverage (`0`: cell-window prepass only). Changes the shader cache key |
|
||||
| `VICTORY_CACHE_PRUNE=1` | Off by default: have `victory shaders` remove translations unused for 14+ days and `victory warm` remove older pipeline-cache key folders (keeping the newest) |
|
||||
| `VICTORY_BENCH=rt`, `VICTORY_BENCH=nort` | A benchmark run with fixed settings (4K, FSR quality, ray tracing on or off) that closes itself after `VICTORY_BENCH_MINUTES` (5); results in `local/benchmark/`. The `F1` menu's benchmark rows start the same run |
|
||||
| `VICTORY_BENCH=rt`, `VICTORY_BENCH=nort` | A benchmark run with fixed settings (4K, FSR quality, `VICTORY_FRAME_INTERVAL_MS=0`, ray tracing on or off) that closes itself after `VICTORY_BENCH_MINUTES` (5); results in `local/benchmark/`. The `F1` menu's benchmark rows start the same run. Add `BENCH_NO_RESTART=1` to exit instead of restarting into normal play |
|
||||
| `VICTORY_BENCH_ROUTE=downtown` | Fixed benchmark route (`downtown` for reproducible comparisons, or experimental `drive`); see [Benchmark routes](#benchmark-routes) |
|
||||
| `VICTORY_KEYS=1` | Log game-side keyboard events as the title reads them |
|
||||
| `VICTORY_KEYS_FILE=<file>` | Diagnostics build: holds the keys the file names, to drive a running game from a shell |
|
||||
| `VICTORY_DSP_CONVOLVE=0` | On by default: disable mono audio DSP convolutions (falls back to short pass-through / silence) to isolate DSP CPU load |
|
||||
|
||||
8
run.sh
8
run.sh
@ -3,7 +3,7 @@
|
||||
mapfile -d '' given < <(env -0)
|
||||
restart_env=()
|
||||
for kv in "${given[@]}"; do
|
||||
case "$kv" in VICTORY_BENCH=*|VICTORY_BENCH_MINUTES=*|VICTORY_BENCH_ROUTE=*) ;; *) restart_env+=("$kv");; esac
|
||||
case "$kv" in VICTORY_BENCH=*|VICTORY_BENCH_MINUTES=*|VICTORY_BENCH_ROUTE=*|BENCH_NO_RESTART=*) ;; *) restart_env+=("$kv");; esac
|
||||
done
|
||||
source "$(dirname "$(readlink -f "$0")")/env.sh"
|
||||
source "$root/tools/built.sh"
|
||||
@ -231,12 +231,12 @@ else
|
||||
fi
|
||||
if [ -n "$bench" ] && [ -z "$again" ]; then
|
||||
"$root/tools/bench-results.sh" "$benchdir" "$bench" "$code" "$root"
|
||||
# Back to the user's own settings, unless the run was closed by hand.
|
||||
if [ -f "$benchdir/bench_stats.txt" ] || (( code != 0 )); then again=1; fi
|
||||
# Back to the user's own settings, unless the run was closed by hand or BENCH_NO_RESTART=1.
|
||||
if [ "${BENCH_NO_RESTART:-0}" != 1 ] && { [ -f "$benchdir/bench_stats.txt" ] || (( code != 0 )); }; then again=1; fi
|
||||
fi
|
||||
if [ -n "$again" ]; then
|
||||
restart_args=()
|
||||
for kv in "$@"; do case "$kv" in VICTORY_BENCH=*|VICTORY_BENCH_MINUTES=*|VICTORY_BENCH_ROUTE=*) ;; *) restart_args+=("$kv");; esac; done
|
||||
for kv in "$@"; do case "$kv" in VICTORY_BENCH=*|VICTORY_BENCH_MINUTES=*|VICTORY_BENCH_ROUTE=*|BENCH_NO_RESTART=*) ;; *) restart_args+=("$kv");; esac; done
|
||||
[[ $next =~ ^(rt|nort):([0-9]+)$ ]] && restart_args+=("VICTORY_BENCH=${BASH_REMATCH[1]}" "VICTORY_BENCH_MINUTES=${BASH_REMATCH[2]}")
|
||||
echo "Restarting the game..."
|
||||
# Let the old session give its memory back first: the RAM cap of the next
|
||||
|
||||
Reference in New Issue
Block a user