Skip to content

feat(nr-ri8n): players on different home networks can play a network game together - #3400

Merged
rmstdope merged 2 commits into
mainfrom
nr-ri8n
Oct 30, 2026
Merged

rmstdope merged 2 commits into
mainfrom
nr-ri8n

Conversation

@rmstdope

Copy link
Copy Markdown
Owner

Bead: nr-ri8n, Players on different home networks can play a network game together (mockup docs/ui/nr-ri8n-internet-play.html).

What changes

  • web/src/netplay/peer_link.ts: both peer connections use ICE_SERVERS = [{ urls: "stun:outpost.rmstdope.eu:3478" }], so the offer and answer carry each browser's public address. Gathering keeps its 3 s cap, so with outpost down only same-network play works. No TURN (that is nr-1wbx).
  • web/src/netplay/session.ts: CONNECT_LIMIT_MS is now 10 s instead of 15 s ("about 10 seconds at most"), counted on both sides from the joiner being in the room.
  • web/src/ui/play_together.ts and web/main.css: the address line beneath the two cards, the new can't-connect message (focus on Start again, as the acceptance states), and the new too-slow advice.
  • README, architecture.md, and the header comment of the Playwright spec.

Validation

  • ./scripts/gate-full.sh: passed (1085 Vitest tests, typecheck, every Rust/Python leg).
  • pnpm exec playwright test web/integration/specs/play-together.integration.spec.ts: 9 passed. Two browsers on one machine still connect with STUN configured.
  • A STUN Binding Request to outpost.rmstdope.eu:3478/udp got a Binding Success (0x0101).
  • Human check for the verifier: two homes on broadband reach Connected; a phone hotspot on one side gets "Couldn't connect your two computers." on both sides within about 10 s.

Deviations from the plan

None. One decision is recorded in the plan: the acceptance says focus goes to Start again "as for today's message", but the old code focused Close. The explicit statement wins.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WCDKf1PWoqB8eBTNnkDuvg

rmstdope and others added 2 commits October 30, 2026 16:31
…game together

Each browser asks outpost (stun:outpost.rmstdope.eu:3478) for its public
address, the connect limit drops to 10 s, and the window gets the agreed
address line, can't-connect message and too-slow advice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WCDKf1PWoqB8eBTNnkDuvg
@rmstdope

Copy link
Copy Markdown
Owner Author

Review (cold read, reviewed_head: 26dd587995013c156b9dd38e435a5aa7a4d537c7): reviewed before merge under the producer's review practice, by an agent given the diff and the bead, and not the producer's reasoning.

The reviewer found nothing that blocks a merge. It confirmed that every string matches the acceptance word for word, that focus goes to Start again for both host and joiner, and that both peer connections use outpost's STUN. The connect limit is 10 s on both sides, and the budget fits: two 3 s gathers when outpost is down, plus about 1 s for the five-ping check, against Playwright's 20 s timeout. The address line meets the acceptance: it comes after both cards, it is a p that cannot take focus, and it uses --steel-hi as the mockup does. Each new or changed test would have failed on the old code, and README and architecture.md are updated.

  1. web/src/ui/play_together.ts failureAlert fallback, and web/src/netplay/session.ts (no working WebRTC, an offer the browser refuses, an unrecognised liaison error reason): these also end in unreachable, so players are told their networks don't allow a direct connection, which is the wrong cause. This is not a regression, because the old text was just as wrong for these cases. Suggested as a follow-up rather than a change here.
  2. web/integration/specs/play-together.integration.spec.ts: the edited header comment has a line of about 170 characters; re-wrap it to about 100 to match the comment around it.

Producer's answers

  • 1: No change in this PR. The agreed experience gives this message to "whatever the cause", and adding a separate message for a missing WebRTC or an unknown liaison reply would be a new piece of experience, which UX has to agree first. I'm raising it with the navigator as a possible follow-up bead.
  • 2: Fixed by re-wrapping the comment. The commit touches only that comment, so it needs no follow-up review.

@rmstdope
rmstdope merged commit 8646bea into main Oct 30, 2026
11 checks passed
@rmstdope
rmstdope deleted the nr-ri8n branch October 30, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant