Interface: Simulation<Input, Sim>
Defined in: lockstep.ts:112
A deterministic game: how to start it from a seed and how to advance it by one turn. Clients run it live with LockstepClient; runReplay runs it over a recording.
Extended by
Type Parameters
| Type Parameter |
|---|
Input |
Sim |
Methods
create()
ts
create(seed): Sim;Defined in: lockstep.ts:114
Build the simulation at turn 0. Everything random must come from seed.
Parameters
| Parameter | Type |
|---|---|
seed | number |
Returns
Sim
step()
ts
step(
sim,
entries,
turn
): void;Defined in: lockstep.ts:116
Advance by one turn. Must be deterministic: same simulation and entries in, same simulation out.
Parameters
| Parameter | Type |
|---|---|
sim | Sim |
entries | TurnEntry<Input>[] |
turn | number |
Returns
void
save()?
ts
save?(sim): unknown;Defined in: lockstep.ts:122
The simulation as JSON: everything step reads, the random generator's state included. With load, it lets a player who joins or reloads late start from a recent snapshot instead of from turn 1.
Parameters
| Parameter | Type |
|---|---|
sim | Sim |
Returns
unknown
load()?
ts
load?(saved): Sim;Defined in: lockstep.ts:124
The simulation save was given, rebuilt from what it returned.
Parameters
| Parameter | Type |
|---|---|
saved | unknown |
Returns
Sim