@hastearcade/snowglobe
Version:
A TypeScript port of CrystalOrb, a high-level Rust game networking library
28 lines • 1.6 kB
TypeScript
import { type Command, CommandBuffer } from './command';
import { type FixedTimestepper } from './fixed_timestepper';
import * as Timestamp from './timestamp';
import { type Snapshot, type World } from './world';
import { type DisplayState } from './display_state';
export declare enum InitializationType {
PreInitialized = 0,
NeedsInitialization = 1
}
export declare class Simulation<$Command extends Command, $Snapshot extends Snapshot, $DisplayState extends DisplayState> implements FixedTimestepper {
private readonly world;
private commandBuffer;
hasInitialized: boolean;
constructor(world: World<$Command, $Snapshot, $DisplayState>, initializationType?: InitializationType);
step(endingTimestamp?: Timestamp.Timestamp): void;
getWorld(): World<$Command, $Snapshot, $DisplayState>;
simulatingTimestamp(): Timestamp.Timestamp;
scheduleCommand(command: Timestamp.Timestamped<$Command>): void;
tryCompletingSimulationsUpTo(targetCompletedTimestamp: Timestamp.Timestamp, maxSteps: number): void;
applyCompletedSnapshot(completedSnapshot: Timestamp.Timestamped<$Snapshot>, rewoundCommandBuffer: CommandBuffer<$Command>): void;
lastCompletedSnapshot(): Timestamp.Timestamped<$Snapshot>;
lastCompletedTimestamp(): Timestamp.Timestamp;
resetLastCompletedTimestamp(timestamp: Timestamp.Timestamp): void;
displayState(): Timestamp.Timestamped<$DisplayState> | undefined;
bufferedCommands(): IterableIterator<[Timestamp.Timestamp, Timestamp.Timestamped<$Command>[]]>;
postUpdate(): void;
}
//# sourceMappingURL=simulation.d.ts.map