Skip to content

1681-engine / index / FixedLoopOptions

Interface: FixedLoopOptions ​

Defined in: src/engine/FixedLoop.ts:10

A fixed-timestep accumulator: frames arrive whenever the display wants them, the simulation advances in equal steps. Movement and anything a server replays must run here, so every machine takes the same steps whatever its frame rate.

A frame that comes very late (a tab in the background, a debugger) would owe hundreds of steps; at most maxStepsPerFrame are run and the rest of the debt is dropped, so the game slows down instead of freezing while it catches up (the "spiral of death").

Properties ​

hz? ​

ts
optional hz?: number;

Defined in: src/engine/FixedLoop.ts:12

Steps per second (default 60).


maxStepsPerFrame? ​

ts
optional maxStepsPerFrame?: number;

Defined in: src/engine/FixedLoop.ts:14

The most steps one frame may run before the debt is dropped (default 8).

Released under the MIT License.