[PR #586] [MERGED] Dedicated server: vanilla's chunk pacing and movement checks #2654

Closed
opened 2026-11-02 15:57:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/server-move-checks


📝 Commits (3)

  • b347ceb Dedicated server: vanilla's chunk pacing and movement checks
  • 17dcb6f Merge remote-tracking branch 'origin/main' into HEAD
  • bbde190 Merge main into feat/server-move-checks

📊 Changes

7 files changed (+297 additions, -40 deletions)

View changed files

📝 crates/horizon-client/examples/lan_flat.rs (+2 -1)
📝 crates/horizon-client/src/game/lan.rs (+10 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+1 -0)
📝 crates/horizon-client/src/game/server_travel.rs (+1 -0)
📝 crates/horizon-client/src/lan/guest.rs (+24 -2)
📝 crates/horizon-client/src/lan/hub.rs (+258 -37)
📝 crates/horizon-client/tests/lan_bot.rs (+1 -0)

📄 Description

The dedicated server now paces chunks and checks moves the way vanilla's does. Without this, Horizon's server did different work from vanilla's in the benchmark (docs/server.md, section 9), so the numbers couldn't be compared.

PlayerChunkSender

  • One unacknowledged batch until the client's first chunk_batch_received, then ten.
  • Each batch holds at most the client's desired chunks per tick (it used to be twice that).
  • The quota resets to one chunk whenever every batch has been acknowledged.

ServerGamePacketListenerImpl.handleMovePlayer / handlePlayerPositionChange

  • Moved too quickly. A move further from where the tick began (firstGood) than 100 blocks squared per move packet (300 while gliding) logs <name> moved too quickly! dx,dy,dz and pulls the player back. The packet count falls back to 1 above 5. The player_movement_check and elytra_movement_check game rules turn the check off.
  • Moved wrongly. The move is replayed against the blocks with the step height:
    • A survival or adventure player who ends more than 0.25 blocks short of the target horizontally logs <name> moved wrongly! and is sent back, unless they were already stuck. Vanilla drops the vertical part because of its yDist > -0.5 || yDist < 0.5 test.
    • A move into a block the old box did not touch (isEntityCollidingWithAnythingNew) is sent back silently.
    • Spectators and sleepers skip both checks.
  • Invalid packets. NaN coordinates, non-finite angles, or two position moves in one client tick disconnect the player with invalid_player_movement.
  • Clamping and angles. Positions are clamped to the world's limits, and angles wrap the way Mth.wrapDegrees does.
  • Teleports. An unanswered teleport is sent again after 20 ticks. Accepting a teleport runs the move it carries.

The hub gets the game's block collisions through TickCtx::collision. Tests and examples pass None, which skips the block check.

Checks

  • cargo fmt --all --check: passes.
  • cargo clippy --workspace --all-targets -- -D warnings: passes.
  • cargo test --workspace: passes.
  • tools/parity.py dedicated_server online_mode server_files server_player_combat server_player_damage: 5/5 pass, run on this branch merged with the other server PRs before the rebase on main.
  • After the rebase: clippy, the LAN tests and lan_bot pass.
  • A follow-up PR adds the benchmark that uses this (the bots, and the results against vanilla).

🤖 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/586 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/server-move-checks` --- ### 📝 Commits (3) - [`b347ceb`](https://github.com/horizon-rust/horizon/commit/b347ceb19511017831a268667c2a320794502333) Dedicated server: vanilla's chunk pacing and movement checks - [`17dcb6f`](https://github.com/horizon-rust/horizon/commit/17dcb6f793b5ef7b7bc0306218287907a91bc179) Merge remote-tracking branch 'origin/main' into HEAD - [`bbde190`](https://github.com/horizon-rust/horizon/commit/bbde190f06c66764b26d4e919ac371567c7b38b5) Merge main into feat/server-move-checks ### 📊 Changes **7 files changed** (+297 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/lan_flat.rs` (+2 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+10 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+1 -0) 📝 `crates/horizon-client/src/game/server_travel.rs` (+1 -0) 📝 `crates/horizon-client/src/lan/guest.rs` (+24 -2) 📝 `crates/horizon-client/src/lan/hub.rs` (+258 -37) 📝 `crates/horizon-client/tests/lan_bot.rs` (+1 -0) </details> ### 📄 Description The dedicated server now paces chunks and checks moves the way vanilla's does. Without this, Horizon's server did different work from vanilla's in the benchmark (docs/server.md, section 9), so the numbers couldn't be compared. **PlayerChunkSender** - One unacknowledged batch until the client's first `chunk_batch_received`, then ten. - Each batch holds at most the client's desired chunks per tick (it used to be twice that). - The quota resets to one chunk whenever every batch has been acknowledged. **ServerGamePacketListenerImpl.handleMovePlayer / handlePlayerPositionChange** - *Moved too quickly.* A move further from where the tick began (`firstGood`) than 100 blocks squared per move packet (300 while gliding) logs `<name> moved too quickly! dx,dy,dz` and pulls the player back. The packet count falls back to 1 above 5. The `player_movement_check` and `elytra_movement_check` game rules turn the check off. - *Moved wrongly.* The move is replayed against the blocks with the step height: - A survival or adventure player who ends more than 0.25 blocks short of the target horizontally logs `<name> moved wrongly!` and is sent back, unless they were already stuck. Vanilla drops the vertical part because of its `yDist > -0.5 || yDist < 0.5` test. - A move into a block the old box did not touch (`isEntityCollidingWithAnythingNew`) is sent back silently. - Spectators and sleepers skip both checks. - *Invalid packets.* NaN coordinates, non-finite angles, or two position moves in one client tick disconnect the player with `invalid_player_movement`. - *Clamping and angles.* Positions are clamped to the world's limits, and angles wrap the way `Mth.wrapDegrees` does. - *Teleports.* An unanswered teleport is sent again after 20 ticks. Accepting a teleport runs the move it carries. The hub gets the game's block collisions through `TickCtx::collision`. Tests and examples pass `None`, which skips the block check. **Checks** - `cargo fmt --all --check`: passes. - `cargo clippy --workspace --all-targets -- -D warnings`: passes. - `cargo test --workspace`: passes. - `tools/parity.py dedicated_server online_mode server_files server_player_combat server_player_damage`: 5/5 pass, run on this branch merged with the other server PRs before the rebase on main. - After the rebase: clippy, the LAN tests and `lan_bot` pass. - A follow-up PR adds the benchmark that uses this (the bots, and the results against vanilla). 🤖 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-02 15:57:58 +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#2654
No description provided.