[PR #886] [MERGED] LAN: guest clock follows /time pause and the server's game time #2888

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

📋 Pull Request Information

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

Base: main ← Head: fix/lan-paused-clock


📝 Commits (1)

  • 567cc33 LAN: the guest's clock stops with /time pause and keeps up with the server's game time

📊 Changes

6 files changed (+75 additions, -24 deletions)

View changed files

📝 crates/horizon-client/src/game/chat.rs (+10 -0)
📝 crates/horizon-client/src/game/lan.rs (+4 -6)
📝 crates/horizon-client/src/game/lan_actions.rs (+2 -5)
📝 crates/horizon-client/src/game/remote.rs (+28 -5)
📝 crates/horizon-client/src/game/server_travel.rs (+2 -5)
📝 tools/lan_e2e.py (+29 -3)

📄 Description

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

Part of #848 (reported by Tydragon00): "time of day differs between host and guest".

What

  • The paused clock. ServerClockManager.packNetworkState sends a rate of 0 while the clock is paused (/time pause) or advance_time is off. The host sent its rate regardless, so after /time pause a guest's sky kept moving. The host and the integrated server now send 0 in both cases (network_clock_rate).
  • The guest's clock. The guest added the rounded rate to its time once per client tick, so it drifted whenever its ticks and the server's differed (a stall, a slow frame, a fractional /time rate). It now follows ClientClockManager.tick: each clock advances by the game-time delta times its rate, with the fractional part carried over. ClientboundSetTimePacket sets the time, then runs that tick (handleSetTime), as vanilla does.

Tested

New check time in tools/lan_e2e.py:

  • After time set 1000 and time pause, both sides stay on the same time, 60 ticks later.
  • The guest is then stopped for 4 s (SIGSTOP) and resumed. 60 ticks later both sides are within 3 ticks of each other.

On main it fails: paused, the clocks read (1001, 1065), and after the stall (1162, 1157).

Self-check

  • cargo fmt --all -- --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean on this branch.
  • cargo test -p horizon-client -p horizon-protocol: 1019 passed, 0 failed. This ran on an integration commit of the seven #848 / #803 PRs merged together.
  • tools/lan_e2e.py, on that integration build:
    • The #848 / #803 checks (pvp hurt containers machines brewing chest clicks eat eating xp swings plates time light sleep) all pass without --server-thread.
    • With --server-thread, all pass except light, which fails on main too.
    • time fails on main.
  • Full tools/lan_e2e.py suite compared with main (e508a5ce binaries), with --server-thread:
    • Main fails self walls crafting sign pvp trials xp light.
    • The integration fails self walls crafting sign pvp trials. These fail on main too.
  • Full suite without --server-thread: later checks are order-dependent on main as well, and main fails clicks sleep push. After an earlier check, the guest's client and the server can disagree on where the guest stands, so later interactions are out of reach.
  • tools/parity.py --changed origin/main (95 harnesses) is running on the integration commit. The result will follow in a comment.

🤖 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/886 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-paused-clock` --- ### 📝 Commits (1) - [`567cc33`](https://github.com/horizon-rust/horizon/commit/567cc335768b491e6bb0fd7defc3ac3db36d06d8) LAN: the guest's clock stops with /time pause and keeps up with the server's game time ### 📊 Changes **6 files changed** (+75 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/chat.rs` (+10 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+4 -6) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+2 -5) 📝 `crates/horizon-client/src/game/remote.rs` (+28 -5) 📝 `crates/horizon-client/src/game/server_travel.rs` (+2 -5) 📝 `tools/lan_e2e.py` (+29 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #848 (reported by Tydragon00): "time of day differs between host and guest". ## What - **The paused clock.** `ServerClockManager.packNetworkState` sends a rate of 0 while the clock is paused (`/time pause`) or `advance_time` is off. The host sent its rate regardless, so after `/time pause` a guest's sky kept moving. The host and the integrated server now send 0 in both cases (`network_clock_rate`). - **The guest's clock.** The guest added the rounded rate to its time once per client tick, so it drifted whenever its ticks and the server's differed (a stall, a slow frame, a fractional `/time rate`). It now follows `ClientClockManager.tick`: each clock advances by the game-time delta times its rate, with the fractional part carried over. `ClientboundSetTimePacket` sets the time, then runs that tick (`handleSetTime`), as vanilla does. ## Tested New check `time` in `tools/lan_e2e.py`: - After `time set 1000` and `time pause`, both sides stay on the same time, 60 ticks later. - The guest is then stopped for 4 s (SIGSTOP) and resumed. 60 ticks later both sides are within 3 ticks of each other. On main it fails: paused, the clocks read (1001, 1065), and after the stall (1162, 1157). ## Self-check - `cargo fmt --all -- --check`: clean. - `cargo clippy --workspace --all-targets -- -D warnings`: clean on this branch. - `cargo test -p horizon-client -p horizon-protocol`: 1019 passed, 0 failed. This ran on an integration commit of the seven #848 / #803 PRs merged together. - `tools/lan_e2e.py`, on that integration build: - The #848 / #803 checks (`pvp hurt containers machines brewing chest clicks eat eating xp swings plates time light sleep`) all pass without `--server-thread`. - With `--server-thread`, all pass except `light`, which fails on main too. - `time` fails on main. - Full `tools/lan_e2e.py` suite compared with main (e508a5ce binaries), with `--server-thread`: - Main fails `self walls crafting sign pvp trials xp light`. - The integration fails `self walls crafting sign pvp trials`. These fail on main too. - Full suite without `--server-thread`: later checks are order-dependent on main as well, and main fails `clicks sleep push`. After an earlier check, the guest's client and the server can disagree on where the guest stands, so later interactions are out of reach. - `tools/parity.py --changed origin/main` (95 harnesses) is running on the integration commit. The result will follow in a comment. 🤖 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:59:52 +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#2888
No description provided.