[PR #3011] [MERGED] fix(client): the window keeps drawing while single player's server starts #4750

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3011
Author: @feeldev12
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: feat/integrated-loads-async


📝 Commits (1)

  • 356b69a fix(client): the window keeps drawing while single player's server starts

📊 Changes

2 files changed (+80 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+28 -1)
📝 crates/horizon-client/src/game/integrated.rs (+52 -9)

📄 Description

What and why

Opening a single-player world on the server thread froze the window for the whole load: open_integrated blocked on ready.recv() until the server had its world and spawn ready. On a slow machine or a phone that's many seconds of a stuck frame, and Windows marks the window "Not responding".

Vanilla keeps the client running: Minecraft.doWorldLoad shows a LevelLoadingScreen and ticks it while singleplayerServer.isReady() is false.

  • open_integrated starts the server thread and keeps it as integrated::Starting, then returns.
  • poll_integrated_start (called from resume_world_entry each frame) joins through memory once the ready message arrives. A failure is reported exactly as before: the same error out of the same path.
  • While starting, render draws the LevelLoadingScreen's title (multiplayer.downloadingTerrain) over the menu background. Input waits, as for pending_entry and world_loader.
  • Runs without a window and synchronous_startup runs (harnesses, control, benchmark) still wait in place, so their output doesn't change.

Not in this PR: the screen's chunk map and progress bar. The integrated server knows them and the window doesn't yet, so they need a small request to the server thread. I'd send that as a follow-up.

Vanilla reference

  • Minecraft.doWorldLoad: new LevelLoadingScreen(loadTracker, Reason.OTHER), then while (!singleplayerServer.isReady() || gui.overlay() != null) { screen.tick(); runAllTasks(); … }.
  • WorldOpenFlows.openWorld shows selectWorld.data_read only while reading level.dat, before doWorldLoad; that part is unchanged here.

No harness: window/loop behaviour; the synchronous paths that harnesses use are unchanged.

Self-check

cargo fmt and cargo check -p horizon-client --all-targets are clean. I didn't run the full pr_ready.py locally (it is slow on this machine); CI's verify covers it. The same change has run in a downstream build on Windows and Android.


🔄 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/3011 **Author:** [@feeldev12](https://github.com/feeldev12) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/integrated-loads-async` --- ### 📝 Commits (1) - [`356b69a`](https://github.com/horizon-rust/horizon/commit/356b69aea7e7eadce73e56efc73f8d57a58372b9) fix(client): the window keeps drawing while single player's server starts ### 📊 Changes **2 files changed** (+80 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+28 -1) 📝 `crates/horizon-client/src/game/integrated.rs` (+52 -9) </details> ### 📄 Description ## What and why Opening a single-player world on the server thread froze the window for the whole load: `open_integrated` blocked on `ready.recv()` until the server had its world and spawn ready. On a slow machine or a phone that's many seconds of a stuck frame, and Windows marks the window "Not responding". Vanilla keeps the client running: `Minecraft.doWorldLoad` shows a `LevelLoadingScreen` and ticks it while `singleplayerServer.isReady()` is false. - `open_integrated` starts the server thread and keeps it as `integrated::Starting`, then returns. - `poll_integrated_start` (called from `resume_world_entry` each frame) joins through memory once the ready message arrives. A failure is reported exactly as before: the same error out of the same path. - While starting, `render` draws the LevelLoadingScreen's title (`multiplayer.downloadingTerrain`) over the menu background. Input waits, as for `pending_entry` and `world_loader`. - Runs without a window and `synchronous_startup` runs (harnesses, control, benchmark) still wait in place, so their output doesn't change. Not in this PR: the screen's chunk map and progress bar. The integrated server knows them and the window doesn't yet, so they need a small request to the server thread. I'd send that as a follow-up. ## Vanilla reference - `Minecraft.doWorldLoad`: `new LevelLoadingScreen(loadTracker, Reason.OTHER)`, then `while (!singleplayerServer.isReady() || gui.overlay() != null) { screen.tick(); runAllTasks(); … }`. - `WorldOpenFlows.openWorld` shows `selectWorld.data_read` only while reading `level.dat`, before `doWorldLoad`; that part is unchanged here. No harness: window/loop behaviour; the synchronous paths that harnesses use are unchanged. ## Self-check `cargo fmt` and `cargo check -p horizon-client --all-targets` are clean. I didn't run the full `pr_ready.py` locally (it is slow on this machine); CI's `verify` covers it. The same change has run in a downstream build on Windows and Android. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:40 +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#4750
No description provided.