Server Browser and Administration
The module PulseOnlineServer has two parts:
- Server browser (
UPulseOnlineServerBrowserSubsystem, clients): server lists with filters and sorting, favourites, the history of played servers and joining servers with a password. - Server administration (
UPulseOnlineServerSubsystem, servers): start parameters, access checks (bans, whitelist, password), admin commands, server messages and a heartbeat.
Server browser
FPulseOnlineServerBrowserQuery Query;
Query.bDedicatedServers = true; // false: player hosted lobbies
Query.GameMode = TEXT("Survival"); // filtered by the online service
Query.bHideFull = true;
Query.SortBy = EPulseOnlineServerSort::Ping;
Browser->RefreshServerList(PlayerController, Query); // OnServerListChanged when the list arrived
GetServers() returns the visible entries (FPulseOnlineServerEntry: name, game mode, map, region, players, ping, password flag, favourite, recently played). ApplyQuery filters and sorts the cached list again without a new search (for filter widgets). Servers whose heartbeat is older than Stale Server Seconds are hidden.
| Query field | Meaning |
|---|---|
bDedicatedServers | Dedicated server sessions (true) or player hosted lobbies (false). |
NameContains, GameMode, MapName, Region | Filters; game mode also on the online service. |
bHideFull, bHideEmpty, bHidePassworded, bFavouritesOnly, MaxPingMs | More filters (unknown pings are kept). |
SortBy, bDescending, bFavouritesFirst | Order: ping (unknown last), players, name, free slots. |
Joining: JoinServer(Player, Entry, Password) joins and travels; the password is sent as URL option ?PulsePassword=.... JoinBookmark(Player, Bookmark, Password) first searches a favourite or a history entry by its id (the session key), then joins it.
Favourites and history: AddFavourite, RemoveFavourite, IsFavourite, GetFavourites; every joined game session (not hosted) is added to the history (History Size entries, GetHistory, ClearHistory). Both are kept in the save game slot PulseOnlineServerBrowser. Favourites of dedicated servers survive server restarts when the server has a stable id (start parameter PulseServerId, see below); otherwise the session key changes with every start.
Start parameters
Dedicated servers are configured with command line parameters -Name=Value. Pulse Online keeps a registry of them, so a server can list what it understands (console command Pulse.Online.Server.Parameters; dedicated servers log the list at start, secrets masked).
| Parameter | Meaning |
|---|---|
-PulseServerName= | Name in the browser (default: the session owner). |
-PulseServerPassword= | Password players need; secret. |
-PulseServerId= | Stable id, used as session key so favourites find the server again. |
-PulseMOTD= | Message of the day, shown to players when they join. |
-PulseAdmins= | Admin net ids, separated by commas. |
-PulseRegion= | Region (browser filter; matchmaking uses it too). |
-PulseQueue= | Matchmaking queue the server serves (Matchmaking). |
Games register their own (Pulse::Online::Server::RegisterParameter) and read values with Pulse::Online::Server::GetParameterValue(Name): the command line wins, then Parameter Values in the settings, then the default of the parameter. Keep secrets on the command line, not in config files.
For the advertisement before the session exists (and the stable id as session key) add UPulseOnlineServerSubsystem::AddServerAdvertisement(HostRequest) to the host request of the server. After that the heartbeat (Heartbeat Interval Seconds) refreshes name, password flag, region and heartbeat time in the session settings (PULSE_SERVER_*; declare them in the OSSv2 attribute schema, add-on PulseOnlineOSSv2). OnHeartbeatNative fires after each heartbeat, e.g. to report the server to an own backend.
Access checks
On every login of a server with administration (Enable Server Administration, listen and dedicated servers):
- Bans and the whitelist are checked in
PreLoginautomatically (game mode event, no game code needed). While bans or the whitelist are in use, players without a valid net id are refused (Refuse Invalid Net Ids, on by default); otherwise such a player would pass both. - The password needs the URL options of the login: use
APulseOnlineGameSessionas Game Session Class of the game mode, or callUPulseOnlineServerSubsystem::ApproveLogin(Options, UniqueId)from your own game session’sApproveLogin. Admins join without password only whenApproveLogingets their net id (your own game mode’sPreLoginpasses theUniqueId); the engine gives a game session’sApproveLoginno id, so withAPulseOnlineGameSessionadmins need the password too. Without a net idApproveLoginchecks only the password.
Bans, the whitelist and admins added at runtime are kept in Saved/<Access File> (JSON) on the server. Admins from the settings (Admin Ids) and -PulseAdmins= are added to them; the host of a listen server is always an admin.
Trust: net ids come from the client: it reports its id at login, and Pulse Online does not verify it. Only the connection auth of the online service (the auth handler of a Steam or EOS backend) makes them trustworthy. Without it (OSS Null, LAN) a modified client can claim any id, so admins, bans and the whitelist are a convenience, not a security boundary. A dedicated server logs a warning at start when admins, bans or the whitelist are set up.
An anti-cheat service (IPulseOnlineAntiCheatService) is asked in PreLogin as well, before the bans; it registers every remote player after the login and unregisters it on logout (Anti-Cheat).
Admin commands
The server adds a replicated UPulseOnlineServerPlayerComponent to every player controller. It carries the server name and the message of the day, delivers server messages, sends admin commands of the player to the server and carries the messages of the anti-cheat (two reliable RPCs, at most 1 KiB each).
| Command | What it does |
|---|---|
players | Lists players with index, net id, ping and admin flag. |
status | Name, players, password, region, bans, whitelist. |
kick <player> [reason] | Kicks; the client does not rejoin. |
ban <player\|id> [minutes] [reason] | Bans (0 or no minutes: permanent) and kicks. |
unban <id>, bans | Lifts a ban, lists bans. |
whitelist on\|off\|add <player\|id>\|remove <id>\|list | Whitelist. |
admin add <player\|id>\|remove <id>\|list | Admins added at runtime. |
say <text> | Message to all players. |
motd <text> | New message of the day for players who join from now on. |
A player is a name (or its start), a net id, or #index from players. Commands run
- on the server:
ExecuteAdminCommand(Command)or the console commandPulse.Online.Server.Admin <command>, - from an admin client:
UPulseOnlineServerPlayerComponent::RunAdminCommand(Command)(or the cheatPulseOnlineAdmin); the answer arrives as server message and as the answer of a request (kindPulse.Request.Online.AdminCommand; C++RequestAdminCommand(Command, Callback)): a success with the text of the command as message, orAuthoritywhen the player is no admin, which also reaches the client asPulse.Message.Request.Failed.CheckAdminCommand(Player)says whether a player may run commands here.
From C++ also KickPlayer, BanPlayer, UnbanPlayer, BroadcastServerMessage.
Server messages
Clients receive messages (FPulseOnlineServerMessage: text, sender, type Info, Warning, Admin, Motd, CommandResult, Kicked) through UPulseOnlineServerSubsystem::OnServerMessage and the message Pulse.Message.Online.Server.Message. GetReceivedMessages keeps the last 50. The message of the day arrives once after joining. A kicked player gets the reason as Kicked message right before the connection closes.
Testing
- Specs:
PulseOnline.Server(filters, sorting, bans, commands, parameters, Mock browser and access checks, anti-cheat). - Cheats:
PulseOnlineServers,PulseOnlineJoinServer,PulseOnlineFavourite,PulseOnlineAdmin(see Debugging). - PIE with the Mock backend (listen server + client): host with
PulseOnlineMatchmakeon the server, then on the clientPulseOnlineServers Lobbies,PulseOnlineFavourite 0,PulseOnlineJoinServer 0; on the serverPulseOnlineAdmin say HelloandPulseOnlineAdmin kick #1.