[PR #1595] [MERGED] Player: the window stops ticking its player while the game is paused #3618

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

📋 Pull Request Information

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

Base: main ← Head: fix/paused-player-tick


📝 Commits (5)

  • 4c3abd8 Player: the window stops ticking its player while the game is paused
  • 0e60740 Pause: the server thread stops ticking its players, not the window
  • 7d06aca Player: also stop sending the state packet while the game is paused
  • 40eb3e2 Merge branch 'cg8-1595-new' into cg8-1595
  • 0849283 Pause: drop the state-packet gates, Game::tick doesn't run while paused

📊 Changes

3 files changed (+10 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+1 -1)
📝 crates/horizon-client/src/game/lan.rs (+8 -3)
📝 crates/horizon-client/src/game/levels.rs (+1 -1)

📄 Description

🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself.

Fixes #1592.

What and why

With the pause menu open in singleplayer, the air supply kept draining and the drowning damage landed as soon as the menu closed.

The pause itself works for the server: Game::pauses_game feeds self.pause, and IntegratedServer::set_paused stores the flag the server thread skips its world tick on. What kept running is the window's own copy of the player. Both local paths call controlled_simulation_tick every frame, and that chain reaches tick_environment_damage in motion/environment.rs, which is the code that decrements air and pushes MotionEvent::Drown with its two points of damage.

Vanilla has no such loop: Minecraft.tick skips the level while the game is paused, so nothing about the player advances. Two conditions added, one per path: tick_remote_level in game/remote.rs (a window that is a client of a server: server-thread singleplayer, a LAN guest, multiplayer) and the in-frame local tick in game.rs. Keys are already neutral whenever a screen is open (playing = self.screen == Screen::Playing), so this changes nothing about input: it stops air, hunger, fall prediction and the drowning events from running ahead of the paused server.

self.pause is the same flag the rest of the client already uses for this state (audio in game/music.rs, the pad's ticking, the frame clock), so the gate follows the existing convention rather than adding a second notion of paused.

Vanilla reference

Minecraft.tick does not tick the level or the player while pause is set (Minecraft.pauseGame sets it, and IntegratedServer.tickServer skips the world with it). The air logic being skipped is LivingEntity.baseTick's decreaseAirSupply path, which Horizon already ports as motion::environment::tick_environment_damage.

Self-check

The pr_ready block goes into a comment below when that run finishes.

No harness covers this today: the two paths are client ticks, not commands, and the harnesses drive commands. A driver like tools/lan_e2e.py would be the place for it (pause, wait past the air supply, check the bubbles and health), and I would rather add that where it can run on your machine than ship an unrunnable one. cargo check -p horizon-client is clean; rustfmt passes.

🤖 Generated with Hermes Agent (Nous Research)


🔄 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/1595 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/paused-player-tick` --- ### 📝 Commits (5) - [`4c3abd8`](https://github.com/horizon-rust/horizon/commit/4c3abd86de2af8c54e3f68594a064108c788be9d) Player: the window stops ticking its player while the game is paused - [`0e60740`](https://github.com/horizon-rust/horizon/commit/0e607404d102ec31fde7567f40b666b3db2b91d9) Pause: the server thread stops ticking its players, not the window - [`7d06aca`](https://github.com/horizon-rust/horizon/commit/7d06aca17ae73c3d36bb67b64ab2bda0998c1f38) Player: also stop sending the state packet while the game is paused - [`40eb3e2`](https://github.com/horizon-rust/horizon/commit/40eb3e202a64de0609c1ce82193e82285c8dd72e) Merge branch 'cg8-1595-new' into cg8-1595 - [`0849283`](https://github.com/horizon-rust/horizon/commit/0849283a9da0b3f3178a45c29d50ecec97d381c6) Pause: drop the state-packet gates, Game::tick doesn't run while paused ### 📊 Changes **3 files changed** (+10 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -1) 📝 `crates/horizon-client/src/game/lan.rs` (+8 -3) 📝 `crates/horizon-client/src/game/levels.rs` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. Fixes #1592. ## What and why With the pause menu open in singleplayer, the air supply kept draining and the drowning damage landed as soon as the menu closed. The pause itself works for the server: `Game::pauses_game` feeds `self.pause`, and `IntegratedServer::set_paused` stores the flag the server thread skips its world tick on. What kept running is the window's own copy of the player. Both local paths call `controlled_simulation_tick` every frame, and that chain reaches `tick_environment_damage` in `motion/environment.rs`, which is the code that decrements `air` and pushes `MotionEvent::Drown` with its two points of damage. Vanilla has no such loop: `Minecraft.tick` skips the level while the game is paused, so nothing about the player advances. Two conditions added, one per path: `tick_remote_level` in `game/remote.rs` (a window that is a client of a server: server-thread singleplayer, a LAN guest, multiplayer) and the in-frame local tick in `game.rs`. Keys are already neutral whenever a screen is open (`playing = self.screen == Screen::Playing`), so this changes nothing about input: it stops air, hunger, fall prediction and the drowning events from running ahead of the paused server. `self.pause` is the same flag the rest of the client already uses for this state (audio in `game/music.rs`, the pad's `ticking`, the frame clock), so the gate follows the existing convention rather than adding a second notion of paused. ## Vanilla reference `Minecraft.tick` does not tick the level or the player while `pause` is set (`Minecraft.pauseGame` sets it, and `IntegratedServer.tickServer` skips the world with it). The air logic being skipped is `LivingEntity.baseTick`'s `decreaseAirSupply` path, which Horizon already ports as `motion::environment::tick_environment_damage`. ## Self-check The `pr_ready` block goes into a comment below when that run finishes. No harness covers this today: the two paths are client ticks, not commands, and the harnesses drive commands. A driver like `tools/lan_e2e.py` would be the place for it (pause, wait past the air supply, check the bubbles and health), and I would rather add that where it can run on your machine than ship an unrunnable one. `cargo check -p horizon-client` is clean; `rustfmt` passes. 🤖 Generated with Hermes Agent (Nous Research) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:10: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#3618
No description provided.