mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-29 03:46:50 +01:00
Server browser - Official servers (the backend's "official_servers") sort first and are drawn in ReSkate blue - Servers Steam friends are skating in sort next, drawn in green with the friends' names; searching a friend's name finds their server - A player in a session they joined can join another server straight from the list; hosts still end their session first, and a Steam friend's join offer never replaces a session - Joining a dedicated server from the list records it as the player's public session, so friends see it and the row shows HERE - Blocked servers (the backend's "blocked_servers") are hidden and cannot be joined, by code either - When the backend sets "server_tokens_required", dedicated servers that signed in without a login token are hidden, except on the player's own network - A search that gets no internet list from Steam keeps the last list for two minutes, and waits six seconds before treating it as empty Roles - New Staff tag from the backend's "staff" list: green name, badge and item animation, ranked after Dev - Staff can pick a rainbow for their items on the Special page; it is sent as a solid colour older builds can show, so the protocol is unchanged Dedicated server - steam_token: sign in with a Steam game server login token and keep the same Steam ID every start; empty signs in anonymously as before - A listed server without a token says so at startup, and when the token rule starts or stops hiding it - Linux servers update themselves from the release's "server_linux" tarball, with the machine's curl and tar, pinned by SHA-256, and carry on in the same process Launcher - Only create the MiniDumpWriteDump API-set shim under Wine/Proton
57 lines
2.4 KiB
C++
57 lines
2.4 KiB
C++
#pragma once
|
|
#include "Engine/Game/Multiplayer/session_model.h"
|
|
#include <cstdint>
|
|
#include <map>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace dingosdk::multiplayer {
|
|
// Parses a dedicated server's game tags (Server/steam_server.cpp) into a
|
|
// browser row. Empty when the tags are not a compatible ReSkate server.
|
|
std::optional<MultiplayerLobby> read_server_tags(std::string_view tags, std::uint64_t steam_id);
|
|
|
|
// Dedicated ReSkate servers from Steam's server list for Skate. Rows come from
|
|
// Steam's master list, so a server shows even when a NAT hides its query port;
|
|
// what a server answers directly (name, ping) replaces the tag copy.
|
|
// Not shown: a server the ReSkate team has blocked, and, while the team requires login
|
|
// tokens (developer_identity.h), one that signed in to Steam without one, unless it is on
|
|
// the player's own network.
|
|
// Steam answers a search made soon after another with an empty internet list (seen
|
|
// 2026-10-06: every refresh within about 40 s of a full one). A search that lists no
|
|
// internet server therefore keeps the servers the last one found, for a while.
|
|
class SteamServerBrowser {
|
|
public:
|
|
~SteamServerBrowser();
|
|
void refresh(std::uint64_t now);
|
|
void tick(std::uint64_t now);
|
|
bool searching() const { return !searches_.empty(); }
|
|
const std::vector<MultiplayerLobby> &rows() const { return rows_; }
|
|
const MultiplayerLobby *find(std::uint64_t id) const;
|
|
|
|
private:
|
|
struct Search {
|
|
void *request{}, *response{};
|
|
bool internet{};
|
|
};
|
|
struct Found {
|
|
MultiplayerLobby row;
|
|
// Every address it was listed at: its public one, and a LAN one nearby.
|
|
std::vector<std::pair<std::uint32_t, std::uint16_t>> addresses;
|
|
bool answered{};
|
|
std::uint64_t search{}, listed{}; // the search that last listed it, and when
|
|
bool lan{}; // answered on the player's own network
|
|
};
|
|
void *servers_{};
|
|
std::vector<Search> searches_; // the internet and LAN lists
|
|
std::map<std::uint64_t, Found> found_;
|
|
std::uint64_t started_{}, next_poll_{};
|
|
std::uint64_t search_{}; // counts refreshes
|
|
bool internet_listed_{}; // this search's internet list had a server in it
|
|
std::vector<MultiplayerLobby> rows_;
|
|
void release();
|
|
void read(std::uint64_t now);
|
|
};
|
|
} // namespace dingosdk::multiplayer
|