Vixen
dd8b0a81
csharp
public sealed class RealmHost

A shard, as the process carrying it sees itself.

Read the guide page for this →

Remarks

A realm is a normal Vixen application ([doc 17](../../docs/plan/17-app-heads-and-shipping.md) Model B) built with BuildVariant.Server: headless host, Vixen.Graphics.Null, server content profile. What this adds is everything doc 27 § The realm lists — the spec it booted from, the door, the map's lifetime, the heartbeat, and the one place a control plane is ever called.

⚠ Update is the realm's PreUpdate and runs before the game's own step. The order inside it is load-bearing: answers from the control plane are applied first, so a frame sees a consistent view of decisions taken since the last one; signals are read next, because a drain that arrived should stop admitting before the session is polled; and health is sampled last, over a tick that has actually happened.

⚠ It does not own the game. Replication, RPC, interest and the world belong to the realm's own Session and its systems. This class knows about players only insofar as admission and drain readiness need it to.

Fields and properties (11)

  • public RealmSpec Spec

    What this shard was told to be.

  • public ShardState State

    Where it is in its life.

  • public NetworkSession Session

    The session players connect to.

  • public PlayerAdmission Admission

    The door.

  • public MapLifetime Map

    The map.

  • public RealmDirectory Directory

    The one place a control plane is called.

  • public RealmHeartbeat Heartbeat

    The health sampler.

  • public NetworkMetrics Metrics

    What this shard reports about its link, published where any collector can read it.

  • public RealmTransfers Transfers

    Every transfer this realm is part of, leaving and arriving.

  • public int Population

    How many players are on this shard.

  • public Func<RealmPlayer, TransferReadiness> Readiness

    Decides whether a player can be moved right now. Doc 27 § Drain.

Events (5)

  • public Action<RealmHealth>? Sampled

    Raised every time health is sampled.

  • public Action<ShardState>? StateChanged

    Raised when the shard moves through ShardState.

  • public Action<RealmPlayer>? PlayerAdmitted

    Raised when a ticketed player finishes joining.

  • public Action<RealmPlayer>? PlayerReleased

    Raised when a player leaves, for any reason.

  • public Action<SourceTransfer>? Finished

    A transfer ended, committed or aborted.

Methods (8)

  • public RealmHost(RealmSpec spec, Func<PlayerAdmission, NetworkSession> session, TransferTicketSigner? signer = null, RealmHostOptions? options = null)

    Stands a realm up.

  • public void Start()

    Starts listening. The shard is Starting until its map is up.

  • public void Signal(string line)

    Hands the realm a line from its launcher.

  • public int Update(TimeSpan elapsed, SceneManager? scenes = null, ISessionMessageHandler? messages = null)

    One realm update, before the game's own.

  • public void Drain()

    Stops taking arrivals and starts moving people out.

  • public void Stop()

    Ends the shard.

  • public void Dispose()

    Releases what the realm owns.

  • public static TransferTicketSigner DevelopmentSigner(RealmSpec spec)

    A cluster key derived from the shard's own spec, for a realm nobody handed one to.

Used by (10)

  • AdmissionUnderLossTestsVixen.Live.Realm.Tests
  • RealmVixen.Live.Realm
  • RealmVixen.Live.Realm.Tests
  • RealmAppVixen.Live.Realm
  • RealmClusterVixen.Live.Realm.Cluster
  • RealmClusterTestsVixen.Live.Realm.Cluster.Tests
  • RealmFixtureVixen.Live.Realm.Tests
  • RealmHostTestsVixen.Live.Realm.Tests
  • RealmMetricsTestsVixen.Live.Realm.Tests
  • TransferFleetVixen.Live.Realm.Tests