[PR #5074] [MERGED] Anticheat prediction: the vanilla client on a jittery connection, never flagged #6044

Closed
opened 2026-11-03 05:16:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5074
Author: @ludovic111
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: feat/anticheat-prediction-vanilla


📝 Commits (1)

  • d7d0ead Anticheat prediction: the vanilla client on a jittery connection, never flagged

📊 Changes

4 files changed (+261 additions, -20 deletions)

View changed files

📝 crates/horizon-client/src/game/prediction.rs (+8 -6)
📝 crates/horizon-client/src/lan/prediction.rs (+44 -12)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMover.java (+67 -0)
📝 tools/anticheat_e2e.py (+142 -2)

📄 Description

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

Movement prediction, after (c) #5012 and (d) #5041: the real vanilla 26.3 client against the prediction, on a bad connection, and the four replay gaps it found. The prediction is still off by default (only with [anticheat] in server.toml).

tools/anticheat_e2e.py --check prediction-vanilla

The vanilla client (tools/vanilla_client.py, from the owner's own files, offline) joins a dedicated server with the prediction on, through the same relay as prediction (every packet held 20–120 ms, in order). VanillaMover (mods/horizon/src/test/java, our own test class, like OfflineLanHost) runs vanilla's Main unchanged and presses its key mappings from lines on stdin, as a keyboard would, so every move is vanilla's own movement code. The client walks, sprint-jumps, strafes and sneaks, with Speed given and cleared, sprint-jumps over packed ice put under it, swims in water put under it, walks into a cow, jumps at a stone set in front of it, and glides with an elytra and a firework. The check fails if the client is flagged once, or if it didn't get 20 blocks away (keys that did nothing). It needs a screen session (on macOS the logged-in one, even locked), so it runs only with --check prediction-vanilla, not in the default set.

Result: never flagged, 6 runs out of 6 on the final build (each about 965 client ticks; the client ends about 250 blocks away). The ~25 ticks a run over the tolerance are all excused: the unseen water, ice and stone, the cow, the firework.

The four gaps it found

A Horizon client never showed them, because it runs the replay's own code. With the vanilla client, before these fixes, 5 runs out of 6 were flagged:

  1. Attributes: ClientPacketListener.handleUpdateAttributes replaces the client's modifiers with the server's, its sprint modifier included, and the client goes on sprinting as it was (Horizon's client does the same, lan::attributes::apply). The replay set the body's sprinting to the server's and then back to the client's, which put the sprint modifier back: after a teleport, every sprint-jump landed 0.03 blocks off. It now takes the attributes and keeps the client's sprinting.
  2. Changes before a teleport: when the ticks before a teleport's accept hadn't seen a change yet (an effect cleared), the restart dropped it, and the replay kept Speed. Replay::finish now applies them: the client had them all when it accepted the teleport.
  3. Jump delay: under an excuse the replay can jump where the client couldn't (on ice it hadn't received), so for the ticks after it the jump delay is unknown. A jump held then is played both ways (candidate 4, as the ground is after a teleport), and the closer one is kept.
  4. A teleport during an excuse (vanilla's own "moved wrongly" setback, here after walking into ice the client didn't have) starts the replay excused too, so it takes the client's velocity until they agree. A setback after counted ticks still starts strict.

Also run: prediction (the Horizon client, same relay) 3 out of 3 never flagged with these changes, the bot still flagged and kicked.

Cost

60 walking bots on the ground, Mac mini, 30 s warmup + 120 s: MSPT 4.08 off, 4.39 with --anticheat (the same gap as (c)). Candidate 4 only plays a second body on a tick with jump held in the 2 seconds after an excuse.

pr_ready

Check Result
Scope ✅ 4 files, +261 −20
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (52 s)
rustfmt ✅ (4 s)
clippy ✅ (12 s)
tests: horizon-client ✅ 1340 passed (2 min 27 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 ➖ 7 affected, to run in CI (--quick): dedicated_server, lan_integration, lunge_motion, mace, pearl_wind_charge, server_entities, server_knockback
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Harnesses for the server's players: server_knockback, dedicated_server and server_entities pass on this branch.

Clean-room: from vanilla 26.3 (ClientPacketListener.handleUpdateAttributes, handleMovePlayer, setValuesFromPositionPacket, LivingEntity.travelInAir, jumpFromGround) and black-box runs of the vanilla client. 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/5074 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/anticheat-prediction-vanilla` --- ### 📝 Commits (1) - [`d7d0ead`](https://github.com/horizon-rust/horizon/commit/d7d0ead29ddbb6303491c24ab82e3f4bbe73c83a) Anticheat prediction: the vanilla client on a jittery connection, never flagged ### 📊 Changes **4 files changed** (+261 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/prediction.rs` (+8 -6) 📝 `crates/horizon-client/src/lan/prediction.rs` (+44 -12) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMover.java` (+67 -0) 📝 `tools/anticheat_e2e.py` (+142 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Movement prediction, after (c) #5012 and (d) #5041: the **real vanilla 26.3 client** against the prediction, on a bad connection, and the four replay gaps it found. The prediction is still off by default (only with `[anticheat]` in server.toml). ## `tools/anticheat_e2e.py --check prediction-vanilla` The vanilla client (`tools/vanilla_client.py`, from the owner's own files, offline) joins a dedicated server with the prediction on, through the same relay as `prediction` (every packet held 20–120 ms, in order). `VanillaMover` (`mods/horizon/src/test/java`, our own test class, like `OfflineLanHost`) runs vanilla's `Main` unchanged and presses its key mappings from lines on stdin, as a keyboard would, so every move is vanilla's own movement code. The client walks, sprint-jumps, strafes and sneaks, with Speed given and cleared, sprint-jumps over packed ice put under it, swims in water put under it, walks into a cow, jumps at a stone set in front of it, and glides with an elytra and a firework. The check fails if the client is flagged once, or if it didn't get 20 blocks away (keys that did nothing). It needs a screen session (on macOS the logged-in one, even locked), so it runs only with `--check prediction-vanilla`, not in the default set. **Result: never flagged, 6 runs out of 6** on the final build (each about 965 client ticks; the client ends about 250 blocks away). The ~25 ticks a run over the tolerance are all excused: the unseen water, ice and stone, the cow, the firework. ## The four gaps it found A Horizon client never showed them, because it runs the replay's own code. With the vanilla client, before these fixes, 5 runs out of 6 were flagged: 1. **Attributes:** `ClientPacketListener.handleUpdateAttributes` replaces the client's modifiers with the server's, its sprint modifier included, and the client goes on sprinting as it was (Horizon's client does the same, `lan::attributes::apply`). The replay set the body's sprinting to the server's and then back to the client's, which put the sprint modifier back: after a teleport, every sprint-jump landed 0.03 blocks off. It now takes the attributes and keeps the client's sprinting. 2. **Changes before a teleport:** when the ticks before a teleport's accept hadn't seen a change yet (an effect cleared), the restart dropped it, and the replay kept Speed. `Replay::finish` now applies them: the client had them all when it accepted the teleport. 3. **Jump delay:** under an excuse the replay can jump where the client couldn't (on ice it hadn't received), so for the ticks after it the jump delay is unknown. A jump held then is played both ways (candidate 4, as the ground is after a teleport), and the closer one is kept. 4. **A teleport during an excuse** (vanilla's own "moved wrongly" setback, here after walking into ice the client didn't have) starts the replay excused too, so it takes the client's velocity until they agree. A setback after counted ticks still starts strict. Also run: `prediction` (the Horizon client, same relay) 3 out of 3 never flagged with these changes, the bot still flagged and kicked. ## Cost 60 walking bots on the ground, Mac mini, 30 s warmup + 120 s: MSPT 4.08 off, 4.39 with `--anticheat` (the same gap as (c)). Candidate 4 only plays a second body on a tick with jump held in the 2 seconds after an excuse. ## pr_ready | Check | Result | | --- | --- | | Scope | ✅ 4 files, +261 −20 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (52 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (12 s) | | tests: horizon-client | ✅ 1340 passed (2 min 27 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 | ➖ 7 affected, to run in CI (--quick): dedicated_server, lan_integration, lunge_motion, mace, pearl_wind_charge, server_entities, server_knockback | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Harnesses for the server's players: `server_knockback`, `dedicated_server` and `server_entities` pass on this branch. Clean-room: from vanilla 26.3 (`ClientPacketListener.handleUpdateAttributes`, `handleMovePlayer`, `setValuesFromPositionPacket`, `LivingEntity.travelInAir`, `jumpFromGround`) and black-box runs of the vanilla client. 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 05:16:50 +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#6044
No description provided.