fix(game): Navi's turn scales its swing by the frame's step, so a signpost's text box no longer waits 6 seconds above 60 fps (#2561) #2934
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2934
Loading…
Reference in a new issue
No description provided.
Delete branch "cuecuemoar/Longshot:fix/sign-text-above-60"
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?
Summary
Above 60 fps, reading a signpost could leave Link standing for about 6 seconds before its text box appeared. At a 60 cap the text box is up at once.
How to see it on main: set the frame rate cap to Uncapped (about 180 fps here). In Kakariko, read the back of the signpost just inside the gate from Hyrule Field (Navi: "There's no writing on this side."), close it, then walk round and read its front. The "Hyrule Field" text box comes about 6 s after the press. Reading the front alone usually shows it at once: Navi's starting orientation decides it.
Why: the event waits for Navi to face the sign. Each frame her rotation (
f_808b5ff0) turns her level heading toward its target by the frame's step, then projects it onto the plane of her banked up vector. That projection swings the heading to the side a fixed angle every frame, whatever the step. At 60 fps the turn outweighs the swing; at high frame rates the turn, scaled by the step, no longer does. She hangs short of the sign, never within the 5 degrees that end her turn, and the event goes on only at its own limit of 360 sixtieths (6 s). dyst found this for a small chest's award in #2809 (formod-api, in its Rust site layer). This is the same rule on main's C site layer. It fixes the signpost here, and should end the chest's wait on main too (not run here: Still to test).The change: a hook site after the turn and before the projection,
navi.turnHeading(f_808b5ff0+0x9f8), gives the game a heading that already lies in her up vector's plane and has swung by the step's part only, so the projection keeps it. At a cap of 60, and on a frame of a 60th or longer, the game's heading is used.HOS_FPS_NAVI=0turns it off.Read first:
oot_navi_headingingame/oot_high_fps.h, thenhos_oot_navi_turn_heading(game/oot_high_fps.c),hos_site_navi_turn_heading(game/oot_sites.c) and the site ingame/sites/sites.tomland the build'slocations.toml.Fixes #2561. See #2579 (its chest delay is this wait; its item rotation and spawn cutscene are not covered) and #2809.
Testing
Tested: Windows 10, NVIDIA RTX 4090 (driver 617.42), headless through the control bridge from the repository's
kokiri-startsave (debug teleport to Kakariko), at 1280x720. Each run read the signpost's back, then its front, with a shot every 150 presents after the press (about 0.8 s of game time each at 180 fps, plus the bridge's own time).v3.0.0-433-g018dd2ef, uncapped, about 180 fps): back then front, the text box first showed in the 4th or 5th shot (about 6 to 7 s after the press), 3 of 3 times. The front alone: at once, 4 of 4. At caps of 90, 120, 144 and 165 (front alone) and at 60: at once.HOS_FPS_NAVI=0showed the box in the 4th or 5th shot in both back-then-front reads. With the rule on it showed in the first shot in 3 of 3, and at a cap of 60 in 2 of 2.HOS_FPS_LOG=1logs the rule at work (oot: Navi's turn: heading ... step 0.33).14f66213(rebuilt after the last code change): back then front, uncapped, the box in the first shot, 2 of 2.tests/test_navi_turn_step.pyfails on main (her heading after a second is 9.5 to 30 degrees off 60 fps's at 90 to 240 fps) and passes here. The test also failed with the fix's register write removed, and with the step's scaling of the swing removed.git grepof each), on Linux (WSL2 Ubuntu 22.04), head against main: the 83 checks fail in the same 7 files as on main, plustest_song_note_cue.py, which compiles the whole ofgame/oot_high_fps.cwith a context that has no vector registers. The host function was changed to take the registers' bits from the site's callback instead (the callback ingame/oot_sites.creads and writes them); after that change it and the other checks that cut the file (test_jump_takeoff_step,test_high_fps_fixes,test_horse_jump_step,test_drive_target) pass.cargo test -p sitespasses (49 and 4).game/oot_high_fps.candgame/oot_sites.cbuilt for Windows in the game pack (llvm-mingw), and compile on Linux with no warnings (clang,-Wall -Wextra), as on main.run_all.py --stricton14f66213and on main4908cc6d: 822 passed, 91 failed, 10 skipped here against 821, 91 and 10 on main. The same 91 files fail on both (listed in a comment), none only here; the one more pass is the new test.Still to test:
@Beanstalk read Kakariko's gate signpost's back, then its front, uncapped; the text box should show at once).Measurements
Verdict: the signpost's text box comes at once above 60 fps (it came about 6 s late). Frame time is unchanged within the spread.
Setup: Windows 10, RTX 4090, 1280x720, Uncapped. Standing just inside Kakariko's gate by the signpost (-108.7, 57.25), facing 210, with no event playing (Navi idling beside Link, so the rule runs every frame). 20 s to settle, then 40 s measured from the log's
vk: N presents, F fpsandvk: GPU timelines, in the job queue's timing mode, three runs each, main and this PR interleaved. The two runtimes are built over one base, from main @4908cc6dand this PR @14f66213.4908cc6d14f66213HOS_FPS_NAVIships on: it is the fix, a kill switch for a change to Navi's motion above 60 fps.Risks
Navi's turns above a 60 cap now follow her heading's 60 fps path more closely. That is visible only while she banks, and at 60 nothing changes. If it looks wrong somewhere,
HOS_FPS_NAVI=0turns it off. After updating a player notices nothing else: no setting, save or cache changes.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.gpu/vk/switches.def.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
https://claude.ai/code/session_01VxeaZjootUvZ3jw6scXTmo
Tested in game: Windows 10, RTX 4090 (driver 617.42), Kakariko's gate signpost from the kokiri-start save, uncapped (about 180 fps): reading its back, then its front, showed the text box about 6 s late on main and with HOS_FPS_NAVI=0 (4th or 5th shot after the press, 5 of 5), and at once with the fix (first shot, 5 of 5, 2 of them on this head
14f66213); at a 60 cap at once either way.The game-free suite on Linux (WSL2 Ubuntu 22.04,
run_all.py --strict), this PR @14f66213against main @4908cc6d: the same 91 files fail on both, none only here. They are main's:WIP: fix(game): Navi's turn scales its swing by the frame's step, so a signpost's text box no longer waits 6 seconds above 60 fps (#2561)to fix(game): Navi's turn scales its swing by the frame's step, so a signpost's text box no longer waits 6 seconds above 60 fps (#2561)@review
Recommendation: Approve. The reported runs show the signpost delay falling from about 6–7 seconds to the first shot, but ordinary Navi movement and the small-chest interaction still need an in-game check. The new test also inherits the developer’s kill-switch setting, which can make it fail spuriously. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change scales Navi’s bank-induced heading swing by the frame step, avoiding a turn that can hold up signpost text at high frame rates. It adds per-frame math and a kill switch; the reported idle-scene measurements show no clear frame-rate change within their spread.
Should fix (1): not blocking, but worth doing before merging.
tests/test_navi_turn_step.py:252: The enabled-case fixture inherits HOS_FPS_NAVI from the parent environment. (more on the line) Do: Run the enabled fixture with an explicit environment that removes HOS_FPS_NAVI or sets it to an enabled value; keep the separate explicit off case.Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
game/oot_high_fps.h:336: The rule changes Navi’s turns beyond the signpost, but ordinary movement and the small-chest interaction have not yet been exercised in the game. (more on the line) Do: Run the listed ordinary-play and small-chest checks above 60 fps, comparing their motion and timing with 60 fps, and record the results.@fixcan do L1.Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported signpost case: on Windows with an RTX 4090 at about 180 fps, main showed the front text after about 6–7 seconds in 3 of 3 runs; this head showed it in the first shot in 2 of 2. The claimed small-chest benefit remains untested.
Other systems: The hook changes Navi’s turns generally, including calling and targeting her as well as interactions that wait for her orientation. Those paths need the stated in-game check. Linux and other GPUs execute the same game logic; the supplied game run is Windows-only.
Switches: HOS_FPS_NAVI is added as a kill switch, on by default and listed in gpu/vk/switches.def. The default fixes the measured signpost case, but its effect on ordinary turns and chest interactions remains to be checked.
Reviewed:
14f6621346against4908cc6dad: Read AGENTS.md, CONTRIBUTING.md, the PR template, the applicable standards, the complete diff and commits, the new test and the changed functions with their surrounding callers. Rechecked each changed file’s diff. Skimmed the site tables and switch table around their additions; did not read the large unchanged portions of those tables in full. docs/review-checklist.md and ../Tooling/AGENTS.md are absent from the checkout.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no build, test or project script was run. The supplied CI checks are still running.
Overlaps and merge order: No overlapping pull request was established from the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -323,0 +333,4 @@is returned; 0 (out untouched) where the game's own is used: a cap of 60, a step of 1 or more, a heading or an up vectorthat is not finite, an up vector near the horizontal, no level heading */static inline int oot_navi_heading(const float heading[3], const float up[3], float step, int timed, float out[3]) {if (!timed || !(step > 0.0f && step < 1.0f)) return 0;L2 (should fix): The rule changes Navi’s turns beyond the signpost, but ordinary movement and the small-chest interaction have not yet been exercised in the game.
When: Above 60 fps, calling or targeting Navi and opening a small chest reach the same changed turn logic; the signpost run alone does not show their resulting motion or award timing.
Do: Run the listed ordinary-play and small-chest checks above 60 fps, comparing their motion and timing with 60 fps, and record the results.
@ -0,0 +249,4 @@hook = sitehooks.line(x) + "\n"with tempfile.TemporaryDirectory(prefix="navi-turn-") as directory:binary = build(args.cc, callbacks + slot(x) + turn_function(hook), host, directory, "hooked")result = run(binary)L1 (should fix): The enabled-case fixture inherits HOS_FPS_NAVI from the parent environment.
When: With HOS_FPS_NAVI=0 set for a local game run, running this test leaves the fix disabled in the supposed enabled case, so its heading checks fail even when the code is correct.
Do: Run the enabled fixture with an explicit environment that removes HOS_FPS_NAVI or sets it to an enabled value; keep the separate explicit off case.
Closing as superseded by #2822 (
d984fd704), which brought dyst's #2809 to main.This PR ported #2809's rule to the C game side. #2822 deleted those files (
game/oot_high_fps.c/.h,oot_sites.c,sites.def), and main now has the same fix in Rust:navi_heading_ruleingame/crates/game-core/src/fixes/high_fps.rs. It runs at the samenavi.turnHeadingsite (f_808b5ff0), scales the projection's swing by the step on frames shorter than a 60 fps frame, and comes with Rust tests (navi_turns_as_far_in_a_second_at_144_fps_as_at_60and edge cases) covering whattests/test_navi_turn_step.pychecked. The only thing left here that main lacks is theHOS_FPS_NAVIkill switch: main gates the rule on its general timed check instead.#2561 stays open: the Kakariko signpost repro (back side, then front, uncapped) has not been run on a runtime built from the Rust port.
Pull request closed