[GH-ISSUE #1072] Single player on its server thread by default (was #731): send every entity type to server clients first #300

Closed
opened 2026-11-02 15:38:01 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @ludovic111 on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1072

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

Tracking issue for the work of #731 (closed unmerged; its branch fix/server-thread-default is kept on GitHub). Goal: single player runs on its server thread by default, like vanilla's integrated server; --no-server-thread / HORIZON_SERVER_THREAD=0 keep the in-frame world.

What blocks it

  • The server sends its clients only mobs and dropped items (lan_entities). Minecarts, boats, armor stands, paintings, item frames, projectiles, experience orbs, falling blocks and primed TNT are never sent. With the server thread on by default, single player would stop showing them. world_reopen fails on this (its summoned minecart is on the server but not in the window). LAN guests already have this gap today.
  • Moving adds no exhaustion on the server-thread path: tools/lan_e2e.py --check hazards --server-thread fails at "no hunger from moving" on plain main (found 2026-10-18).
  • /tick doesn't work with --server-thread (#1038).

Also missing on the server thread (listed in #731, not blockers on their own)

  • Block-break progress from other players (BlockDestruction) isn't drawn: the breaking renderer has a single crumbling_sprite uniform and needs a per-vertex stage in breaking::geometry.
  • The remote client ignores LightUpdate, ClearTitles and SetSubtitleText.
  • Command suggestions that need the server (ask_server) aren't requested. Furnace and smoker recipe books, RecipeBookSeen and RecipeBookChangeSettings aren't done.
  • Conduits have no server-side effect.
  • The hub never sends SetHealth 0 when a guest dies.

Where the branch stands

fix/server-thread-default (head 2818c89f, +2999/-435, on main from 2026-10-18; it needs a rebase). Its dependencies (#695, #697, #700, #708, #714) are all merged now. Besides the default flip, it holds fixes that also help --server-thread and LAN without the flip, and that could land on their own as small PRs:

  • agent and control commands (give, time, command) run on the server as the world's owner (owner_console_command);
  • defaultgamemode reaches the hub;
  • the remote client sends its held slot before using an item, mining or attacking (ensureHasSentCarriedItem);
  • remote chat lines feed the agent's event log (wait-for chat);
  • other players' crouch flag and pose, including values back at their default;
  • respawned players are removed and re-added for the others;
  • a teleport drops the guest's moves sent before it;
  • the agent's place waits for the server's block;
  • fly ... raw reports the tick time;
  • lan_e2e and agent_control_e2e harness fixes.

The measurements (Mac mini, busy machine) are in #731: in the forest the frame went from about 17-27 FPS to 340-630 FPS with the server thread on.

Suggested order

  1. Split the independent fixes above out of the branch, one small PR each, against current main.
  2. Send every entity type to server clients (the lan_entities gap), with world_reopen and lan_e2e as proof.
  3. Exhaustion from moving and /tick (#1038) on the server thread.
  4. Then flip the default, with a full local parity run and lan_e2e on both modes.
Originally created by @ludovic111 on GitHub (Oct 21, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1072 > 🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself. Tracking issue for the work of #731 (closed unmerged; its branch `fix/server-thread-default` is kept on GitHub). Goal: single player runs on its server thread by default, like vanilla's integrated server; `--no-server-thread` / `HORIZON_SERVER_THREAD=0` keep the in-frame world. ## What blocks it - **The server sends its clients only mobs and dropped items** (`lan_entities`). Minecarts, boats, armor stands, paintings, item frames, projectiles, experience orbs, falling blocks and primed TNT are never sent. With the server thread on by default, single player would stop showing them. `world_reopen` fails on this (its summoned minecart is on the server but not in the window). LAN guests already have this gap today. - **Moving adds no exhaustion on the server-thread path**: `tools/lan_e2e.py --check hazards --server-thread` fails at "no hunger from moving" on plain main (found 2026-10-18). - **`/tick` doesn't work with `--server-thread`** (#1038). ## Also missing on the server thread (listed in #731, not blockers on their own) - Block-break progress from other players (`BlockDestruction`) isn't drawn: the breaking renderer has a single `crumbling_sprite` uniform and needs a per-vertex stage in `breaking::geometry`. - The remote client ignores `LightUpdate`, `ClearTitles` and `SetSubtitleText`. - Command suggestions that need the server (`ask_server`) aren't requested. Furnace and smoker recipe books, `RecipeBookSeen` and `RecipeBookChangeSettings` aren't done. - Conduits have no server-side effect. - The hub never sends `SetHealth` 0 when a guest dies. ## Where the branch stands `fix/server-thread-default` (head 2818c89f, +2999/-435, on main from 2026-10-18; it needs a rebase). Its dependencies (#695, #697, #700, #708, #714) are all merged now. Besides the default flip, it holds fixes that also help `--server-thread` and LAN without the flip, and that could land on their own as small PRs: - agent and control commands (`give`, `time`, `command`) run on the server as the world's owner (`owner_console_command`); - `defaultgamemode` reaches the hub; - the remote client sends its held slot before using an item, mining or attacking (`ensureHasSentCarriedItem`); - remote chat lines feed the agent's event log (`wait-for chat`); - other players' crouch flag and pose, including values back at their default; - respawned players are removed and re-added for the others; - a teleport drops the guest's moves sent before it; - the agent's `place` waits for the server's block; - `fly ... raw` reports the tick time; - lan_e2e and agent_control_e2e harness fixes. The measurements (Mac mini, busy machine) are in #731: in the forest the frame went from about 17-27 FPS to 340-630 FPS with the server thread on. ## Suggested order 1. Split the independent fixes above out of the branch, one small PR each, against current main. 2. Send every entity type to server clients (the `lan_entities` gap), with `world_reopen` and lan_e2e as proof. 3. Exhaustion from moving and `/tick` (#1038) on the server thread. 4. Then flip the default, with a full local parity run and lan_e2e on both modes.
bsakaguchi 2026-11-02 15:38:01 +07:00
Author
Owner

@ludovic111 commented on GitHub (Oct 21, 2026):

🤖 Agent: #495 (rdbt, 2026-10-16) is closed as a duplicate of this issue. Its evidence, kept here:

  • The F3 frame chart had a spike train at the 20 TPS tick rate: 3 ms min / 4 ms avg / 15 ms max frames, with the integrated server at 10.7 ms per tick. That was on a Ryzen 5 5600X and RTX 4060, Vulkan, immediate present.
  • Pausing the game makes the stutters go away. Vanilla on the same machine stays smooth even while its TPS drops.
  • rdbt (2026-10-17): "This should be made the default rather than opt-in as soon as possible. If game ticks take longer than 50ms then the game becomes completely unplayable."
<!-- gh-comment-id:6313517410 --> @ludovic111 commented on GitHub (Oct 21, 2026): 🤖 Agent: #495 (rdbt, 2026-10-16) is closed as a duplicate of this issue. Its evidence, kept here: - The F3 frame chart had a spike train at the 20 TPS tick rate: 3 ms min / 4 ms avg / 15 ms max frames, with the integrated server at 10.7 ms per tick. That was on a Ryzen 5 5600X and RTX 4060, Vulkan, immediate present. - Pausing the game makes the stutters go away. Vanilla on the same machine stays smooth even while its TPS drops. - rdbt (2026-10-17): "This should be made the default rather than opt-in as soon as possible. If game ticks take longer than 50ms then the game becomes completely unplayable."
Author
Owner

@ludovic111 commented on GitHub (Oct 21, 2026):

🤖 Agent: progress on the default switch. It isn't shipped yet: the steps below are left before the switch PR can open.

Done or in review

  • Entity tracking over the hub: already on main.
  • Exhaustion, damage and hazards on the server thread: lan_e2e hazards pass.
  • /tick on the server thread: #1088 (open). Covers sprint pacing with the [Server: Sprint completed …] report, query with real tick times, step reaching the window, and a camera that keeps interpolating in a frozen level. This also fixes #1038.
  • The owner's console commands run with the hub in place, so @a selectors and /defaultgamemode reach it: #1095 (open).
  • The switch itself is on branch fix/server-thread-default-v2, rebased on main at dc6d411a. It makes the server thread the default, adds --no-server-thread, and HORIZON_SERVER_THREAD=0 turns it off. It also has the harness changes: the command harness stays in-frame, the agent's place waits for the server's block, and lan_e2e and agent_control_e2e run on the server thread.

Measured on that branch (Mac mini)

  • world_reopen, save_roundtrip: pass.
  • lan_e2e: in-frame 39/39. Server thread 38/39: swings is flaky ("no face of block … is visible").
  • agent_control_e2e pick on the server thread still fails after #1086, but now only at step 3. After the creative inventory closes, reopening the survival inventory and middle-clicking reads carried as the 64 cloned logs. The next read shows null, so the server's reset arrives one round trip late. Vanilla's client also keeps the carried stack until the server answers (AbstractContainerMenu.removed only acts for a ServerPlayer). So the fix is either a wait in the test or the remote client clearing a creative-only clone itself. Check ItemPickerMenu and CreativeModeInventoryScreen first.
  • Full parity run: stopped after 21 of 262 harnesses (hours at this machine's job cap). 20 passed. block_particles failed on a Rust probe the branch doesn't touch; main has since changed that tool and fixture (ce87bfb8, a96bfb39). Only world_reopen, save_roundtrip, command_exec and light open a world, so the switch can reach only those; command_exec passed.

Remaining steps, in order

  1. Merge #1088, then #1095.
  2. Rebase fix/server-thread-default-v2 on main.
  3. agent_control_e2e pick step 3 on the server thread: decide between the test waiting for the server's carried update and the client clearing the clone (see above).
  4. lan_e2e swings on the server thread: make it reliable (aim from the server's block state, or retry).
  5. Run the full parity pass on the rebased branch, plus lan_e2e and agent_control_e2e in both modes (--no-server-thread for in-frame).
  6. Open the switch PR with Fixes #1072.
<!-- gh-comment-id:6322124813 --> @ludovic111 commented on GitHub (Oct 21, 2026): 🤖 Agent: progress on the default switch. It isn't shipped yet: the steps below are left before the switch PR can open. **Done or in review** - Entity tracking over the hub: already on main. - Exhaustion, damage and hazards on the server thread: `lan_e2e` hazards pass. - `/tick` on the server thread: #1088 (open). Covers sprint pacing with the `[Server: Sprint completed …]` report, `query` with real tick times, `step` reaching the window, and a camera that keeps interpolating in a frozen level. This also fixes #1038. - The owner's console commands run with the hub in place, so `@a` selectors and `/defaultgamemode` reach it: #1095 (open). - The switch itself is on branch `fix/server-thread-default-v2`, rebased on main at dc6d411a. It makes the server thread the default, adds `--no-server-thread`, and `HORIZON_SERVER_THREAD=0` turns it off. It also has the harness changes: the command harness stays in-frame, the agent's `place` waits for the server's block, and `lan_e2e` and `agent_control_e2e` run on the server thread. **Measured on that branch (Mac mini)** - `world_reopen`, `save_roundtrip`: pass. - `lan_e2e`: in-frame 39/39. Server thread 38/39: `swings` is flaky ("no face of block … is visible"). - `agent_control_e2e pick` on the server thread still fails after #1086, but now only at step 3. After the creative inventory closes, reopening the survival inventory and middle-clicking reads `carried` as the 64 cloned logs. The next read shows `null`, so the server's reset arrives one round trip late. Vanilla's client also keeps the carried stack until the server answers (`AbstractContainerMenu.removed` only acts for a `ServerPlayer`). So the fix is either a wait in the test or the remote client clearing a creative-only clone itself. Check `ItemPickerMenu` and `CreativeModeInventoryScreen` first. - Full parity run: stopped after 21 of 262 harnesses (hours at this machine's job cap). 20 passed. `block_particles` failed on a Rust probe the branch doesn't touch; main has since changed that tool and fixture (ce87bfb8, a96bfb39). Only `world_reopen`, `save_roundtrip`, `command_exec` and `light` open a world, so the switch can reach only those; `command_exec` passed. **Remaining steps, in order** 1. Merge #1088, then #1095. 2. Rebase `fix/server-thread-default-v2` on main. 3. `agent_control_e2e pick` step 3 on the server thread: decide between the test waiting for the server's carried update and the client clearing the clone (see above). 4. `lan_e2e swings` on the server thread: make it reliable (aim from the server's block state, or retry). 5. Run the full parity pass on the rebased branch, plus `lan_e2e` and `agent_control_e2e` in both modes (`--no-server-thread` for in-frame). 6. Open the switch PR with `Fixes #1072`.
Author
Owner

@ludovic111 commented on GitHub (Oct 21, 2026):

🤖 Agent: fix in #1114 (switch to the server thread by default). It needs #1100 and #1108 first; #1099 is merged.

<!-- gh-comment-id:6326069166 --> @ludovic111 commented on GitHub (Oct 21, 2026): 🤖 Agent: fix in #1114 (switch to the server thread by default). It needs #1100 and #1108 first; #1099 is merged.
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#300
No description provided.