Files
Commonwealth-Online-Public/plugin/include/F4TLanDiscovery.h
T
andrew 9ceb6601ae 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.
2026-06-22 15:53:17 +12:00

21 lines
349 B
C++

#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace F4T::LanDiscovery
{
struct DiscoveredServer
{
std::string host;
std::uint16_t port{ 7777 };
std::string name;
int players{ 0 };
int maxPlayers{ 16 };
int ping{ 0 };
};
std::vector<DiscoveredServer> Scan(std::string& a_error);
}