public abstract class RealmWhat a game's realm derives from. A Game that is a shard.
Remarks
A realm is doc 17's Model B application built as a dedicated server, so it is a Game and everything a game can do it can do. What this base class adds is the six boot decisions that make it a shard, and it takes over exactly four of Game's hooks to do it — OnConfigure, OnInitialise, OnUpdate and OnShutdown are sealed here, and the realm-shaped versions of all four are offered in their place.
⚠ The map is AppConfig.StartupScene, not a loader of its own. OnConfigure points the host at RealmSpec.Key.Map and lets the host do what it already does — including surviving a map that will not open, which leaves a shard that never reports ready rather than one that admits players into an empty world.
⚠ The transport binds to every interface; the endpoint is what clients are told. A spec's host is a node's external address or a relay's name, and is frequently not an address this process can bind. Overriding CreateTransport is the seam for a realm that needs something else — a relay allocation, a composite that accepts both (M-Q1) — and it is a placement decision rather than an architecture change precisely because nothing above the transport knows the difference.
Fields and properties (3)
public RealmSpec SpecWhat this shard was told to be.
public RealmHost HostThe shard's own machinery: admission, map, heartbeat, directory.
protected virtual ISessionMessageHandler? MessagesWhere the session's user payloads go, or null to drop them.
Methods (16)
public void Bind(RealmSpec realmSpec)Hands this realm its spec, before the application is built.
protected virtual void OnRealmInitialise()Runs once, after the shard exists and before the first frame.
protected virtual void OnRealmUpdate(GameTime time)Runs once per frame, after the shard's own update.
protected virtual void OnRealmShutdown()Runs once, before the shard is torn down.
protected virtual void OnPlayerAdmitted(RealmPlayer player)Runs when a ticketed player finishes joining.
protected virtual void OnPlayerReleased(RealmPlayer player)Runs when a player leaves, for any reason.
protected virtual TransferReadiness ReadinessOf(RealmPlayer player)Decides whether a player can be moved to another shard right now.
protected virtual ITransport CreateTransport(RealmEndpoint endpoint)Opens the transport clients connect over.
protected virtual SessionOptions CreateSessionOptions()The session's settings.
protected virtual TransferTicketSigner? CreateSigner()The cluster key, or null for DevelopmentSigner.
protected virtual RealmHostOptions CreateHostOptions()What the host is allowed to differ in.
protected override sealed void OnConfigure(AppConfig config)Decides what to build, before anything is built.
protected virtual void OnRealmConfigure(AppConfig config)Adjusts the host's configuration, after the realm's own decisions.
protected override sealed void OnInitialise()Runs once, after the platform, window and services exist.
protected override sealed void OnUpdate(GameTime time)Runs once per frame, before OnRender.
protected override sealed void OnShutdown()Runs once, before the services are torn down.
Used by (1)
- RealmAppVixen.Live.Realm