Skip to content

SessionHostOptions beta ​

Interface of @v12-engine/engine

ts
export interface SessionHostOptions

What a SessionHost is made with: its send rate, catching-up limit, watchdog and error callbacks and whether it owns its world

Members ​

bytesByKey ​

ts
bytesByKey?: boolean;

Whether takeTiming says what the characters sent were spent on, field by field (HostTiming.keys): what a measure of the wire asks for (net.bench.ts), at the cost of writing each field again. No when left out

dropSilentAfter ​

ts
dropSilentAfter?: number;

Seconds of the game a player may go without saying it got what it was sent, before its seat is closed: what is kept for it to send again (the events it has not said it got) would grow for as long as it says nothing. 15 when left out; Infinity never closes one

groundPart ​

ts
groundPart?: number;

Characters of the ground in one message, for a player who does not have the map and asks for it a part at a time: well under what a connection holds. 262144 when left out

keptBytes ​

ts
keptBytes?: number;

Bytes of the frames kept for each player, at most, summed (what each takes as the wire writes it): a player who says nothing while a thousand units fight is sent everything again sooner than keptFrames would. 8 MB when left out

keptEvents ​

ts
keptEvents?: number;

Ticks of events kept for a player who has not said they got them, at most: past that the oldest that already went are let go, not sent again. They are there already over a transport that loses nothing (a worker, a WebSocket), so this bounds only a player who goes on hearing but has stopped answering (a page frozen in the background). 600 when left out

keptFrames ​

ts
keptFrames?: number;

Frames kept for each player to make a delta against, at most: a player who says nothing for longer is sent everything again, once, and nothing more until it answers (or its answer is overdue); an answer to a frame let go still says the player is there. 64 when left out (more than a second and a half of ticks)

maxTicksPerUpdate ​

ts
maxTicksPerUpdate?: number;

Ticks one update catches up at most. A host that fell further behind (a stall, a machine too slow for the game) lets the rest go, and the game runs slower for a moment, rather than spiralling. 8 when left out

onError ​

ts
onError?: (error: unknown) => void;

Told when stepping the world threw, running by the clock (start): the host has stopped by then, and what becomes of the game is whoever runs it's to say. Said in the world's log, and nothing more, when left out. An error is never a reason for the process to go

onSlowTick ​

ts
onSlowTick?: (milliseconds: number, tick: number) => void;

Told of a tick that took longer than a tick lasts, with how many milliseconds: the watchdog

ownsWorld ​

ts
ownsWorld?: boolean;

The world is the host's, and goes with it (dispose): for a server's game, or a game run in the page behind a wire. Not for a world the page plays itself and only lets others watch (recordGame, shareGame). No when left out

sendRate ​

ts
sendRate?: number;

Snapshots a second sent to each player, at most: the simulation runs at its tick rate all the same. 20 when left out