Networking · class

AuthorityHost

The machine whose world is the truth.

Explained in Networking and rollback.

class AuthorityHost<S>
import { AuthorityHost } from '@driftengine/network';

Constructor

new

constructor(options: AuthorityOptions<S>)
ParameterTypeDescription
optionsAuthorityOptions<S>

Accessors

NameTypeDescription
publishedStatesgetnumberHow many state messages have gone out. For a consumer measuring what replication costs.

Methods

poll

poll(): void

advance

advance(dt: number, tick: number): void

Take a tick, then publish if this is a publishing tick.

ParameterTypeDescription
dtnumber
ticknumber
More

The state is encoded after the step, so it describes the world at the end of tick, and a client applying it reconciles at tick + 1. Publishing before the step would send the world as it was when the tick began, which is the state the client already had.