N6 Joining games: direct connect, LAN and server list #37

Closed
opened 2026-11-09 05:28:17 +00:00 by claude · 1 comment
Owner

Depends on: N1

Direct connect by address, LAN discovery, and an optional self-hostable list server. Humans fill slots first and bots backfill the rest.

Acceptance

  • A list server is included and tested with fake servers. No third-party matchmaking service is required.
  • Bot backfill works when players join and leave in the lobby.
**Depends on:** N1 Direct connect by address, LAN discovery, and an optional self-hostable list server. Humans fill slots first and bots backfill the rest. **Acceptance** - A list server is included and tested with fake servers. No third-party matchmaking service is required. - Bot backfill works when players join and leave in the lobby.
claude added this to the v0.5 Multiplayer milestone 2026-11-09 05:28:17 +00:00
claude added the priority/hightype/feature labels 2026-11-09 05:28:17 +00:00
claude added this to the Tidewall v1.0 project 2026-11-09 15:00:08 +00:00
eric closed this issue 2026-11-12 22:33:37 +00:00
Author
Owner

Done in f795ee3.

What changed

  • Direct connect was already there (--connect=HOST[:PORT]).
  • LAN discovery: a listening server answers discovery queries on its game port + 1 (ServerBeacon; --no-lan turns it off). ServerBrowser.scan_lan() broadcasts to the discovery ports of eight game ports (24650, 24652 … 24664), so several servers on one machine are found.
  • List server, self-hostable: tools/godot.sh -- --list-server [--port=N] (ListServer, default UDP 24660). Game servers register with --list=HOST[:PORT] --name=NAME every 15 s. A server is listed under the address its packets come from, and only after it echoes a challenge token derived from a per-start secret and its address and port. Entries expire after 45 s, with at most 8 per address and 256 in all. Every source is rate-limited. No third-party service is involved.
  • Anti-amplification: queries are padded to 512 bytes and no answer is larger. A challenge is smaller than the register that triggered it.
  • Client: --browse [--list=…] [--lan-target=IP] [--lan-port=N] prints what it finds as one JSON line. A10's menus will show the same list.
  • Joining and backfill: people joining in the lobby or countdown take places. Bots are only added at match start, into the places still empty. Someone who connects mid-match or during results now watches a living player (or the winner) instead of being told the server is full, and takes a place ahead of bots in the next lobby (Match.watch()).

Tests: make check passes: 469 tests, self-check and smoke (p99 2.4 ms with 24 bots). New tests:

  • Codec round trips and size limits.
  • A 40,000-message mutation fuzz of every discovery decoder and the list server's handler: no errors, nothing registered.
  • The list server against fake servers over loopback: challenge flow, wrong, missing and stolen tokens, renewal, expiry, per-address and overall caps, and a flood.
  • A LAN scan finding two beacons on neighbouring ports.
  • A beacon ignoring challenges it didn't ask for.
  • A watcher over real UDP.
  • Bot backfill as people join and leave in the lobby.
  • Watchers taking places ahead of bots.

make discovery-check (new) runs a list server, a game server and --browse as real processes, and finds the game both ways. make client-check still passes.

Not tested: a real broadcast across a physical LAN. The tests send to loopback, because the sandbox may not route broadcasts.

Done in f795ee3. **What changed** - **Direct connect** was already there (`--connect=HOST[:PORT]`). - **LAN discovery:** a listening server answers discovery queries on its game port + 1 (`ServerBeacon`; `--no-lan` turns it off). `ServerBrowser.scan_lan()` broadcasts to the discovery ports of eight game ports (24650, 24652 … 24664), so several servers on one machine are found. - **List server, self-hostable:** `tools/godot.sh -- --list-server [--port=N]` (`ListServer`, default UDP 24660). Game servers register with `--list=HOST[:PORT] --name=NAME` every 15 s. A server is listed under the address its packets come from, and only after it echoes a challenge token derived from a per-start secret and its address and port. Entries expire after 45 s, with at most 8 per address and 256 in all. Every source is rate-limited. No third-party service is involved. - **Anti-amplification:** queries are padded to 512 bytes and no answer is larger. A challenge is smaller than the register that triggered it. - **Client:** `--browse [--list=…] [--lan-target=IP] [--lan-port=N]` prints what it finds as one JSON line. A10's menus will show the same list. - **Joining and backfill:** people joining in the lobby or countdown take places. Bots are only added at match start, into the places still empty. Someone who connects mid-match or during results now **watches** a living player (or the winner) instead of being told the server is full, and takes a place ahead of bots in the next lobby (`Match.watch()`). **Tests:** `make check` passes: 469 tests, self-check and smoke (p99 2.4 ms with 24 bots). New tests: - Codec round trips and size limits. - A 40,000-message mutation fuzz of every discovery decoder and the list server's handler: no errors, nothing registered. - The list server against fake servers over loopback: challenge flow, wrong, missing and stolen tokens, renewal, expiry, per-address and overall caps, and a flood. - A LAN scan finding two beacons on neighbouring ports. - A beacon ignoring challenges it didn't ask for. - A watcher over real UDP. - Bot backfill as people join and leave in the lobby. - Watchers taking places ahead of bots. `make discovery-check` (new) runs a list server, a game server and `--browse` as real processes, and finds the game both ways. `make client-check` still passes. **Not tested:** a real broadcast across a physical LAN. The tests send to loopback, because the sandbox may not route broadcasts.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#37