Class CrossplayServer
A dedicated server started with -crossplay (Crossplay). It uses the game's PlayFab
backend: it logs in to PlayFab after it starts, then registers a lobby that clients join by the server's PlayFab
entity id, not by address. The lobby is keyed by the server's public IP and game port, so two crossplay servers behind
one public IP must use different game ports (-port), or the second takes over the first one's joins.
public static class CrossplayServer
- Inheritance
-
objectCrossplayServer
Fields
LobbyCreated
The server's lobby line, as the game logs it in 1.0.16 once the lobby exists:
Created PlayFab lobby with ID "...", ConnectionString "..." and owned by "<remote player id>".
public static readonly Regex LobbyCreated
Field Value
- Regex
LobbyDeactivated
The game's line when PlayFab confirms that a lobby is marked inactive (1.0.16, ZPlayFabMatchmaking.DeleteLobby):
Deactivated PlayFab lobby <lobby id>. It is logged from PlayFab's reply, which a dedicated server quitting
on Ctrl+C or SIGINT does not wait for: on the 1.0.16 Windows server the process ended about two seconds after the
request, before the reply, so the line is recorded when present but not required.
public static readonly Regex LobbyDeactivated
Field Value
- Regex
LobbyFailures
Lines after which no lobby will come: the server's PlayFab login failed, or the game's crossplay libraries did not load.
public static readonly IReadOnlyList<Regex> LobbyFailures
Field Value
- IReadOnlyList<Regex>
ServerUnregistered
The game's line when its shutdown retires its lobby: it asks PlayFab to mark the lobby inactive and leaves the
network (Unregister PlayFab server "<name>" and leaving network "...").
public static readonly Regex ServerUnregistered
Field Value
- Regex
Methods
BepInExLog(string)
The copied runtime's BepInEx log, which holds the game's own log lines when BepInEx listens to Unity's log (its default).
public static string BepInExLog(string runtimeDirectory)
Parameters
runtimeDirectorystring
Returns
- string
HostBepInExLog(string)
A Linux host runtime's BepInEx log, as a path on that host.
public static string HostBepInExLog(string hostRuntimeDirectory)
Parameters
hostRuntimeDirectorystring
Returns
- string
RequireLobbiesRetired(IReadOnlyList<ProcessStop>, IReadOnlyList<IReadOnlyList<string>>)
After a crossplay run's owned server boots have stopped: requires that every boot quit cleanly
(Clean, or had exited by itself through the game's shutdown), that its logs show the lobby it
created (LobbyCreated), and that its shutdown retired it (ServerUnregistered). A killed server
skips its shutdown, so its lobby stays active for hours and PlayFab can send later joins on the same address and port
to it: a run with one proves nothing about the next run's join and fails here. Logs without any lobby line fail too,
because they cannot show a retirement (pass the log the game writes to: the -logFile file, or BepInEx's log when
it copies Unity's lines). bootLogs holds each boot's kept logs, in launch order as stops;
a missing file is skipped. Returns one line per boot for the report, saying whether PlayFab's confirmation was logged.
Whether the lobby really stopped taking joins is shown by the next run's join on the same address and port.
public static IReadOnlyList<string> RequireLobbiesRetired(IReadOnlyList<ProcessStop> stops, IReadOnlyList<IReadOnlyList<string>> bootLogs)
Parameters
stopsIReadOnlyList<ProcessStop>bootLogsIReadOnlyList<IReadOnlyList<string>>
Returns
- IReadOnlyList<string>
WaitForLobby(GameActor, string, TimeSpan, CancellationToken)
Waits until the crossplay server's lobby exists and returns its remote player id. First requires the server's
cli_multiplayer_identity to say it is a server on the PlayFab backend (so a plan without crossplay fails at
once), then waits on the event: the lobby line in serverLog, this boot's log read from its start
(BepInExLog(string), or the Unity log the plan's -logFile names). When the identity carries the PlayFab
entity id, it must be the lobby's owner. Read-only: nothing is sent to the game but the identity query.
public static CrossplayLobby WaitForLobby(GameActor server, string serverLog, TimeSpan timeout, CancellationToken cancellation = default)
Parameters
serverGameActorserverLogstringtimeoutTimeSpancancellationCancellationToken