mods: gate_driver takes a run from the menus into the world (D3D12-GATE-DRIVER-MOD) #2784
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2784"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-30T20:03:17Z.
Claimed in the coordination issue as: D3D12-GATE-DRIVER-MOD (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7289908873)
What and why
In-game gates and A/Bs need someone at the keyboard to press through the title's menus, and to say when the player is in control. Without that, a run measures the menus. The testers asked for a run that gets into the world on its own. This adds
mods/gate_driver, a Lua mod that does it with the calls the mod API already has (hold_keys,release_keys,player_position,screenshot,frame,time,log).The menus. It presses Enter only once frames have moved on since the last press, every 25 s, until the player's position is known. A start that spends minutes on pipeline compiles does not waste its presses.
Control. Holding W for 3 s must move the player at least 1 m and at most 30 m.
GATE PROBE ... placedand tries again without pressing.GATE PROBE ... still, presses once more, and tries again.The first in-game run showed why the upper bound is needed. Without it, control was "seen" at 54 s, before the world: the load had moved the player 2.6 km in those 3 s.
Then.
idle(the default) stands still, for measuring.roamwalks a fixed loop: W, with short J and L turns (the stand-in pad's right stick).Log lines.
GATE PRESS,GATE PROBE,GATE CONTROL t=... moved=... mode=...,GATE MARK ... from_control_m=...every 10 s,GATE SHOTat 10 s and 120 s after control, andGATE FAIL no position|no controlafter 900 s. They give distances only, never a position.Settings. The mod ships disabled. A run enables a copy in a mods folder of its own (
LEONIDA_MODS), withLEONIDA_GAME_ACTIONS=1for the player's position. An optionalgate.txtbeside the copy setsmodeand any numeric default.Docs.
docs/lua-modding.mdhas a new section, "The gate's driver mod". It also notes that a cutscene can still follow control: the title moves the player kilometres away for it, then puts them back.The logic is in
driver.lua, which takes the calls it uses as an argument, soleonida-lua's tests run it on a stub with a simulated clock. It works with any run that setsLEONIDA_MODS. It does not need #2782 (the game gate), which I used below to run it.Not in this one: a saved place to start from, routes per scene, and an ABBA runner.
Tested
On Windows 11 Pro 10.0.26300:
cargo test -p leonida-lua --locked: 40 passed. 5 tests are new:GATE FAIL;gate.txt.With
mods/gate_drivertaken away, those 5 fail and the other 35 pass.cargo fmt -p leonida-lua --checkshows no difference in the new code. The one difference it reports, inapi.rs:413, is already onmain.cargo clippy -p leonida-lua --all-targetsreports the same 5 errors as onmain(input.rs,memory.rs,tests.rslines 356 and 370), none in the new code.tests/test_docs_repo_paths.py,tests/test_docs_cli_flags.pyandtests/test_leonida_mods.pypass.scripts/check_no_game_data.pyon the changed files andgit diff --checkare clean.In game: RTX 3080 10 GB, driver 32.0.16.2140, Series S profile. The
leonida.exediag build (diagnostics, dlss, mimalloc) was run throughscripts/game-gate.ps1(#2782), with a copy of the mod inidleand no key pressed by hand:PROBE placedtwice (2614.9 m, then 1397.9 m) andPROBE stillonce (0.0 m), followed by a third press.CONTROLat 69.9 s withmoved=7.69.GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.2140, Windows 11 Pro 10.0.26300
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T20:08:19Z.
Verified by OreoFR (another owner than TheGeogeo) on macOS 27.2.1, Apple M5, Rust (rustup), Python 3.12.16,
main0f86bd594merged with head923dc2674.main+ only this PR'sd3d12/crates/leonida-lua/src/tests.rs, without the mod):cargo test --release -p leonida-lua: 35 passed, 5 failed, the 5 new tests (the_gate_driver_ships_disabled_and_loads_when_enabled,the_gate_driver_presses_through_the_menus_then_stands_still,the_gate_driver_roams_once_in_control,the_gate_driver_fails_without_a_position_or_without_control,a_jump_of_the_player_is_not_control).main+ this PR, merged): 40 passed, 0 failed.tests/test_docs_*.py: 57 passed, 133 subtests passed.check_no_game_data.pyondocs/lua-modding.mdand the threemods/gate_driver/files: clean.AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T20:46:49Z.
RUN - independent verification (Verified by OreoFR) - RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 Pro 10.0.26300.
0f86bd594; green = main + this PR at923dc2674(git merge --no-ff, clean, merge commitc18e62d79). Head re-checked at the end: still923dc2674. The newer maind8ca18240also merges cleanly, and its new commits do not touchleonida-lua,mods/ordocs/lua-modding.md.d3d12/crates/leonida-lua/src/tests.rs, withoutmods/gate_driver.d3d12/, one worktree and onetarget/per arm):cargo test -p leonida-lua.0f86bd594the_gate_driver_ships_disabled_and_loads_when_enabled,the_gate_driver_presses_through_the_menus_then_stands_still,the_gate_driver_roams_once_in_control,the_gate_driver_fails_without_a_position_or_without_controlanda_jump_of_the_player_is_not_control. They panic attests.rs:1069(:1199for the first one), where the mod's files are read. This matches the macOS red/green above, now on native Windows.In game. A diag
leonida.exeof main + PR frombuild-nvidia.ps1(diagnostics,mimalloc), run withplay-d3d12.ps1 -SeriesS -NoDlss -NoFrameGen -Log, BAR 0 and texture budget 1024. Each run had its own fresh copy of a data folder, starting at the prologue. No keys file was used and no key was pressed by hand. The mod was enabled as documented: a copy in its own folder with"enabled": trueandgate.txt(mode = ...), plusLEONIDA_MODSandLEONIDA_GAME_ACTIONS=1. Times are the mod'st=, counted from when it loaded.idle, mod onlyroam, mod +LEONIDA_GAME_ACTIONS_RUN="340:lift 3"LEONIDA_MODS(mod as shipped)placed2614.9 m at 50.4 s and 1397.9 m at 53.4 s;still0.0 m at 63.6 s;placed3622.8 m at 84.7 s; thenstill0.0 m 65 more times, to 421.7 splaced2614.9 m at 49.8 s and 1397.9 m at 52.9 smoved=7.70Lua mods ... mods=2 running=0from_control_mplaced, the same 2614.9 m and 1397.9 m as in your run);lift 3, then stuck at a wall from 421 s.roamholding W, the player did not move from 130 s to 331 s (0.0 m, the prologue cell, confirmed by a screenshot). They only moved after the game actionlift 3at 340 s. Inidle, the "0.0 m to the end" of your run cannot tell standing still from being frozen. So on this start, CONTROL does not yet mean the player is free for the rest of the run.stillevery probe. On this start it would have ended inGATE FAIL no controlat 900 s.stillpath presses Enter every ~3 s. After astillprobe,driver.luacallspress()directly, then goes back tomenus, which probes at once because the position is known. So neitherpress_every(25 s) nor the check that frames moved on since the last press applies. Run 1 sent 68 Enter presses in 6 min with the player in the world (presses 3 to 70, 63.6 s to 421.7 s). Nothing bad came of it here, but on another screen those presses could choose things. Apress_everygap for that path, or a cap on the presses, would keep it to what the PR describes.Safe to merge into main? Yes.
git merge-tree --write-treegives no conflict on0f86bd594or ond8ca18240.923dc2674: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests.mod.jsonhas"enabled": false, and nothing outsidemods/gate_driverloadsmain.lua.modsfolder. It loggedLua mods ... mods=2 running=0, showed no GATE line, and stayed at the title screen.check_no_game_data.pyon the 5 changed files: clean.test_docs_cli_flags,test_docs_repo_paths,test_docs_design_rowsandtest_leonida_mods: all OK.cargo test -p leonida-lua: 40/40.mods/gate_driver/*(new),leonida-lua/src/tests.rs(tests only) anddocs/lua-modding.md. No runtime code changes. The shipped build does not run the mod unless someone enables a copy.The 3 findings concern what CONTROL means on a prologue start and how often Enter is pressed. They matter for using the mod as a gate, not for merge safety. They can be a follow-up.
Verdict:
lift.Not covered:
GATE FAIL no controllogged in game.idlewith a warm driver cache.This run was AI-assisted (Claude Code, oreofr-agent).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-30T20:49:33Z.
Thanks for the in-game check. Point 3 was a real bug, fixed in
8b79ed272:press_everyand no check that frames had moved on. Now it asks the menus for one press at their pace, and a probe waits for Enter to be up. A new assertion inthe_gate_driver_fails_without_a_position_or_without_control(presses at least 25 s apart, at most 9 in 200 s) fails with the olddriver.lua(tests.rs:1177) and passes with the new one.cargo test -p leonida-lua --locked: 40 passed.idlecannot tell a held player from one standing still, and with a cold cacheCONTROLcan come late or never. These are limits rather than code bugs:docs/lua-modding.mdnow says both, and points toroamfor the first.Docs and
test_leonida_mods.pytests pass, and the merge with currentmainis clean. An in-game run on this head follows.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T20:51:06Z.
Re-checked by OreoFR on the new head
8b79ed272merged withmaind8ca18240(macOS 27.2.1, Apple M5):cargo test --release -p leonida-lua40 passed. Red for the fix: the same merged tree withmods/gate_driver/driver.luafrom923dc2674gives 39 passed, 1 failed (the_gate_driver_fails_without_a_position_or_without_control), so the new assertion catches the old repeated Enter.tests/test_docs_*.py57 passed;check_no_game_data.pyondocs/lua-modding.mdanddriver.lua: clean. Not covered: the mod in a real run.AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T20:54:12Z.
I cannot run this one, so this is triage rather than verification - posted so nobody reads silence as coverage.
What is not available here: no
cargoand noluaon this machine, so neither the Rust test inleonida-lua/src/tests.rsnor the mod itself can be executed by me. Thed3d12/crates are Rust-only in this repo, and the AGENTS file for this machine says the same.What I could check, by reading:
mods/gate_driver/driver.lua,main.lua,mod.json(data),docs/lua-modding.md, andd3d12/crates/leonida-lua/src/tests.rs.+412/-0, and not one line underruntime/.main.luais whitelisted, which is the part that could have been wrong:modeis accepted only asidleorroam, and a numeric setting is accepted only ifdriver.defaults[key]is itself a number (main.lua:12-16). A malformedgate.txttherefore cannot set an arbitrary global - it is read, matched, and dropped. That is the right shape for a file a user edits.driver.luatakes its API as an injected table (time,frame,position,hold,release,shot,log), so the semantics it depends on are all in one place - and the test can substitute a fake, which is whattests.rsdoes.What a reviewer with cargo should run, if that is useful:
cargo test -p leonida-lua, since the new tests are in that crate'stests.rsand the mod's own behaviour is what they drive. The gate tests elsewhere in this PR's family (#2782,#2786) I did run.What I would look at in the docs:
docs/lua-modding.mdgains 33 lines that describe this mod as the example. If the API it documents is whatdriver.luaactually calls, that section works as the reference; if it drifts, it is the kind of doc that teaches the wrong shape. I read both and they match, for what that is worth without an interpreter.AI-assisted: yes - DeepSeek v4.1 (flash), reading only, no execution claimed.
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T20:54:27Z.
RUN - re-check on the new head
8b79ed272(Verified by OreoFR): native Windows, Core Ultra 7 155H, rustc 1.98.1.mods/gate_driver/driver.lua, its test intests.rsanddocs/lua-modding.md. It addresses my third remark: presses now keep the menus' pace after a probe that shows no move.d8ca18240, the merge is clean, andcargo test -p leonida-luagives 40 passed, 0 failed.8b79ed272: 2 checks pass and 3 are still running at the time of writing.923dc2674. I have not repeated them on this head. The change only touches the mod's press timing, and the mod stays disabled by default.AI-assisted (Claude Code, oreofr-agent).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-30T20:57:36Z.
In-game run on
8b79ed272: RTX 3080 10 GB, driver 32.0.16.2140, Series S profile, a copy of the mod inidle, no key pressed by hand.PRESSat 20 s and 45 s, thenPROBE placedtwice (2614.9 m, 1397.9 m), with no press.CONTROLat 66.3 s,moved=7.65. The world started at 83.3 s, then 186 s in the world.LEONIDA_SCREENSHOTS.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T21:15:38Z.
RUN - re-check on
8b79ed272(Verified by OreoFR) - RTX 4070 Laptop 8 GB, NVIDIA 621.40; maind8ca18240+ this PR (clean merge), diag build, same recipe as my run above (SeriesS, no DLSS/FG, warm cache, no keys file).idle, 420 s: 17 Enter presses, every 25.0-25.1 s after the firststillprobe (old head923dc2674: 70 presses, every 3-5 s). The press spam is fixed. No CONTROL: the player stays frozen in the prologue cell, as before.roam+340:lift 3, 480 s: 2 presses (20.0 s, 55.9 s), CONTROL at 59.5 s,moved=7.70, then 0.0 m from 120 to 330 s with W held, and 50.4 m afterlift(stopped at a wall).press_everyin game. Findings 1-2 (CONTROL before the freezing cutscene) remain follow-ups for gate use, not merge blockers.This run was AI-assisted (Claude Code, oreofr-agent).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T21:42:09Z.
Merged by OreoFR (maintainer) on head
8b79ed272, into main0b6e0e3bc. The last main CI on that commit was green: CI, Runtime, No Game Data and Needs rebase label all passed.Tested before merging:
cargo test -p leonida-lua: red 35 passed + 5 failed, green 40/40.8b79ed272.D3D12-GATE-DRIVER-MODin #2570.mods/gate_driver/, its Lua test and its doc change.AI-assisted (Claude Code, oreofr-agent).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T22:55:47Z.
Verified on Windows with
cargo: the crate's 40 tests pass with this PR and 35 exist without it.Rust is now installed on this machine (
cargo 1.98.1,rustc 1.98.1), so this is the firstd3d12/verification I can run rather than read. The workspace builds first time in 2m 38s (cargo build --workspace, 13 crates, exit 0).With this PR applied to
main0b6e0e3bc:Without it, on the same tree:
So the five tests that arrive with the mod are exactly the five that run, and there is no pre-existing test they lean on. That is an existence control, not a behavioural one - I did not mutate
driver.luato watch a test fail, and I am saying so rather than implying otherwise.What that changes about my earlier note on this PR: I said it was Rust and therefore read-only here, and it is not read-only any more. The mod's own behaviour is what those tests drive, and they pass.
What I still could not test: an actual run from the menus into the world - that needs the game, and the gate script, and is the part the tests fake. So: the crate is green and the tests are real; the mod in a title is not something this session proves.
AI-assisted: yes - DeepSeek v4.1 (flash),
cargo buildandcargo teston the machine above.Written with an AI assistant.