[PR #199] [MERGED] Play with friends (2/3): Invite friends in the pause menu (no server needed) #2398

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

📋 Pull Request Information

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

Base: main ← Head: feat/friends-host


📝 Commits (10+)

  • 60ddf3d Play with friends: invite codes, the relay and the encrypted tunnel
  • 74c1a90 Relay: hand out IPv4 clients' addresses as IPv4
  • de464a8 Play with friends without a server: endpoints and key in the code
  • 5189a73 Invite codes: one address per LAN, no unique-local IPv6, the macOS firewall prompt in the docs
  • 61b0aaf Relay: no hosting platform in its comments
  • fe7df46 Play with friends: bound handshakes and the relay's first line in time, cap relay connections
  • 7784350 Play with friends: Invite friends in the pause menu
  • 21a70c8 LAN: a guest's entity id no longer takes the host's
  • 241dee2 Invite friends: count direct and relayed sessions in friends status
  • 872e77e Invite friends: who is here and notices read in the muted colour, the hint stays faint

📊 Changes

33 files changed (+6746 additions, -6 deletions)

View changed files

➕ .dockerignore (+8 -0)
📝 Cargo.lock (+199 -0)
📝 Cargo.toml (+1 -1)
📝 crates/horizon-client/Cargo.toml (+1 -0)
📝 crates/horizon-client/src/front.rs (+149 -2)
📝 crates/horizon-client/src/game.rs (+5 -0)
📝 crates/horizon-client/src/game/control.rs (+4 -0)
➕ crates/horizon-client/src/game/friends.rs (+263 -0)
📝 crates/horizon-client/src/game/lan.rs (+1 -0)
📝 crates/horizon-client/src/game/screens.rs (+11 -1)
📝 crates/horizon-client/src/lan/hub.rs (+3 -1)
📝 crates/horizon-client/src/ui_theme.rs (+24 -1)
➕ crates/horizon-friends/Cargo.toml (+24 -0)
➕ crates/horizon-friends/src/code.rs (+159 -0)
➕ crates/horizon-friends/src/crypto.rs (+392 -0)
➕ crates/horizon-friends/src/direct.rs (+335 -0)
➕ crates/horizon-friends/src/guest.rs (+309 -0)
➕ crates/horizon-friends/src/host.rs (+571 -0)
➕ crates/horizon-friends/src/invite.rs (+403 -0)
➕ crates/horizon-friends/src/lib.rs (+185 -0)

...and 13 more files

📄 Description

Stacked on #192.

What

  • Invite friends in Horizon's pause menu beside Open to LAN. One click: opens the world to LAN if it isn't (Open to LAN's defaults: free port, guest commands off, forced game mode), then shares it. Works with no relay: the panel shows the full invite code (monospace, wrapped in groups) with Copy and Stop sharing, then who can join from what the game found: "Friends anywhere can join: your router opened the port with UPnP (…)", or the advice when it can't (UPnP, the port to forward and the LAN address, a relay, a VPN; CGNAT called out) with a link to the troubleshooting docs. "Here now: …" lists the guests.
  • Stop sharing / closing the world ends the code: direct port closed, router mapping deleted, LAN closed again if sharing opened it.
  • Optional relay (the player's own): friendsRelay in horizon.txt (the Join a friend page's Relay field, PR 3) or HORIZON_RELAY_URL adds the relay's short code to the panel. Env knobs: HORIZON_FRIENDS_PORT, HORIZON_FRIENDS_UPNP=0, HORIZON_STUN_SERVERS.
  • horizon-ctl friends host|stop|status (code, short code, summary/verdict, direct port, direct/relayed counts, guests).
  • ui_theme::save_preferences no longer wipes other horizon.txt lines (preference/set_preference helpers).
  • LAN fix (own commit): Hub::admit gave the first guest the host's own entity id, so LAN guests never saw the host. Checked by tools/test_friends.py --baseline over plain LAN.
  • Offline mode like LAN (online-mode identity can come later over the same tunnel). Classic (vanilla-look) pause menu unchanged.

How tested

Workspace clippy -D warnings; end to end in tools/test_friends.py (PR 3): host shares with no relay, guest joins with the code; stop sharing; then with a locally run relay. Screenshots on vscreen (kept local, they show game textures).

Needs Ludovic

Nothing. feature: it works for players as soon as it merges with #200.

🤖 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/199 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/friends-host` --- ### 📝 Commits (10+) - [`60ddf3d`](https://github.com/horizon-rust/horizon/commit/60ddf3daf8906f0750c2d1a68248b40b9430e90d) Play with friends: invite codes, the relay and the encrypted tunnel - [`74c1a90`](https://github.com/horizon-rust/horizon/commit/74c1a9098025b0baac2e63225a9100de0de91771) Relay: hand out IPv4 clients' addresses as IPv4 - [`de464a8`](https://github.com/horizon-rust/horizon/commit/de464a8fc0b147a8dd281d19c6f18e5532a07af2) Play with friends without a server: endpoints and key in the code - [`5189a73`](https://github.com/horizon-rust/horizon/commit/5189a735c71c2c6e461172530cce8fac2a4e5e8e) Invite codes: one address per LAN, no unique-local IPv6, the macOS firewall prompt in the docs - [`61b0aaf`](https://github.com/horizon-rust/horizon/commit/61b0aafbf8c3ace061daad2901573301f29a9542) Relay: no hosting platform in its comments - [`fe7df46`](https://github.com/horizon-rust/horizon/commit/fe7df463fa1de5b7d352c7d5034faaa7918f5b86) Play with friends: bound handshakes and the relay's first line in time, cap relay connections - [`7784350`](https://github.com/horizon-rust/horizon/commit/7784350bad422fff2741959e5e1698255d3d8251) Play with friends: Invite friends in the pause menu - [`21a70c8`](https://github.com/horizon-rust/horizon/commit/21a70c8e97b606bf791a6e79b244b23e37d3883f) LAN: a guest's entity id no longer takes the host's - [`241dee2`](https://github.com/horizon-rust/horizon/commit/241dee2649b601ebb43326345cd0ea85b845f55a) Invite friends: count direct and relayed sessions in friends status - [`872e77e`](https://github.com/horizon-rust/horizon/commit/872e77e19bdf6af8c58a3b1c269ba0e8344fc206) Invite friends: who is here and notices read in the muted colour, the hint stays faint ### 📊 Changes **33 files changed** (+6746 additions, -6 deletions) <details> <summary>View changed files</summary> ➕ `.dockerignore` (+8 -0) 📝 `Cargo.lock` (+199 -0) 📝 `Cargo.toml` (+1 -1) 📝 `crates/horizon-client/Cargo.toml` (+1 -0) 📝 `crates/horizon-client/src/front.rs` (+149 -2) 📝 `crates/horizon-client/src/game.rs` (+5 -0) 📝 `crates/horizon-client/src/game/control.rs` (+4 -0) ➕ `crates/horizon-client/src/game/friends.rs` (+263 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+1 -0) 📝 `crates/horizon-client/src/game/screens.rs` (+11 -1) 📝 `crates/horizon-client/src/lan/hub.rs` (+3 -1) 📝 `crates/horizon-client/src/ui_theme.rs` (+24 -1) ➕ `crates/horizon-friends/Cargo.toml` (+24 -0) ➕ `crates/horizon-friends/src/code.rs` (+159 -0) ➕ `crates/horizon-friends/src/crypto.rs` (+392 -0) ➕ `crates/horizon-friends/src/direct.rs` (+335 -0) ➕ `crates/horizon-friends/src/guest.rs` (+309 -0) ➕ `crates/horizon-friends/src/host.rs` (+571 -0) ➕ `crates/horizon-friends/src/invite.rs` (+403 -0) ➕ `crates/horizon-friends/src/lib.rs` (+185 -0) _...and 13 more files_ </details> ### 📄 Description Stacked on #192. ## What - **Invite friends** in Horizon's pause menu beside Open to LAN. One click: opens the world to LAN if it isn't (Open to LAN's defaults: free port, guest commands off, forced game mode), then shares it. **Works with no relay**: the panel shows the full invite code (monospace, wrapped in groups) with **Copy** and **Stop sharing**, then who can join from what the game found: "Friends anywhere can join: your router opened the port with UPnP (…)", or the advice when it can't (UPnP, the port to forward and the LAN address, a relay, a VPN; CGNAT called out) with a link to the troubleshooting docs. "Here now: …" lists the guests. - Stop sharing / closing the world ends the code: direct port closed, router mapping deleted, LAN closed again if sharing opened it. - Optional relay (the player's own): `friendsRelay` in horizon.txt (the Join a friend page's Relay field, PR 3) or `HORIZON_RELAY_URL` adds the relay's short code to the panel. Env knobs: `HORIZON_FRIENDS_PORT`, `HORIZON_FRIENDS_UPNP=0`, `HORIZON_STUN_SERVERS`. - `horizon-ctl friends host|stop|status` (code, short code, summary/verdict, direct port, direct/relayed counts, guests). - `ui_theme::save_preferences` no longer wipes other horizon.txt lines (`preference`/`set_preference` helpers). - **LAN fix** (own commit): `Hub::admit` gave the first guest the host's own entity id, so LAN guests never saw the host. Checked by `tools/test_friends.py --baseline` over plain LAN. - Offline mode like LAN (online-mode identity can come later over the same tunnel). Classic (vanilla-look) pause menu unchanged. ## How tested Workspace clippy `-D warnings`; end to end in `tools/test_friends.py` (PR 3): host shares with no relay, guest joins with the code; stop sharing; then with a locally run relay. Screenshots on vscreen (kept local, they show game textures). ## Needs Ludovic Nothing. `feature`: it works for players as soon as it merges with #200. 🤖 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:55:41 +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#2398
No description provided.