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:
@@ -0,0 +1,20 @@
|
||||
#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);
|
||||
}
|
||||
@@ -48,8 +48,11 @@ namespace F4T::ServerBrowser
|
||||
void ResetFilters();
|
||||
void ApplyFilters();
|
||||
void SetAllServers(std::vector<ServerEntry> a_servers);
|
||||
void SetLocalServers(std::vector<ServerEntry> a_servers);
|
||||
void ToggleFavorite(const std::string& a_serverId);
|
||||
const ServerEntry* FindServer(const std::string& a_serverId) const;
|
||||
const ServerEntry* FindLocalServer(const std::string& a_serverId) const;
|
||||
const std::vector<ServerEntry>& GetLocalServers() const { return m_localServers; }
|
||||
const std::vector<ServerEntry>& GetFilteredServers() const { return m_filteredServers; }
|
||||
const BrowserFilters& GetFilters() const { return m_filters; }
|
||||
std::string GetConnectionStatus() const { return m_connectionStatus; }
|
||||
@@ -63,6 +66,7 @@ namespace F4T::ServerBrowser
|
||||
bool PassesFilters(const ServerEntry& a_entry) const;
|
||||
|
||||
std::vector<ServerEntry> m_allServers;
|
||||
std::vector<ServerEntry> m_localServers;
|
||||
std::vector<ServerEntry> m_filteredServers;
|
||||
BrowserFilters m_filters;
|
||||
std::string m_connectionStatus{ "Online" };
|
||||
|
||||
Reference in New Issue
Block a user