Core · interface
TickTraceLike
What a fixed-step simulation produced, tick by tick.
Explained in The loop.
interface TickTraceLikeimport type { TickTraceLike } from '@driftengine/core';In depth
Replaying a recorded run means re-running the simulation, which is far too expensive to do inside a frame and cannot be seeked into at all — an intent stream has no keyframes, so reaching tick 4,000 means running the four thousand before it. Running it once, up front, and keeping what each tick produced turns a replay from a simulation into a lookup.
A flat Float32Array of channels values per tick, plus one byte of flags for
the booleans that would otherwise cost four bytes each. Preallocate with
capacity when the length is known — a caller replaying a recording always
knows it — and nothing reallocates while the simulation is running.
Properties
| Name | Type | Description |
|---|---|---|
lengthreadonly | number | |
channelsreadonly | number |
Methods
sample
sample(tick: number, out: Float32Array): void| Parameter | Type | Description |
|---|---|---|
tick | number | |
out | Float32Array |
flagsAt
flagsAt(tick: number): number| Parameter | Type | Description |
|---|---|---|
tick | number |
channelAt
channelAt(tick: number, channel: number): number| Parameter | Type | Description |
|---|---|---|
tick | number | |
channel | number |
tickAtOrBefore
tickAtOrBefore(channel: number, value: number): number| Parameter | Type | Description |
|---|---|---|
channel | number | |
value | number |