Table of Contents

Class CoreWorldHost

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Runs a FishMMO.Core.World on the network tick: the adapter between FishNet and the engine-free simulation. One per FishNet.Managing.NetworkManager and side (server, client), made on first use and stopped with that side's connection.

public sealed class CoreWorldHost
Inheritance
CoreWorldHost
Inherited Members

Remarks

Its systems come from every installed FishMMO.Core.GameModule's side; the host names none. One subscription to FishNet.Managing.Timing.TimeManager.OnTick ticks every Core system, in phase order, instead of each object subscribing for itself. Simulation time is the tick times the tick length, so it is a pure function of the shared clock.

A system that throws is logged and the rest of the tick skipped; the exception does not escape into FishNet's tick, where it would stop every later subscriber.

Properties

Catalog

Every module declared on a loaded assembly (FishMMO.Core.GameModuleAttribute), checked and in dependency order. Read once per process: modules come with assemblies, which do not change while it runs.

public static ModuleCatalog Catalog { get; }

Property Value

ModuleCatalog

Install

Which modules this world installed, and why any stayed out.

public ModuleInstall Install { get; }

Property Value

ModuleInstall

Now

Simulation time of the latest tick, in seconds: the tick times the tick length.

public double Now { get; }

Property Value

double

Scheduler

The systems that tick it.

public SystemScheduler Scheduler { get; }

Property Value

SystemScheduler

Side

The side this world simulates: FishMMO.Core.SimulationSide.Server or FishMMO.Core.SimulationSide.Client.

public SimulationSide Side { get; }

Property Value

SimulationSide

TicksRun

Ticks run since the host started.

public long TicksRun { get; }

Property Value

long

Timings

How long each system took.

public SystemTimings Timings { get; }

Property Value

SystemTimings

World

The simulation.

public World World { get; }

Property Value

World

Methods

Stop()

Stops ticking and forgets the world. Done for you when the server stops.

public void Stop()

TryGet(NetworkManager, SimulationSide, out CoreWorldHost)

The running host for networkManager's side, if there is one.

public static bool TryGet(NetworkManager networkManager, SimulationSide side, out CoreWorldHost host)

Parameters

networkManager NetworkManager
side SimulationSide
host CoreWorldHost

Returns

bool

TryGet(NetworkManager, out CoreWorldHost)

The running server host for networkManager, if there is one.

public static bool TryGet(NetworkManager networkManager, out CoreWorldHost host)

Parameters

networkManager NetworkManager
host CoreWorldHost

Returns

bool

TryGetOrStart(NetworkManager, SimulationSide, out CoreWorldHost)

The host for networkManager's side, started now if it is not yet running. False when that side is not running.

public static bool TryGetOrStart(NetworkManager networkManager, SimulationSide side, out CoreWorldHost host)

Parameters

networkManager NetworkManager
side SimulationSide
host CoreWorldHost

Returns

bool

TryGetOrStart(NetworkManager, out CoreWorldHost)

The host for networkManager's server, started now if it is not yet running. False when that server is not running.

public static bool TryGetOrStart(NetworkManager networkManager, out CoreWorldHost host)

Parameters

networkManager NetworkManager
host CoreWorldHost

Returns

bool