[PR #3794] [MERGED] Splitscreen: each controller drives its own player #5219

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

📋 Pull Request Information

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

Base: main ← Head: split/07-controllers


📝 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)
  • 9b19ab5 Splitscreen: each controller drives its own player
  • c911e90 splitscreen_e2e: find horizon-ctl.exe on Windows
  • 408ca59 Merge branch 'split/06-two-players' into split/07-controllers
  • 557a675 splitscreen_e2e: replies through a file, so Windows doesn't hang on launch
  • bd6ead7 Merge branch 'split/06-two-players' into split/07-controllers
  • 90f2db9 Merge remote-tracking branch 'upstream/main' into split/06-two-players

📊 Changes

18 files changed (+1474 additions, -67 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 (+35 -1)
📝 crates/horizon-client/src/game/pad/hardware.rs (+117 -33)
📝 crates/horizon-client/src/game/remote.rs (+6 -2)
➕ crates/horizon-client/src/game/split.rs (+574 -0)
➕ crates/horizon-client/src/game/split/pads.rs (+147 -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: #3777 (and through it #3727)

What and why

Part of the splitscreen series (#3541). Depends on #3777 (a second player in the same
window), which this branch is built on: until it lands the diff below includes it (and the parts
it depends on). This part's own commit is 9b19ab5b0, +262 −28.

Each controller drives its own player. While several play, one controller reader
(PadRouter, game/pad/hardware.rs) serves every player's game, so a press reaches one game
only:

  • a controller nobody has goes, when pressed, to the first player without one (P1 first); the
    press that gave it is not passed on (fresh), so it doesn't also act in the game;
  • a controller that disconnects leaves its player without one; the next new one goes to it;
  • each player's button glyphs follow its own controller;
  • P1's own reader closes while others play (its events would queue unread) and opens again when
    P1 is alone, so alone, P1 reads the controllers exactly as without splitscreen (DualSense
    output included). The server build (--no-default-features) keeps a stub reader.

Still to come (the next part): offers to join with a controller, a player waiting for its lost
controller to come back, and giving P1's controller to a friend.

Suggested label: skip-release (only reachable with HORIZON_SPLIT, for testing).

Self-check

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

Check Result
Scope ⚠️ 27 files, +2486 −90; 2500 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 416 passed (24 s)
rustfmt ✅ (4 s)
clippy ✅ (1 min 19 s)
tests: horizon-client, horizon-client-render ✅ 1374 passed (2 min 34 s)
doc tests ✅ 0 passed (32 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 #3777 and the parts it is on as well.

Unit test: a new controller goes to the first player without one (P1 first; a player who lost
its controller before the later ones).

Live: python3 tools/splitscreen_e2e.py (join, four) pass on macOS and Windows. Windows (martipops, RTX
3090, two physical controllers, HORIZON_SPLIT=2): the halves draw, the click hand-off of
keyboard and mouse, each controller drives its own player and an unplugged one stops only its
player, Disconnect gives P1 the whole window back with its controller as before, F11, no crash;
the log has no errors. horizon-ctl's virtual pad bypasses the router, so no live test covers
physical routing.

🤖 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/3794 **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/07-controllers` --- ### 📝 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) - [`9b19ab5`](https://github.com/horizon-rust/horizon/commit/9b19ab5b04934069d9332b3073c3ba22c52eda9c) Splitscreen: each controller drives its own player - [`c911e90`](https://github.com/horizon-rust/horizon/commit/c911e9060de550927a854a3ec3f7995561c1f90a) splitscreen_e2e: find horizon-ctl.exe on Windows - [`408ca59`](https://github.com/horizon-rust/horizon/commit/408ca59a6540691bab3eb8adfaa85c104404ef68) Merge branch 'split/06-two-players' into split/07-controllers - [`557a675`](https://github.com/horizon-rust/horizon/commit/557a675d5dda830cd9e7506fd3e84ef1a31f50f6) splitscreen_e2e: replies through a file, so Windows doesn't hang on launch - [`bd6ead7`](https://github.com/horizon-rust/horizon/commit/bd6ead73c3bd43ddfe259d9762ab6f65e0b7d98a) Merge branch 'split/06-two-players' into split/07-controllers - [`90f2db9`](https://github.com/horizon-rust/horizon/commit/90f2db91140412e1b9ec22aea025fa7f2686de48) Merge remote-tracking branch 'upstream/main' into split/06-two-players ### 📊 Changes **18 files changed** (+1474 additions, -67 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` (+35 -1) 📝 `crates/horizon-client/src/game/pad/hardware.rs` (+117 -33) 📝 `crates/horizon-client/src/game/remote.rs` (+6 -2) ➕ `crates/horizon-client/src/game/split.rs` (+574 -0) ➕ `crates/horizon-client/src/game/split/pads.rs` (+147 -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:** #3777 (and through it #3727) ## What and why Part of the splitscreen series (#3541). **Depends on #3777** (a second player in the same window), which this branch is built on: until it lands the diff below includes it (and the parts it depends on). This part's own commit is 9b19ab5b0, +262 −28. Each controller drives its own player. While several play, one controller reader (`PadRouter`, `game/pad/hardware.rs`) serves every player's game, so a press reaches one game only: - a controller nobody has goes, when pressed, to the first player without one (P1 first); the press that gave it is not passed on (`fresh`), so it doesn't also act in the game; - a controller that disconnects leaves its player without one; the next new one goes to it; - each player's button glyphs follow its own controller; - P1's own reader closes while others play (its events would queue unread) and opens again when P1 is alone, so alone, P1 reads the controllers exactly as without splitscreen (DualSense output included). The server build (`--no-default-features`) keeps a stub reader. Still to come (the next part): offers to join with a controller, a player waiting for its lost controller to come back, and giving P1's controller to a friend. Suggested label: `skip-release` (only reachable with `HORIZON_SPLIT`, for testing). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on Mac, against upstream/main at 7e42cc8ec, 4 min 54 s) | Check | Result | | --- | --- | | Scope | ⚠️ 27 files, +2486 −90; 2500 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 416 passed (24 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (1 min 19 s) | | tests: horizon-client, horizon-client-render | ✅ 1374 passed (2 min 34 s) | | doc tests | ✅ 0 passed (32 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 #3777 and the parts it is on as well. Unit test: a new controller goes to the first player without one (P1 first; a player who lost its controller before the later ones). Live: `python3 tools/splitscreen_e2e.py` (`join`, `four`) pass on macOS and Windows. Windows (martipops, RTX 3090, two physical controllers, `HORIZON_SPLIT=2`): the halves draw, the click hand-off of keyboard and mouse, each controller drives its own player and an unplugged one stops only its player, Disconnect gives P1 the whole window back with its controller as before, F11, no crash; the log has no errors. horizon-ctl's virtual pad bypasses the router, so no live test covers physical routing. 🤖 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:02 +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#5219
No description provided.