Repository navigation
kbm: calculate mouse velocity over real dt to prevent camera whip (#963) - #1066
mahfuzinam0045-spec wants to merge 1 commit into
Conversation
…l-dev#963) When a title paused polling the gamepad for over 100 ms (during loading screens or frame hitches), mouse counts accumulated over the entire pause window. In Velocity::update, dt was clamped to 0.1 s before dividing, which artificially multiplied the apparent mouse rate by up to 20x and caused stick deflection to peg at 100%, violently whipping the camera. Compute the velocity rate using the actual elapsed time (with dt.max(0.001) to prevent division by zero). The exponential smoothing factor (1 - exp(-dt / SMOOTHING)) naturally decays without overshooting. Fixes xcl-dev#963. Assisted-by: Antigravity (Gemini 3.8 Flash)
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Two contributors checked independently and found that #1059 #1522 solves the same problem (for #963) in a different way: #1607, group D66. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table. |
PR #1066 empirical test reportThe KBM velocity calculation now uses the elapsed frame time for hitches longer than 100 ms. The added regression test checks 300 ms and two-second hitches. Fixes #963. What is in it
Tested
GPU skips (5) Not tested
AI use
Verbatim failure output from the full suite and focused retry Full logs are in |
|
Regression run of Against the limits in CONTRIBUTING.md: 100 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
When a title paused polling the gamepad for over 100 ms (such as during loading screens, level transitions, or hitching), mouse counts continued gathering in
DXandDY. InVelocity::update,dtwas clamped to0.1before dividing (dx as f32 / dt), which artificially multiplied the apparent mouse rate by up to 20x. This caused the stick deflection to peg at 100% and violently whip the camera around upon returning to gameplay.Fixes #963.
What is in it
crates/xcl/src/hle/kbm.rs: compute the mouse velocity rate over the realdt(withdt.max(0.001)to avoid division by zero). The smoothing factor(1 - exp(-dt / SMOOTHING))naturally bounds the exponential decay in[0, 1).crates/xcl/src/hle/kbm.rs: addframe_hitch_does_not_artificially_accelerate_velocityunit test covering 300 ms and 2 s hitch scenarios, asserting that stick deflection remains moderate.Tested
Velocity::updateandstick_from_mouseunder 300 ms and 2 s pauses; confirms deflection stays proportional (< 0.5) instead of pegging at 1.0.Regression run
test-onlylabel or community smoke run.Not tested
AI use