[GH-ISSUE #1598] even when still holding W, the player stops sprinting when not holding control if you jump #498

Closed
opened 2026-11-02 15:39:32 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @ludovic111 on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1598

What I did:
Sprint forward
Let go of control key while still sprinting
Jump while still going forward
What happened: The sprint cancelled and i have to re initiate it with control or just hold control
What I expected: To jump with sprint still enabled
Horizon version: v0.2.48
OS, CPU, GPU: Windows x86, ryzen 9 3950x, rtx 4060 ti 8gb

Reported on Discord by kevennever#5592 in #horizon-bugs · Discord thread
Tags: gameplay

Opened by Kira from Discord. Replies from the reporter in the thread are added here as comments.

Originally created by @ludovic111 on GitHub (Oct 24, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1598 > What I did: > Sprint forward > Let go of control key while still sprinting > Jump while still going forward > What happened: The sprint cancelled and i have to re initiate it with control or just hold control > What I expected: To jump with sprint still enabled > Horizon version: v0.2.48 > OS, CPU, GPU: Windows x86, ryzen 9 3950x, rtx 4060 ti 8gb Reported on Discord by **kevennever#5592** in #horizon-bugs · [Discord thread](https://discord.com/channels/1559227979002028052/1563646004698415104) Tags: gameplay <sub>Opened by Kira from Discord. Replies from the reporter in the thread are added here as comments.</sub><!-- kira -->
bsakaguchi 2026-11-02 15:39:32 +07:00
Author
Owner

@Domanffe commented on GitHub (Oct 24, 2026):

🤖 Agent: found the line that cancels it, but I could not verify a patch, so here is the finding rather than a pull request.

Sprint changes travel as their own packets: the client sends START_SPRINTING (action 1) and STOP_SPRINTING (action 2) when its own state changes (game/remote.rs, where was_sprinting is compared), and the hub handles both arms (lan/hub.rs, S::PlayerCommand actions 1 and 2). Alongside that, every input packet rewrites the state from the key bits:

S::PlayerInput(p) => {
    self.guests[i].input = p.flags;
    self.guests[i].sneaking = p.flags & 32 != 0;
    self.guests[i].sprinting = p.flags & 64 != 0 && p.flags & 1 != 0;
}

That line is not what vanilla does: ServerboundPlayerInputPacket carries which keys are down, while the sprint state changes only through the command packets, which is how the client already reports it. With the line present, the sprint bit coming up clears the state on that tick, whatever the player is doing, which is the shape of this report and of #1593. Removing it is the obvious candidate fix.

Why I am not shipping that patch: my only harness is horizon-ctl key w down plus state, and inside the sprint machine those injected keys do not look like a keyboard. Instrumenting SprintState::tick on a build of that patch printed stop forward=false on the tick after Ctrl came up, with W still held and the player still walking, which the real key path cannot produce. So the harness cannot tell a correct patch from a broken one here, and I would rather hand over the line and the argument than a PR whose "after" I never observed.

If you want it, the patch is one deleted assignment plus a comment saying the command packets own the state; I can open it as a draft for your Mac mini check. Otherwise the useful next step is a harness that drives real key events, so this class of input bug is testable at all.

Measured while looking, in case it helps: on a flat platform with Ctrl held, sprinting: true; released with W held, sprinting: false while the player kept moving, on 0.2.48 and on a build of main.

<!-- gh-comment-id:6390346116 --> @Domanffe commented on GitHub (Oct 24, 2026): 🤖 Agent: found the line that cancels it, but I could not verify a patch, so here is the finding rather than a pull request. Sprint changes travel as their own packets: the client sends `START_SPRINTING` (action 1) and `STOP_SPRINTING` (action 2) when its own state changes (`game/remote.rs`, where `was_sprinting` is compared), and the hub handles both arms (`lan/hub.rs`, `S::PlayerCommand` actions 1 and 2). Alongside that, every input packet rewrites the state from the key bits: ```rust S::PlayerInput(p) => { self.guests[i].input = p.flags; self.guests[i].sneaking = p.flags & 32 != 0; self.guests[i].sprinting = p.flags & 64 != 0 && p.flags & 1 != 0; } ``` That line is not what vanilla does: `ServerboundPlayerInputPacket` carries which keys are down, while the sprint state changes only through the command packets, which is how the client already reports it. With the line present, the sprint bit coming up clears the state on that tick, whatever the player is doing, which is the shape of this report and of #1593. Removing it is the obvious candidate fix. Why I am not shipping that patch: my only harness is `horizon-ctl key w down` plus `state`, and inside the sprint machine those injected keys do not look like a keyboard. Instrumenting `SprintState::tick` on a build of that patch printed `stop forward=false` on the tick after Ctrl came up, with W still held and the player still walking, which the real key path cannot produce. So the harness cannot tell a correct patch from a broken one here, and I would rather hand over the line and the argument than a PR whose "after" I never observed. If you want it, the patch is one deleted assignment plus a comment saying the command packets own the state; I can open it as a draft for your Mac mini check. Otherwise the useful next step is a harness that drives real key events, so this class of input bug is testable at all. Measured while looking, in case it helps: on a flat platform with Ctrl held, `sprinting: true`; released with W held, `sprinting: false` while the player kept moving, on 0.2.48 and on a build of main.
Author
Owner

@rdbtCVS commented on GitHub (Oct 26, 2026):

🤖 Agent: rdbtCVS’s AI agent (OpenAI Codex), triage follow-up. This matches the jump-related half of #1593: release Ctrl while holding forward, then jump and lose sprint. Recommend closing this as a duplicate of #1593, preserving this independent reproduction there. PR #2022 merged during this audit and addresses the server-side sprint-state overwrite; verify both remaining cases under #1593.

<!-- gh-comment-id:6418444231 --> @rdbtCVS commented on GitHub (Oct 26, 2026): 🤖 Agent: rdbtCVS’s AI agent (OpenAI Codex), triage follow-up. This matches the jump-related half of #1593: release Ctrl while holding forward, then jump and lose sprint. Recommend closing this as a duplicate of #1593, preserving this independent reproduction there. PR #2022 merged during this audit and addresses the server-side sprint-state overwrite; verify both remaining cases under #1593.
Author
Owner

@kacpherek commented on GitHub (Oct 26, 2026):

This is fixed on main by #2022 (the server no longer clears the sprint state when the keys change, so a sprint-jump after releasing Ctrl keeps sprinting while forward is held).

<!-- gh-comment-id:6422585546 --> @kacpherek commented on GitHub (Oct 26, 2026): This is fixed on main by #2022 (the server no longer clears the sprint state when the keys change, so a sprint-jump after releasing Ctrl keeps sprinting while forward is held).
Author
Owner

@levzzz5154 commented on GitHub (Oct 26, 2026):

🤖 Agent: verified on current main (aba4f19a): this reproduces as the jump half of #1593, and it holds now. #2550 adds the end-to-end test that was missing for it.

What I verified, and how

  • The server no longer rewrites the sprint flag from the held keys. Hub's S::PlayerInput arm (crates/horizon-client/src/lan/hub.rs) only records the keys and the crouching; the flag changes only through PlayerCommand (START_SPRINTING / STOP_SPRINTING), as vanilla's ServerGamePacketListenerImpl.handlePlayerCommand does. That is the fix from #1779.
    cargo test -p horizon-client --test lan_bot -- sprint_commands_survive_keyboard_input_changes → ok. 1 passed
  • The client's sprint machine (crates/horizon-client/src/sprint.rs) mirrors LocalPlayer.aiStep: the sprint key only starts the sprint, and releasing it while forward is held keeps the state, so the jump tick is still a sprint tick.
    python3 tools/parity.py sprint_input → PASS sprint_input (the whole corpus against the pinned 26.3 client jar)
  • The jump itself: LivingEntity.jumpFromGround adds (-sin(yaw) * 0.2, 0, cos(yaw) * 0.2) while isSprinting(). New test motion::tests::a_sprint_jump_keeps_its_impulse_when_the_sprint_key_comes_up runs forward, releases Ctrl, jumps, and checks that the sprint state held and that the forward speed rose from 0.153 to 0.262 — it fails with the sprint state survives the sprint key in the air if the state is dropped.
running 4 tests
test sprint::tests::sprint_survives_releasing_the_key_through_a_jump ... ok
test motion::tests::a_sprint_jump_keeps_its_impulse_when_the_sprint_key_comes_up ... ok
test motion::tests::the_flight_speed_follows_the_sprint_state_not_the_sprint_key ... ok
test motion::tests::a_sprint_survives_the_sprint_key_coming_up_while_swimming ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 1213 filtered out; finished in 5.97s

Vanilla reference — LocalPlayer.aiStep (canStartSprinting, shouldStopRunSprinting), LivingEntity.setSprinting, LivingEntity.jumpFromGround, ServerGamePacketListenerImpl.handlePlayerCommand.

PR: #2550 (tests only, no behaviour change).

I cannot close this issue myself — the account has no permission to close issues on this repository — so I am leaving it open for a maintainer to close.

<!-- gh-comment-id:6428881706 --> @levzzz5154 commented on GitHub (Oct 26, 2026): 🤖 Agent: verified on current main (`aba4f19a`): this reproduces as the jump half of #1593, and it holds now. #2550 adds the end-to-end test that was missing for it. **What I verified, and how** * The server no longer rewrites the sprint flag from the held keys. `Hub`'s `S::PlayerInput` arm (`crates/horizon-client/src/lan/hub.rs`) only records the keys and the crouching; the flag changes only through `PlayerCommand` (`START_SPRINTING` / `STOP_SPRINTING`), as vanilla's `ServerGamePacketListenerImpl.handlePlayerCommand` does. That is the fix from #1779. `cargo test -p horizon-client --test lan_bot -- sprint_commands_survive_keyboard_input_changes` → `ok. 1 passed` * The client's sprint machine (`crates/horizon-client/src/sprint.rs`) mirrors `LocalPlayer.aiStep`: the sprint key only *starts* the sprint, and releasing it while forward is held keeps the state, so the jump tick is still a sprint tick. `python3 tools/parity.py sprint_input` → `PASS sprint_input` (the whole corpus against the pinned 26.3 client jar) * The jump itself: `LivingEntity.jumpFromGround` adds `(-sin(yaw) * 0.2, 0, cos(yaw) * 0.2)` while `isSprinting()`. New test `motion::tests::a_sprint_jump_keeps_its_impulse_when_the_sprint_key_comes_up` runs forward, releases Ctrl, jumps, and checks that the sprint state held and that the forward speed rose from 0.153 to 0.262 — it fails with `the sprint state survives the sprint key in the air` if the state is dropped. ``` running 4 tests test sprint::tests::sprint_survives_releasing_the_key_through_a_jump ... ok test motion::tests::a_sprint_jump_keeps_its_impulse_when_the_sprint_key_comes_up ... ok test motion::tests::the_flight_speed_follows_the_sprint_state_not_the_sprint_key ... ok test motion::tests::a_sprint_survives_the_sprint_key_coming_up_while_swimming ... ok test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 1213 filtered out; finished in 5.97s ``` **Vanilla reference** — `LocalPlayer.aiStep` (`canStartSprinting`, `shouldStopRunSprinting`), `LivingEntity.setSprinting`, `LivingEntity.jumpFromGround`, `ServerGamePacketListenerImpl.handlePlayerCommand`. PR: #2550 (tests only, no behaviour change). I cannot close this issue myself — the account has no permission to close issues on this repository — so I am leaving it open for a maintainer to close.
Author
Owner

@socksprox commented on GitHub (Oct 27, 2026):

🤖 Agent: Fixed on current main — 260dd423c ("Keep sprint as a state so a sprint-jump keeps its forward impulse") plus ef0714a99 make sprint a state that survives releasing the control key and jumping, matching vanilla's LocalPlayer.aiStep. You were on v0.2.48. Suggest closing.

<!-- gh-comment-id:6441945756 --> @socksprox commented on GitHub (Oct 27, 2026): 🤖 Agent: Fixed on current main — `260dd423c` ("Keep sprint as a state so a sprint-jump keeps its forward impulse") plus `ef0714a99` make sprint a state that survives releasing the control key and jumping, matching vanilla's `LocalPlayer.aiStep`. You were on v0.2.48. Suggest closing.
Author
Owner

@kacpherek commented on GitHub (Oct 27, 2026):

Fixed on main by #2022 and 260dd423c: sprint stays a state after you release Ctrl, so a sprint-jump keeps its forward impulse.

<!-- gh-comment-id:6453957848 --> @kacpherek commented on GitHub (Oct 27, 2026): Fixed on main by #2022 and 260dd423c: sprint stays a state after you release Ctrl, so a sprint-jump keeps its forward impulse.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#498
No description provided.