Add LAN discovery and Local servers UI
Adds LAN server discovery and a Local tab in the multiplayer UI so clients can find relays on the same LAN. Introduces a new F4T::LanDiscovery module (plugin/include/F4TLanDiscovery.h, plugin/src/F4TLanDiscovery.cpp) that probes LAN hosts via UDP discover (port 7778) and TCP welcome fallback (port 7777). Server-side support includes a UDP responder (server/lan_discovery.py) and integration in server_core.py to start/stop discovery. Plugin changes (F4TServerBrowserBridge/Data) add background scanning, dispatch results to the game thread, new local-server storage and events (scanLocalServers, localServersUpdated, localScanStarted/localScanFinished), and small join/recent handling updates. UI changes (ui/.../app.js and components) add localServers state, scanning UX, Recent persistence (localStorage), and join logic for local/direct entries. Docs updated (docs/protocol.md, docs/dev-log.md, server/README.md) and build script links iphlpapi. Also removes two unused exported sprite PNGs.
This commit is contained in:
+104
@@ -7,6 +7,110 @@ failed experiments, successful tests, and next steps.
|
||||
|
||||
---
|
||||
|
||||
## 2026-06-18 - LAN scan fixes for cross-device discovery
|
||||
|
||||
### Summary
|
||||
Fixed Local tab scans not completing or finding servers on other devices (e.g. Steam Deck → host PC). Scan results are now dispatched on the game thread, and discovery probes each LAN host directly instead of relying on broadcast alone.
|
||||
|
||||
### Files Changed
|
||||
- `plugin/src/F4TLanDiscovery.cpp`
|
||||
- `plugin/src/F4TServerBrowserBridge.cpp`
|
||||
- `server/lan_discovery.py`
|
||||
- `ui/views/CommonwealthOnline/browser/components/server-list.js`
|
||||
- `ui/views/CommonwealthOnline/browser/app.js`
|
||||
|
||||
### Details
|
||||
- PrismaUI events from the scan thread were likely dropped; completion now uses `F4SE::GetTaskInterface()->AddTask`.
|
||||
- UDP discovery sends unicast `discover` probes to every host on each active /24 subnet, plus a batched TCP `welcome` fallback on port 7777.
|
||||
- Server logs when it receives a LAN discovery probe.
|
||||
|
||||
### Testing
|
||||
- Not run in-game. On host PC: start `server/server.py`, allow UDP 7778 + TCP 7777 through Windows Firewall (Private network). On Steam Deck, open Multiplayer → Local and scan; host LAN IP should appear within ~5–10 seconds.
|
||||
|
||||
### Known Issues
|
||||
- First scan may take several seconds while the subnet is probed.
|
||||
- Windows Firewall must allow inbound UDP 7778 on the host.
|
||||
|
||||
### Next Steps
|
||||
- Verify Steam Deck → PC scan in-game after plugin rebuild.
|
||||
|
||||
---
|
||||
|
||||
## 2026-06-18 - Local servers tab and LAN discovery
|
||||
|
||||
### Summary
|
||||
Added a **Local** tab to the multiplayer menu that scans the LAN for Commonwealth Online servers. The Python relay now responds to UDP discovery probes on port 7778, and the plugin broadcasts discover requests plus a TCP welcome fallback for `127.0.0.1` and the primary LAN address.
|
||||
|
||||
### Files Changed
|
||||
- `server/lan_discovery.py` (new)
|
||||
- `server/server_core.py`
|
||||
- `server/README.md`
|
||||
- `plugin/include/F4TLanDiscovery.h` (new)
|
||||
- `plugin/src/F4TLanDiscovery.cpp` (new)
|
||||
- `plugin/include/F4TServerBrowserData.h`
|
||||
- `plugin/src/F4TServerBrowserData.cpp`
|
||||
- `plugin/src/F4TServerBrowserBridge.cpp`
|
||||
- `plugin/xmake.lua`
|
||||
- `ui/views/CommonwealthOnline/browser/index.html`
|
||||
- `ui/views/CommonwealthOnline/browser/components/tabs.js`
|
||||
- `ui/views/CommonwealthOnline/browser/components/server-list.js`
|
||||
- `ui/views/CommonwealthOnline/browser/components/controller-prompts.js`
|
||||
- `ui/views/CommonwealthOnline/browser/app.js`
|
||||
- `docs/protocol.md`
|
||||
|
||||
### Details
|
||||
- Tab order is now: Direct Connect, Browse, Local, Favorites, Recent.
|
||||
- Opening the Local tab or pressing X (Scan) triggers `scanLocalServers`.
|
||||
- Discovered servers show as `IP:port` when unnamed/local; player count and ping are shown when available.
|
||||
- UDP discovery uses `discover` / `discoverResponse` packets documented in `docs/protocol.md`.
|
||||
|
||||
### Testing
|
||||
- Not run in-game. Suggested manual test:
|
||||
1. Start `server/server.py` on the host PC.
|
||||
2. Rebuild plugin and redeploy UI.
|
||||
3. Open Main Menu → Multiplayer → Local.
|
||||
4. Confirm `127.0.0.1:7777` (or LAN IP) appears after scan.
|
||||
5. Join from the Local list and verify connection.
|
||||
6. From a second PC on the same LAN, repeat and confirm the host's LAN IP is listed.
|
||||
|
||||
### Known Issues
|
||||
- Subnet broadcast assumes a /24 LAN. Unusual masks may need future adapter-aware discovery.
|
||||
- TCP fallback briefly opens a connection and consumes a player slot on the relay until the probe disconnects.
|
||||
|
||||
### Next Steps
|
||||
- In-game verify Windows Firewall prompts for UDP 7778 on first LAN scan.
|
||||
- Test with two machines on the same subnet.
|
||||
|
||||
---
|
||||
|
||||
## 2026-06-18 - Recent servers tab
|
||||
|
||||
### Summary
|
||||
Made the multiplayer menu Recent tab functional. Successful joins (browser list or direct connect) are saved to a persisted recent list (up to 8 entries). Recent entries reconnect via stored host/port when they are no longer in the browser list. Display names fall back to `IP:port` when the server has no name or is local.
|
||||
|
||||
### Files Changed
|
||||
- `ui/views/CommonwealthOnline/browser/app.js`
|
||||
- `ui/views/CommonwealthOnline/browser/components/server-list.js`
|
||||
- `plugin/src/F4TServerBrowserBridge.cpp`
|
||||
|
||||
### Details
|
||||
- Recent servers persist in `localStorage` under `co_recent_servers`.
|
||||
- `joinSucceeded` now includes a full `server` snapshot from the plugin for direct-connect and browser joins.
|
||||
- Direct-connect entries use a stable `recent:host:port` id and empty name so the UI shows address labels.
|
||||
- Recent list rows show a simplified single-column layout; browser/favorites rows still show favorites, player count, and ping.
|
||||
|
||||
### Testing
|
||||
- Not run in-game. After redeploying UI and rebuilding the plugin: join via Direct Connect or a browser server, reopen Multiplayer → Recent, confirm the entry appears with `127.0.0.1:7777` (or host:port) for local/direct joins, and reconnect from the Recent tab.
|
||||
|
||||
### Known Issues
|
||||
- Recent list is stored in the Ultralight webview `localStorage`; persistence across game restarts depends on PrismaUI profile retention.
|
||||
|
||||
### Next Steps
|
||||
- In-game verify Recent survives closing and reopening the browser menu.
|
||||
- Optional: move recent-server persistence to the plugin for guaranteed cross-session storage.
|
||||
|
||||
---
|
||||
|
||||
## 2026-06-18 - Server browser UI resolution scaling
|
||||
|
||||
### Summary
|
||||
|
||||
@@ -18,6 +18,41 @@ Long-term versions may move to a binary protocol if performance becomes a proble
|
||||
- `ping`
|
||||
- `pong`
|
||||
|
||||
## LAN Discovery (UDP)
|
||||
|
||||
Local server discovery uses a separate UDP channel so clients can find
|
||||
Commonwealth Online relays on the LAN without scanning every TCP port.
|
||||
|
||||
- **Discovery port:** `7778` (UDP)
|
||||
- **Game port:** `7777` (TCP) by default
|
||||
|
||||
### `discover` (client → server, UDP)
|
||||
|
||||
```json
|
||||
{"type":"discover","protocol":"commonwealth-online","version":1}
|
||||
```
|
||||
|
||||
### `discoverResponse` (server → client, UDP)
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "discoverResponse",
|
||||
"protocol": "commonwealth-online",
|
||||
"version": 1,
|
||||
"name": "Commonwealth Online Server",
|
||||
"port": 7777,
|
||||
"players": 2,
|
||||
"maxPlayers": 16
|
||||
}
|
||||
```
|
||||
|
||||
Clients should connect to the **source IP** of the UDP response using the
|
||||
`port` from the response body.
|
||||
|
||||
If UDP discovery is unavailable, the plugin may fall back to probing
|
||||
`127.0.0.1:7777` and the local LAN IPv4 address with a short TCP connect and
|
||||
`welcome` handshake check.
|
||||
|
||||
## Main Rule
|
||||
|
||||
The protocol should be testable outside Fallout 4 before it is used inside the F4SE plugin.
|
||||
|
||||
Reference in New Issue
Block a user