WIP: fix(fps): the water ripples step every frame above 60 fps instead of jumping #1498
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1498
Loading…
Reference in a new issue
No description provided.
Delete branch "enum/Longshot:fix/water-ripples-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: Windows 11, RTX 4070 · Needs: Linux, any GPU
TL;DR
Above a 60 fps frame rate cap, the ripples in water jumped instead of spreading smoothly: in the Great Fairy fountains, Zora's Domain and wherever drops fall into water. The game moved the ripples in bursts, all at once on some frames and not at all on others. This PR spreads that movement over every frame, at the same overall speed. At the Hyrule Castle fountain at a 240 cap the ripples are smooth now, with frame generation off and at 2x; a new test fails on main and passes here.
Breakdown
host/nn_vi.c, which both platforms build; only Windows was built and run here).Why
With the Frame rate cap above 60, the water's ripple rings jump around when Link walks or swims in water and where drops land: in all the Great Fairy fountains, Zora's Domain and elsewhere. At a cap of 60 they are smooth. Frame generation isn't needed for it; the game's own frame rate above 60 is enough (reproduced at about 83, 99, 106 and 108 fps). Fixes #1199.
How to reproduce
Seen on: Windows 11 Pro (26300), NVIDIA GeForce RTX 4070, driver 616.56 (the report: RTX 5090, 621.24)
Settings and switches: Frame rate cap 240, frame generation off or 2x; otherwise defaults
Steps: stand in the water of a Great Fairy fountain (here Hyrule Castle's, as child) and walk a few steps
Expected: the ripples spread smoothly, as at a cap of 60
Actual: on main the rings stand still for a frame and then jump ahead
What changed
The water renderer (
f_800672e0) runs(int)step × substepsripple-simulation substeps a frame, the substeps a water object's+76. Above 60 fps the step is the frame's own time (0.56 at 108 fps), and the existing carry (WHOLE_SITES) handed out whole frames per water object: a frame got 0 frames (no substeps) or 1 (all of them). The site now carries the substeps instead: the fraction ofstep × substepsis kept per water object, and every frame runs its whole substeps.frame_whole_times()inhost/frame_whole.h(the carry ofstep × times; without the carry, the game's own(int)step × times), and its entry pointhos_frame_whole_times()inhost/nn_vi.cbesidehos_frame_whole().nx2/oot_patches.py, the water'sWHOLE_SITESentry now includes the substeps' load, andWHOLE_TIMESnames the register it multiplies by;whole_new()writeshos_frame_whole_times(...)and sets that register to 1, so the game's multiply that follows gives the substeps.patch_whole_frames()also takes a lift an earlier build patched withhos_frame_whole()(a work folder keeps its translation) to the new form.tests/test_water_substeps.py(new);tests/test_frame_whole.pyexpects the water's new form of the patched line.docs/tested/(3 each, interleaved).Measurements
Verdict: fixed: at the same spot and settings, the ripples jump on main and spread smoothly here, by eye and in the frame log; the water's frame-to-frame swing drops from a median 0.155 to 0.052, over 3 interleaved runs each.
Hardware: Windows 11 Pro 26300, NVIDIA GeForce RTX 4070, driver 616.56, AMD Ryzen 9 7900X, 63 GB
Scene: Hyrule Castle Great Fairy fountain, as child; 1280x720 window, default profile, Frame rate cap 240, frame generation off
Method: 3 runs each, interleaved (main, fix; then main, fix, main, fix), from the same dev base (main @
310e7c9d, and this PR as a pack over it), from the same save: Link walks 0.7 s in the water and stands, thenRX_VK_FRAMELOGrecords 2 s. The mean absolute change of the water beside Link (a 200x53 region of the 320x180 log, Link left out) between consecutive game frames. Falling particles and light on the water change every frame in both, so the water is never fully still; the ripples' steps show as alternating low and high frames. This is a correctness check, not a speed measurement. The first pair ran with the game-free suite beside it; the other four with nothing else running. Medians of the 3.How to reproduce: the scene above, cap 240;
RX_VK_FRAMELOG=<file>and<file>.gowhile recording; then compare consecutive frames of the water region.310e7c9d3eff1602Rebased since onto main @
9af4808f(this PR now @98b94d08); the numbers above still hold: the four commits are unchanged, and none of main's commits since310e7c9dtoucheshost/frame_whole.h,host/nn_vi.c,nx2/oot_patches.pyortests/test_frame_whole.py. After the rebase,python -I -B tests/run_all.py(Windows, llvm-mingw): 676 passed, 47 failed, 46 skipped, the 47 the same checks that fail on main @9af4808f.The water's change a frame, the first 20 frames of run 1:
The test on main (
310e7c9d):and here:
Ran 2 tests ... OK.The water beside Link, the same 100 game frames of each log side by side, slowed to 25 a second (crop of the 320x180 frame log, scaled 2x):
Its first frame, for a reader whose viewer doesn't play GIFs:
Flags and settings
None.
Testing
Tested: my own runs on Windows 11 Pro 26300, RTX 4070, driver 616.56, at the Hyrule Castle Great Fairy fountain as child, cap 240: main @
310e7c9djumps; this PR @3eff1602is smooth with frame generation off (about 106 fps) and at 2x (about 87 fps), the same base, save and settings. The pack's lift hashos_frame_whole_timesat the water site, and the patcher printed no warning. Game-free:tests/test_water_substeps.pyfails on main for the bug's reason and passes here, and it fails again with either half of the fix broken (WHOLE_TIMESemptied, or the multiply left out offrame_whole_times's no-carry path).python -I -B tests/run_all.py, Windows (llvm-mingw): 674 passed, 48 failed, 46 skipped; main @310e7c9d: 673 passed and the same 48 failed (the one more is the new test). Linux (WSL, gcc): 601 passed, 40 failed, 127 skipped; the same 40 fail on main there. Those failures are this PC's setup, not this change.Not tested: a Linux game build and run (only Windows was built); Zora's Domain and the other places of the report (the fountain was the case reproduced); swimming.
Must be tested:
@Beanstalklinux, ripples at a fountain at a 240 cap)Risks
What could break: the water's ripples above 60 fps, if a scene's water has a substep count where the carry behaves differently; at a cap of 60 or 30 the game's own count is kept.
Turning it off: revert the commit (a Frame rate cap of 60 also avoids the site's carry).
Compatibility: the game is translated again once (a lift patch changed); saves and settings are unchanged.
Issues
Fixes #1199
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.docs/tested/for each new measured run (format indocs/tested-configurations.md).mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
Tested in game: Windows 11 Pro 26300, RTX 4070, driver 616.56: Hyrule Castle Great Fairy fountain as child, cap 240. main @
310e7c9d: the ripples jump. This PR @3eff1602(a pack over the same base, same save): smooth with frame generation off (about 106 fps) and at 2x (about 87 fps).@Beanstalk linux, any GPU: build this PR and main, load a save at a Great Fairy fountain (or stand in the water in Zora's Domain), set the Frame rate cap to 240 with frame generation off, and walk a few steps in the water. Expected: on main the ripple rings stand still for a frame and then jump; with this PR they spread smoothly, as at a cap of 60. A frame log (RX_VK_FRAMELOG) of a few seconds standing in the water after walking, from each build, would show it.
@enum only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it or to this comment.This request was for214ba20, and the PR has changed since (7ae18ce), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.Two more interleaved runs at the fountain (main, fix, main, fix; nothing else running),
7ae18ce6: the water's frame-to-frame swing is 0.155 and 0.164 on main, 0.063 and 0.050 with the fix. With the first pair, the medians of 3 runs each are 0.155 on main and 0.052 here (spread 19% and 7%). Measurements and docs/tested updated; the Linux run is asked of the Test Farm above.@Beanstalk linux, any GPU, for
7ae18ce6(the earlier request was for214ba20; the only change since is docs/tested): build this PR and main, load a save at a Great Fairy fountain (or stand in the water in Zora's Domain), set the Frame rate cap to 240 with frame generation off, and walk a few steps in the water. Expected: on main the ripple rings stand still for a frame and then jump; with this PR they spread smoothly, as at a cap of 60. A frame log (RX_VK_FRAMELOG) of a few seconds standing in the water after walking, from each build, would show it.@enum only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it or to this comment.This request was for7ae18ce, and the PR has changed since (98b94d0), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.Rebased on main @
9af4808f(now98b94d08; the four commits unchanged). run_all.py after the rebase: 676 passed / 47 failed / 46 skipped, the 47 the same as on main; test_water_substeps and test_frame_whole pass. The fountain numbers still hold: none of main's commits since310e7c9dtouches host/frame_whole.h, host/nn_vi.c, nx2/oot_patches.py or tests/test_frame_whole.py.7ae18ce66098b94d08ae@Beanstalk linux, any GPU, for
98b94d08(the earlier request was for7ae18ce6; the only change since is the rebase on main): build this PR and main, load a save at a Great Fairy fountain (or stand in the water in Zora's Domain), set the Frame rate cap to 240 with frame generation off, and walk a few steps in the water. Expected: on main the ripple rings stand still for a frame and then jump; with this PR they spread smoothly, as at a cap of 60. A frame log (RX_VK_FRAMELOG) of a few seconds standing in the water after walking, from each build, would show it.@enum only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.@futondestroyer approval of
98b94d0recorded. This diff touches sensitive paths, so a second member ofBigBeansmust approve it too.Beanstalk test farm
Commit
98b94d0· tier untrusted · approved by futondestroyer (👍 on enum's request) · dashboardThis diff touches sensitive paths, so it needs two members of
BigBeans:nx2/oot_patches.pyA member of
BigBeanscan review this commit and comment@Beanstalkto test it.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.