[PR #5767] [MERGED] Anticheat prediction: play a guest's item use as its client does #6485

Closed
opened 2026-11-03 06:21:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5767
Author: @ludovic111
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/anticheat-prediction-item-use


📝 Commits (1)

  • 16559f6 Anticheat prediction: play a guest's item use as its client does

📊 Changes

1 file changed (+21 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/prediction.rs (+21 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Part of #5725, step 2: the largest false-positive source prediction has on the official server.

Why

An item in use slows the client to its use_effects speed (0.2 for most) and stops its sprint: food, a bow, a shield, a spyglass. The replay plays a guest on the server's copy of its body. That copy takes the item use from Game.sync_player_body, which runs only for the window's own player, so a guest's copy never had one.

The replay therefore walked a guest who was eating or drawing a bow at full speed: 0.8 of a walk (0.173 blocks a tick) or of a sprint (0.224) off, on every tick of the use. 0.173 is the most common offset in the official server's log. The new detail lines (#5726) show it as an ordinary player moving 0.043 a tick on the ground, while the replay expects 0.215:

UNX0WN failed prediction (VL 64.1): moved up to 0.172 blocks off what its keys allow (1 tick; off -0.172 +0.000 +0.013, moved 0.043, ground)

Change

guest_replay sets the copy's item use speed and its no-sprint flag from the item the guest is using (main hand or off hand), as it already does for the glider. Per-tick cost: one map lookup per guest per tick.

Proof

A vanilla 26.3 client on a dedicated server, with prediction on and the 20–120 ms jitter relay. It walks and sprints in random directions while drawing a bow, for 3 minutes:

  • before: 503 flags, steady at 0.224;
  • after: 2 flags, of 0.045.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 3bc251ea5, 7 min 37 s)

Check Result
Scope ✅ 1 files, +21 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 511 passed (1 min 11 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 37 s)
tests: horizon-client ✅ 1655 passed (4 min 12 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 34 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 22 more

Clean-room: vanilla 26.3 only (ItemUseModifier, LocalPlayer.modifyInput), no other project's code.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5767 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/anticheat-prediction-item-use` --- ### 📝 Commits (1) - [`16559f6`](https://github.com/horizon-rust/horizon/commit/16559f6668518930b18b886c105e1e15ab393b66) Anticheat prediction: play a guest's item use as its client does ### 📊 Changes **1 file changed** (+21 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/prediction.rs` (+21 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #5725, step 2: the largest false-positive source `prediction` has on the official server. ## Why An item in use slows the client to its `use_effects` speed (0.2 for most) and stops its sprint: food, a bow, a shield, a spyglass. The replay plays a guest on the server's copy of its body. That copy takes the item use from `Game.sync_player_body`, which runs only for the window's own player, so a guest's copy never had one. The replay therefore walked a guest who was eating or drawing a bow at full speed: 0.8 of a walk (0.173 blocks a tick) or of a sprint (0.224) off, on every tick of the use. 0.173 is the most common offset in the official server's log. The new detail lines (#5726) show it as an ordinary player moving 0.043 a tick on the ground, while the replay expects 0.215: ``` UNX0WN failed prediction (VL 64.1): moved up to 0.172 blocks off what its keys allow (1 tick; off -0.172 +0.000 +0.013, moved 0.043, ground) ``` ## Change `guest_replay` sets the copy's item use speed and its no-sprint flag from the item the guest is using (main hand or off hand), as it already does for the glider. Per-tick cost: one map lookup per guest per tick. ## Proof A vanilla 26.3 client on a dedicated server, with prediction on and the 20–120 ms jitter relay. It walks and sprints in random directions while drawing a bow, for 3 minutes: - before: **503** flags, steady at 0.224; - after: **2** flags, of 0.045. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 3bc251ea5, 7 min 37 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +21 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 511 passed (1 min 11 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 37 s) | | tests: horizon-client | ✅ 1655 passed (4 min 12 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 34 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, forced_end, friends_integration, hardcore_respawn, lan_integration, locator_bar and 22 more | Clean-room: vanilla 26.3 only (`ItemUseModifier`, `LocalPlayer.modifyInput`), no other project's code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:21:22 +07:00
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#6485
No description provided.