fix(fps): Link pulls himself up a ledge above 60 fps as at 60 #1740
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1740
Loading…
Reference in a new issue
No description provided.
Delete branch "CraftyCorvid/Longshot:fix/ledge-climb-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?
Type: fix · Risk: low · Tested on: Linux, RTX 5090 · Needs: none
TL;DR
Above a 60 FPS cap, Link's pull-up onto a ledge fell short: he slid back on the lip until he got over, and letting go of
forward dropped him back to the hang. The game drives his body toward a target each update, and above 60 Havok delivers
only part of each move (86% at 120 FPS, 78% at 170) while the next target starts from where the body ended up. Now Link's
driven body is given last update's target plus this frame's move, so it follows the animation's path. At 60 to 170 FPS he
now rises 2.80 m every time with no slips; a new test fails on main and passes here.
Breakdown
any ledge Link jumps up to and pulls himself onto).
60 the physics delivers less than the move, and the shortfall is never made up.
shortfall (at most three moves), so the body reaches where the animation puts it.
longer, every other body, Havok itself, saves and options.
scripted climbs in the game at 60, 90, 120, 144 and uncapped, before and after.
Why
With the Game frame rate cap at 120 or above, Link slips back while pulling himself up a ledge; releasing forward drops him
back to hanging. Fixes #1494.
The root cause is in Havok's constraint solve, which is tuned so a driven body lands on its target in a 60 FPS frame. The
trace into Havok and the options weighed (a Havok fix, physics at 60 Hz, holding 60 during the climb) are on the issue:
#1494 (comment). Fixing it in Havok would change every
constraint and contact in the game above 60; this change compensates for Link's driven body only.
How to reproduce
Seen on: CachyOS Linux (kernel 7.3), RTX 5090, NVIDIA 620.70.06
Settings and switches: Game frame rate cap 120, 144 or Uncapped, everything else default
Steps: as adult Link in the Forest Temple's main hall, walk into the wooden ledge by the red stairs (Link jumps up,
hangs, then pulls himself up); let go of forward while he is pulling himself up
Expected: he finishes the pull-up as at a cap of 60
Actual: he rises less, slides back on the lip, and drops back to the hang when forward is let go
What changed
Each update of a pull-up,
f_804f5030(a rigid body's update before the physics step, on its path for a body driven to atarget: the controller's flags have 0x80, the game's gate to the path, and 0x100, its gate to handing the velocity to the
world) reads the controller's target (+0x3c), which the game set to the body's position plus this
frame's move from the animation, and asks the physics for (target - position) x 1/dt. At 60 FPS the body lands exactly on
the target. Above 60 the physics delivers only part of the move (1.00 at 60, 0.94 at 90, 0.86 at 120, 0.82 at 144, 0.78 at
170), and the next target starts from where the body ended up. Before the target is read, the host now adds last update's
shortfall (last target minus where the body is now) for Link's body, at most three of this frame's moves (enough down to a
quarter share, about 400 FPS, while a body something held back is not flung when it frees).
A carry needs the same body and its last driven call in this update or the one before. Link's updates are counted in
hos_oot_lift_player, and the path is not reached between two climbs, so each climb starts from the game's own target.The count only finds gaps: a wrong count drops a carry, it never holds a target back.
A target bit for bit the game's last (the body update run again before the physics) or the last one given (not renewed)
gets the last target given, so nothing is carried twice.
lift:
nx2/oot_patches.pypatch_drive_target: both copies of the driven path inf_804f5030(the body loaded intox23 or x24) call
hos_oot_drive_targetbetween the body's load and the target's reads;reportwarns when fewer than twoare found.
host:
host/oot_high_fps.hoot_drive_carry(the rule, and why at the top of the file);host/oot_high_fps.chos_oot_note_link(counts Link's updates; his rigid body from his components, each pointer checked to be in guestmemory) and
hos_oot_drive_target(reads the frame's step as thebarge's fix does;
HOS_FPS_LOGlogs the carry);host/hos_main.chos_oot_lift_playercallshos_oot_note_link.test:
tests/test_drive_target.py.docs: the README's frame rate cap row.
How it was found (local diagnostic builds, not in this PR, driven through the control bridge from a save at the ledge):
plus the animation's move, and the body reaching it fully at 60 and partly above.
and hooks inside Havok's integration (
f_8182dc20,TtSubIntegrateLast) and constraint solve (f_8177b2a0) showed thedriven velocity ramped through the substeps, landing exactly at 60 and short above it, whatever the substep count.
Measurements
Verdict: fixed. At 90, 120, 144 and uncapped (147-179 FPS) Link's pull-up rises 2.78-2.80 m (2.81 at 60) with no slips,
and letting go of forward partway up leaves him at the top of the pull-up, as at 60; on
mainabove 120 it rose 2.38-2.55m with 1-5 slips and letting go dropped him to the hang every time. The game-free test fails on
mainfor this bug andpasses here.
Hardware: CachyOS Linux (kernel 7.3), RTX 5090, NVIDIA 620.70.06
Scene: the Forest Temple's main hall, a save at the wooden ledge by the red stairs; Game frame rate cap 60, 90, 120, 144
and Uncapped
Method:
tests/test_drive_target.py(gcc and clang); in the game, a script that walks Link back below the ledge, sets thecap through the control bridge and climbs holding forward, recording Link's position at every update (peak height over
the floor, slides back on the lip of more than 3 cm, time from the jump to 1 m past the edge); a second script lets go of
forward once Link is 1.4 m up and reads where he is 3 s later
How to reproduce:
python -I -B tests/test_drive_target.py; in the game, the steps aboveBaseline: the in-game before is
main4b68c42bwith #1528 (the barge's fix, merged since) built as a dev pack over a baseof
71b1edd8; the after is this branch's final code on47430e81, built the same way. Nothing between those touches the filesthis PR changes or the pull-up. The branch is now rebased onto
868f6be8(it changedhost/hos_main.celsewhere and theREADME); the test fails at its commit and passes at the fix there too.
868f6be8(with the test,77c29ac9)46e752a7test_drive_target.pyFlags and settings
None (
HOS_FPS_LOG, the existing diagnostic switch, gets one more line).Testing
Tested:
71b1edd8(nowarning from the lift: both copies found). Scripted climbs of the Forest Temple ledge: 2 at 60, 2 at 90, 3 at 120, 3 at
144, 3 uncapped (147-179 FPS), and the let-go climbs (4 uncapped, 2 at 60) on this branch and on
main, with the numbersabove.
tests/test_drive_target.pywith gcc and clang: fails at77c29ac9(the test alone, onmain), passes at46e752a7.Broken on purpose it fails, each for its own check (20 mutations): no carry; no cap (a held-back body given 12.6 moves);
no guard for a non-finite target or body position; any body; without the cap-above-60 test (a cap of 60 with slowed
time); without the step under 1; any flags, or 0x80 alone; no body check (Link's body changed); no gap check, or a gap of
5 allowed; a not-driven call keeping the carry alive; carrying height only; no rule for a target run again in the same
update, or for one not renewed; repeats decided by the update count (Link's update not run before 10 body updates: 1.30 m
of 1.92); no update count;
hos_oot_note_linknot called, or called under a condition.path is gated on 0x80, so not reached when Link is not driven) and a target not renewed being carried again; its second
found that deciding repeats by the update count could hold Link's target back if his update ever did not run first. All
three are fixed as described above, with checks for each, and its suggested mutations are among the 20.
python -I -B tests/run_all.py(Linux, on868f6be8): 710 passed, 36 failed, 106 skipped (Vulkan and SPIR-V headers missinghere). One is
test_vbytes, which hit the 600 s limit under the full run's load (the lifter's vector byte helpers, timed;it reads none of the files this PR changes). The other 35 also fail on
main868f6be8(run there): test_bug_report_defaults,test_capture_read_once, test_crt_options, test_damage_debug_menu, test_dev_packs, test_discover,
test_display_startup_failure, test_dlss_feature_size, test_failed_compile_keeps_objects, test_guest_imported,
test_high_fps_fixes, test_host_guest_writes, test_hud_layout_row, test_libc_hooks, test_lift_lookups, test_linux_preflight,
test_linux_pressure, test_linux_update, test_log_open_failure, test_mise_build, test_missing_nup, test_mods_size_table,
test_pending_guest_import, test_pipeline_play_cache, test_prepare_cache_save, test_present_thread, test_profiling_mode,
test_psychov35_fsr3_fg, test_readback_timeout_source, test_slow_frames, test_song_note_cue, test_upscaler_rows,
test_vcore_escape, test_walk, test_walk_key.
host/oot_high_fps.candhost/hos_main.ccompiled alone (-fsyntax-only -Wall -Wextra, the build's include folders)with gcc for Linux and llvm-mingw clang for Windows: the same warnings as on
main(none inoot_high_fps.c).Not tested:
ledges; child Link.
and keyed by the body), Link's update and the body update swapping order between frames (a wrong count only drops a
carry), the real physics (a stand-in delivering the measured share), contacts that stop the body.
Must be tested: None.
Risks
What could break: how Link's body follows a driven move above a 60 FPS cap, on frames under a 60 FPS one. If
something holds his body back during such a move, the target given is at most three frames' moves past the game's, for
one update after it frees. Every other body, a cap of 60, and frames of a 60 FPS one or longer are as before.
Turning it off: revert the commit, or a cap of 60.
Compatibility: Nothing changes for saves, options or caches; an update translates the game's code again, as for any
change to the lift's patches.
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks.
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened. (None needed: the checks thatread
host/oot_high_fps.*,host/hos_main.cornx2/oot_patches.pypass, or fail the same way onmain.)🤖 Generated with Claude Code
Tested in game: Linux (CachyOS, kernel 7.3), RTX 5090, NVIDIA 620.70.06, the Forest Temple's main hall ledge by the red stairs, built as a dev pack over a base of
71b1edd8: scripted climbs at caps 60, 90, 120, 144 and uncapped (165-172 fps) rise 2.80 m with no slips (main: 2.38-2.55 m with 1-5 slips from 120 up), and letting go of forward partway up leaves Link at the top of the pull-up 4 of 4 uncapped (main: back at the hang 4 of 4). The lift reports the patch in both places, no warning.e4ea06ea4a46e752a7dfWIP: fix(fps): Link pulls himself up a ledge above 60 fps as at 60to fix(fps): Link pulls himself up a ledge above 60 fps as at 60