Networking · class
PredictingClient
A machine that predicts its own player and corrects toward the authority.
Explained in Networking and rollback.
class PredictingClient<S>import { PredictingClient } from '@driftengine/network';Constructor
new
constructor(options: ClientOptions<S>)| Parameter | Type | Description |
|---|---|---|
options | ClientOptions<S> |
Properties
| Name | Type | Description |
|---|---|---|
selfreadonly | PeerId |
Accessors
| Name | Type | Description |
|---|---|---|
correctionsget | number | How many authoritative states have been applied. Each one is a rewind. |
Methods
submit
submit(tick: number, payload: Uint8Array): voidSend this input and, when predicting, apply it locally on the same tick.
| Parameter | Type | Description |
|---|---|---|
tick | number | |
payload | Uint8Array |
More
No input delay, unlike lockstep. A delay there buys exactness for everybody; here the authority is the source of truth anyway, so delaying the local input would add latency to the player's own controls and buy nothing.
poll
poll(): voidadvance
advance(dt: number, tick: number): void| Parameter | Type | Description |
|---|---|---|
dt | number | |
tick | number |