[PR #3777] [MERGED] Splitscreen: a second player in the same window (HORIZON_SPLIT, testing) #5212

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3777
Author: @martipops
Created: 10/29/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: split/06-two-players


📝 Commits (10+)

  • b3e5cb2 Merge remote-tracking branch 'origin/split/02-audio' into split/06-two-players
  • ce0983f Merge remote-tracking branch 'origin/split/04-pointer-ownership' into split/06-two-players
  • 563d85f Merge remote-tracking branch 'origin/split/05-viewports' into split/06-two-players
  • 70a9fd6 Splitscreen: a second player in the same window (HORIZON_SPLIT=N)
  • c911e90 splitscreen_e2e: find horizon-ctl.exe on Windows
  • 557a675 splitscreen_e2e: replies through a file, so Windows doesn't hang on launch
  • 90f2db9 Merge remote-tracking branch 'upstream/main' into split/06-two-players
  • dc772c4 Merge upstream main into part 6
  • 0286833 Merge remote-tracking branch 'upstream/main' into split/06-two-players
  • 126d270 Splitscreen: alone, device events go straight to P1 as window events do

📊 Changes

16 files changed (+1164 additions, -34 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+16 -7)
📝 crates/horizon-client-render/src/widgets.rs (+19 -0)
📝 crates/horizon-client/build.rs (+9 -0)
📝 crates/horizon-client/src/game.rs (+34 -13)
📝 crates/horizon-client/src/game/control.rs (+9 -0)
📝 crates/horizon-client/src/game/discord.rs (+4 -0)
📝 crates/horizon-client/src/game/integrated.rs (+88 -6)
📝 crates/horizon-client/src/game/music.rs (+4 -0)
📝 crates/horizon-client/src/game/options.rs (+19 -2)
📝 crates/horizon-client/src/game/packs.rs (+6 -1)
📝 crates/horizon-client/src/game/pad.rs (+6 -1)
📝 crates/horizon-client/src/game/remote.rs (+6 -2)
➕ crates/horizon-client/src/game/split.rs (+557 -0)
➕ crates/horizon-client/src/game/split/players.rs (+182 -0)
📝 crates/horizon-client/src/lan/conn.rs (+6 -2)
➕ tools/splitscreen_e2e.py (+199 -0)

📄 Description

🤖 Opened by martipops's AI agent (Claude), not by martipops themselves.

Blocked by: #3727 (#3726, #3774, #3775 are merged)

What and why

Part of the splitscreen series (#3541). Depends on #3726 (compositor), #3727 (audio), #3774
(pointer ownership) and #3775 (layout)
: this branch merges them, so until they land the diff
below includes theirs. This part's own commit is 70a9fd6f6: about 915 lines of Rust and 190 of
Python.

The first part that runs more than one player. With HORIZON_SPLIT=N (testing only; there is
no switch for players yet), N-1 more players join P1's world on this computer:

  • Each is its own Game in this process (game/split.rs, game/split/players.rs), joining
    P1's server thread through memory as P2, P3... (Integrated::join_split: let in while the
    world isn't open to LAN, given the owner's permissions, the game no longer pauses while they
    play; leave_split undoes it).
  • Every player renders offscreen on one device; P1's window's compositor (#3726) copies each
    frame into its view (#3775's layout). The players' GPU waits happen once, after all have
    submitted (Renderer::paced_elsewhere), and one frame limiter paces them all.
  • Keyboard and mouse drive the view clicked last (#3774); a click elsewhere while the mouse is
    captured does nothing (Esc frees it first, as in vanilla). Moving them releases every held key
    and button of the previous player.
  • One audio output, heard from every player's camera (#3727).
  • A player that quits or disconnects drops out; alone again, P1 draws on its window exactly as
    before. Without HORIZON_SPLIT nothing changes: no compositor, no extra game.
  • The other players' games never touch what is P1's: music, Discord status, performance
    session, crash report server, quit, fullscreen, sound volumes, options.txt (each has its
    own in splitscreen/profiles/P<n>/). They never open the controllers (pad.feed): routing
    controllers to players is the next part.
  • Windows: the game's main thread gets 8 MB of stack (Windows gives 1 MB; a Game is ~67 KB and
    is built deep in the event loop).

Order change: the plan in #3541 had controller routing before this. On its own it could only
be code nothing calls, so it comes next, where each controller can drive its own player.

Size: over the ~500 asked. A second player that actually plays needs the game, its join, the
compositing loop and the guards together; the guards are small and spread over 9 files. If you
want it smaller, the keyboard/mouse click hand-off (~80 lines) can move to its own PR.

Suggested label: skip-release (nothing reachable without the env var).

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on Mac, against upstream/main at 7e42cc8ec, 6 min 22 s)

Check Result
Scope ⚠️ 25 files, +2227 −66; 2217 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 416 passed (30 s)
rustfmt ✅ (6 s)
clippy ✅ (1 min 39 s)
tests: horizon-client, horizon-client-render ✅ 1373 passed (3 min 20 s)
doc tests ✅ 0 passed (45 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 64 affected, to run in CI (--quick): arrow, block_entity_tickers, block_particles, block_removal, block_transformer, cauldron, chest_pair, command_exec, command_parse, composter, container_title, crafter and 52 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The scope line counts the four parts this one is on as well.

Live, on macOS: python3 tools/splitscreen_e2e.py (new; the harness core):

  • join: two players take equal halves side by side, P2 is in the world; P2's quit drops it
    and P1 gets its whole window back and plays on.
  • four: four equal quarters; P4 disconnects and the three re-split (one wide on top, two below).

Also: clippy -D warnings on all targets, cargo check --no-default-features (the server
build). Windows and Linux: tested on branches that contain this one. Windows passes all 11 live scenarios
and martipops's hand test with physical controllers; Linux (Fedora 44, GNOME on Wayland) passes alone,
join and four (details in the comments).

🤖 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/3777 **Author:** [@martipops](https://github.com/martipops) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `split/06-two-players` --- ### 📝 Commits (10+) - [`b3e5cb2`](https://github.com/horizon-rust/horizon/commit/b3e5cb2fa609cb87dd861dd37d1d9d748669dcdf) Merge remote-tracking branch 'origin/split/02-audio' into split/06-two-players - [`ce0983f`](https://github.com/horizon-rust/horizon/commit/ce0983fecc34035d440217ff3fc403001a446fa0) Merge remote-tracking branch 'origin/split/04-pointer-ownership' into split/06-two-players - [`563d85f`](https://github.com/horizon-rust/horizon/commit/563d85f95758086b66f3d046f0fe68412fccfeff) Merge remote-tracking branch 'origin/split/05-viewports' into split/06-two-players - [`70a9fd6`](https://github.com/horizon-rust/horizon/commit/70a9fd6f6a75d25d1c26dfaf26a9f4e26399ae8d) Splitscreen: a second player in the same window (HORIZON_SPLIT=N) - [`c911e90`](https://github.com/horizon-rust/horizon/commit/c911e9060de550927a854a3ec3f7995561c1f90a) splitscreen_e2e: find horizon-ctl.exe on Windows - [`557a675`](https://github.com/horizon-rust/horizon/commit/557a675d5dda830cd9e7506fd3e84ef1a31f50f6) splitscreen_e2e: replies through a file, so Windows doesn't hang on launch - [`90f2db9`](https://github.com/horizon-rust/horizon/commit/90f2db91140412e1b9ec22aea025fa7f2686de48) Merge remote-tracking branch 'upstream/main' into split/06-two-players - [`dc772c4`](https://github.com/horizon-rust/horizon/commit/dc772c460179e9e24380f432c522fde165983d09) Merge upstream main into part 6 - [`0286833`](https://github.com/horizon-rust/horizon/commit/0286833cb740b7ea807361e179f2bc78d674adec) Merge remote-tracking branch 'upstream/main' into split/06-two-players - [`126d270`](https://github.com/horizon-rust/horizon/commit/126d270448148709d407fb865dbc5cfd1be52b8c) Splitscreen: alone, device events go straight to P1 as window events do ### 📊 Changes **16 files changed** (+1164 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+16 -7) 📝 `crates/horizon-client-render/src/widgets.rs` (+19 -0) 📝 `crates/horizon-client/build.rs` (+9 -0) 📝 `crates/horizon-client/src/game.rs` (+34 -13) 📝 `crates/horizon-client/src/game/control.rs` (+9 -0) 📝 `crates/horizon-client/src/game/discord.rs` (+4 -0) 📝 `crates/horizon-client/src/game/integrated.rs` (+88 -6) 📝 `crates/horizon-client/src/game/music.rs` (+4 -0) 📝 `crates/horizon-client/src/game/options.rs` (+19 -2) 📝 `crates/horizon-client/src/game/packs.rs` (+6 -1) 📝 `crates/horizon-client/src/game/pad.rs` (+6 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+6 -2) ➕ `crates/horizon-client/src/game/split.rs` (+557 -0) ➕ `crates/horizon-client/src/game/split/players.rs` (+182 -0) 📝 `crates/horizon-client/src/lan/conn.rs` (+6 -2) ➕ `tools/splitscreen_e2e.py` (+199 -0) </details> ### 📄 Description > 🤖 Opened by martipops's AI agent (Claude), not by martipops themselves. **Blocked by:** #3727 (#3726, #3774, #3775 are merged) ## What and why Part of the splitscreen series (#3541). **Depends on #3726 (compositor), #3727 (audio), #3774 (pointer ownership) and #3775 (layout)**: this branch merges them, so until they land the diff below includes theirs. This part's own commit is 70a9fd6f6: about 915 lines of Rust and 190 of Python. The first part that runs more than one player. With `HORIZON_SPLIT=N` (testing only; there is no switch for players yet), N-1 more players join P1's world on this computer: - Each is its own `Game` in this process (`game/split.rs`, `game/split/players.rs`), joining P1's server thread through memory as P2, P3... (`Integrated::join_split`: let in while the world isn't open to LAN, given the owner's permissions, the game no longer pauses while they play; `leave_split` undoes it). - Every player renders offscreen on one device; P1's window's compositor (#3726) copies each frame into its view (#3775's layout). The players' GPU waits happen once, after all have submitted (`Renderer::paced_elsewhere`), and one frame limiter paces them all. - Keyboard and mouse drive the view clicked last (#3774); a click elsewhere while the mouse is captured does nothing (Esc frees it first, as in vanilla). Moving them releases every held key and button of the previous player. - One audio output, heard from every player's camera (#3727). - A player that quits or disconnects drops out; alone again, P1 draws on its window exactly as before. Without `HORIZON_SPLIT` nothing changes: no compositor, no extra game. - The other players' games never touch what is P1's: music, Discord status, performance session, crash report server, quit, fullscreen, sound volumes, `options.txt` (each has its own in `splitscreen/profiles/P<n>/`). They never open the controllers (`pad.feed`): routing controllers to players is the next part. - Windows: the game's main thread gets 8 MB of stack (Windows gives 1 MB; a `Game` is ~67 KB and is built deep in the event loop). **Order change:** the plan in #3541 had controller routing before this. On its own it could only be code nothing calls, so it comes next, where each controller can drive its own player. **Size:** over the ~500 asked. A second player that actually plays needs the game, its join, the compositing loop and the guards together; the guards are small and spread over 9 files. If you want it smaller, the keyboard/mouse click hand-off (~80 lines) can move to its own PR. Suggested label: `skip-release` (nothing reachable without the env var). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on Mac, against upstream/main at 7e42cc8ec, 6 min 22 s) | Check | Result | | --- | --- | | Scope | ⚠️ 25 files, +2227 −66; 2217 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 416 passed (30 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (1 min 39 s) | | tests: horizon-client, horizon-client-render | ✅ 1373 passed (3 min 20 s) | | doc tests | ✅ 0 passed (45 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 64 affected, to run in CI (--quick): arrow, block_entity_tickers, block_particles, block_removal, block_transformer, cauldron, chest_pair, command_exec, command_parse, composter, container_title, crafter and 52 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The scope line counts the four parts this one is on as well. Live, on macOS: `python3 tools/splitscreen_e2e.py` (new; the harness core): - `join`: two players take equal halves side by side, P2 is in the world; P2's `quit` drops it and P1 gets its whole window back and plays on. - `four`: four equal quarters; P4 disconnects and the three re-split (one wide on top, two below). Also: clippy `-D warnings` on all targets, `cargo check --no-default-features` (the server build). Windows and Linux: tested on branches that contain this one. Windows passes all 11 live scenarios and martipops's hand test with physical controllers; Linux (Fedora 44, GNOME on Wayland) passes `alone`, `join` and `four` (details in the comments). 🤖 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-03 05:11:00 +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#5212
No description provided.