Table of Contents

Class ServerLoop

Namespace
Shard.Server
Assembly
Shard.Server.dll

The server tick loop - a world-agnostic C# analogue of the Java TickingThread. Runs on a dedicated thread at TicksPerSecond with a measured variable delta and no tick catch-up (a long tick just yields a larger next delta), spinning/sleeping to the next deadline.

It is also an executor: Post(Action) queues work that runs on the tick thread, drained before and after each tick (the handoff point for the network layer). Each tick publishes a ServerTickEvent so modules can run per-tick logic.

(Per-World loops will follow this same shape once worlds land.)

public sealed class ServerLoop
Inheritance
ServerLoop
Inherited Members

Constructors

ServerLoop(EventBus)

public ServerLoop(EventBus events)

Parameters

events EventBus

Fields

TicksPerSecond

public const int TicksPerSecond = 30

Field Value

int

Properties

CurrentTick

public long CurrentTick { get; }

Property Value

long

IsOnTickThread

True when called from the tick thread.

public bool IsOnTickThread { get; }

Property Value

bool

Methods

Post(Action)

Queue work to run on the tick thread (drained twice per tick).

public void Post(Action action)

Parameters

action Action

Start()

public void Start()

Stop()

public void Stop()