[PR #876] [MERGED] Server: pair a respawned player again for the other players #2877

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

📋 Pull Request Information

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

Base: main ← Head: fix/server-respawn-repair


📝 Commits (1)

  • 20d9c4c Pair a respawned player again for the other players

📊 Changes

6 files changed (+104 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/remote.rs (+7 -0)
📝 crates/horizon-client/src/game/screens.rs (+5 -0)
📝 crates/horizon-client/src/lan/entity.rs (+29 -0)
📝 crates/horizon-client/src/lan/hub.rs (+15 -0)
📝 tools/lan_e2e.py (+44 -1)

📄 Description

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

Part of #731 (making the server thread the default): "a respawned player is removed from and paired again for the other players (their clients kept the dead body)".

What was wrong

When a player respawned, Hub::respawn cleared only that player's own tracker. Every other client kept tracking the same entity id, which its client had drawn dead (EntityEvent DEATH). The tracker then moved the dead body to the respawn point, still lying down. On the server thread this hits the host window too, because the window is a client of the server.

In-frame LAN had a second gap: the host's death never reached its guests at all, so they kept seeing the host standing.

Fix

  • Hub::respawned(id) follows vanilla's ServerLevel.removePlayerImmediately and then addRespawnedPlayer. Every other client tracking the player gets RemoveEntities and forgets it (Tracker::forget). The next tick pairs the player again as a new entity. Hub::respawn calls it.
  • In-frame host:
    • its death sends EntityEvent 3 to the guests (LivingEntity.die);
    • its respawn goes through Hub::respawned too.
  • status (remote part) gets dead_players: the other players this client draws dead.
  • New lan_e2e check respawn. The host dies and respawns (on the server thread the guest does too), and the other side's client must draw it dead, then alive again.

Checks

Check main (6d238a89) this branch
lan_e2e --server-thread --check respawn FAIL: the host still lies dead after respawning PASS (host and guest)
lan_e2e --check respawn (in-frame) FAIL: the host was never drawn dead PASS
  • lan_e2e --server-thread: hazards and pvp, which run just before respawn, PASS. walls still fails here, as it does on main; #863 fixes it.
  • Server harnesses:
    • lan: 462 cases match;
    • dedicated_server: 592 identical;
    • server_dimension_players: 22 identical;
    • server_entities: 25 identical.
  • lan:: unit tests: 29 pass, including the new a_forgotten_entity_is_paired_again_at_the_next_tick.
  • Workspace clippy -D warnings and fmt are clean.
  • Rebased on 6e09dbe1 (after #864's tracker change). The unit tests and the respawn check were run again after the rebase.

Per the coordinator, I skipped parity.py --changed; CI parity covers the other harnesses.

🤖 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/876 **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/server-respawn-repair` --- ### 📝 Commits (1) - [`20d9c4c`](https://github.com/horizon-rust/horizon/commit/20d9c4c9844e5ab618e650c6d16a46958bafe46f) Pair a respawned player again for the other players ### 📊 Changes **6 files changed** (+104 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+7 -0) 📝 `crates/horizon-client/src/game/screens.rs` (+5 -0) 📝 `crates/horizon-client/src/lan/entity.rs` (+29 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+15 -0) 📝 `tools/lan_e2e.py` (+44 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #731 (making the server thread the default): "a respawned player is removed from and paired again for the other players (their clients kept the dead body)". ## What was wrong When a player respawned, `Hub::respawn` cleared only that player's own tracker. Every other client kept tracking the same entity id, which its client had drawn dead (EntityEvent DEATH). The tracker then moved the dead body to the respawn point, still lying down. On the server thread this hits the host window too, because the window is a client of the server. In-frame LAN had a second gap: the host's death never reached its guests at all, so they kept seeing the host standing. ## Fix - `Hub::respawned(id)` follows vanilla's `ServerLevel.removePlayerImmediately` and then `addRespawnedPlayer`. Every other client tracking the player gets `RemoveEntities` and forgets it (`Tracker::forget`). The next tick pairs the player again as a new entity. `Hub::respawn` calls it. - In-frame host: - its death sends EntityEvent 3 to the guests (`LivingEntity.die`); - its respawn goes through `Hub::respawned` too. - `status` (remote part) gets `dead_players`: the other players this client draws dead. - New lan_e2e check `respawn`. The host dies and respawns (on the server thread the guest does too), and the other side's client must draw it dead, then alive again. ## Checks | Check | main (6d238a89) | this branch | | --- | --- | --- | | lan_e2e `--server-thread --check respawn` | FAIL: the host still lies dead after respawning | PASS (host and guest) | | lan_e2e `--check respawn` (in-frame) | FAIL: the host was never drawn dead | PASS | - lan_e2e `--server-thread`: hazards and pvp, which run just before respawn, PASS. walls still fails here, as it does on main; #863 fixes it. - Server harnesses: - lan: 462 cases match; - dedicated_server: 592 identical; - server_dimension_players: 22 identical; - server_entities: 25 identical. - `lan::` unit tests: 29 pass, including the new `a_forgotten_entity_is_paired_again_at_the_next_tick`. - Workspace clippy `-D warnings` and fmt are clean. - Rebased on 6e09dbe1 (after #864's tracker change). The unit tests and the respawn check were run again after the rebase. Per the coordinator, I skipped `parity.py --changed`; CI parity covers the other harnesses. 🤖 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:48 +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#2877
No description provided.