Vixen
02b45cc4
csharp
public sealed class PlayerSessions

The player processes the editor has launched.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Doc 11's second play topology, and networking is what requires it. Testing a server-authoritative game needs a server and several clients, and none of that can happen inside one editor process. It doubles as the way to check release-configuration behaviour and to isolate a game that hangs, which is why a hung player is killed rather than waited for.

The incremental cost is process launch and a panel. The remote inspector already exists (doc 13), so what is here is the launching, the bookkeeping and the ports — deliberately not a second inspector.

⚠ Ports are assigned by the set, not by each launch. Two clients that both took the inspector's default port would mean the second one silently not being attachable, which presents as "the remote inspector does not work with more than one client" and is very hard to see.

Fields and properties (3)

  • public int FirstInspectorPort

    The first port handed out; each session takes the next one.

  • public IReadOnlyList<PlayerSession> Sessions

    What is running, in the order it was launched.

  • public int RunningCount

    How many are still alive.

Events (1)

  • public Action<PlayerSessions>? Changed

    Raised when a session is launched or ends.

Methods (6)

  • public static IReadOnlyList<string> ArgumentsFor(PlayerLaunch launch, int port)

    How this launch should be spelled out on a command line.

  • public PlayerSession Launch(PlayerLaunch launch)

    Starts a player.

  • public IReadOnlyList<PlayerSession> LaunchNetworked(string executable, int clients = 1, string? workingDirectory = null)

    Starts a server and some clients against it.

  • public void StopAll()

    Stops everything.

  • public int Prune()

    Forgets the sessions that have ended.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (1)

  • SceneTestsVixen.Editor.SceneView.Tests