@series-inc/rundot-syncplay 5.25.0-beta.8 → 5.26.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -17
- package/core/authoring.d.ts +30 -0
- package/core/deterministic-stdlib.d.ts +127 -0
- package/core/index.d.ts +390 -0
- package/core/native/component_runtime.cpp +341 -0
- package/core/native/component_runtime.hpp +112 -0
- package/core/native/deterministic_math.cpp +594 -0
- package/core/native/deterministic_math.hpp +21 -0
- package/core/native/kinetix-native-main.cpp +707 -0
- package/core/native/kinetix-native-runtime.cpp +20 -0
- package/core/native/kinetix-native-runtime.hpp +25 -0
- package/core/native/kinetix-render-projection.cpp +20 -0
- package/core/native/kinetix-render-projection.hpp +14 -0
- package/core/native/physics/abi.cpp +205 -0
- package/core/native/physics/abi.hpp +128 -0
- package/core/native/physics/physics.cpp +4821 -0
- package/core/native/physics/physics.hpp +222 -0
- package/core/physics.d.ts +372 -0
- package/core/runtime.d.ts +471 -0
- package/core/scripts/build-native.mjs +113 -0
- package/core/scripts/build-wasm-physics.mjs +172 -0
- package/core/scripts/emit-product-digests.mjs +58 -0
- package/core/scripts/generate-platformer2d-manifest.mjs +82 -0
- package/core/scripts/preflight.mjs +76 -0
- package/core/scripts/run-box3d-benchmark.mjs +452 -0
- package/core/src/index.mjs +128 -0
- package/core/src/kinetix-authoring.mjs +69 -0
- package/core/src/kinetix-auxiliary-assets.mjs +43 -0
- package/core/src/kinetix-baker.mjs +618 -0
- package/core/src/kinetix-deterministic-math.mjs +1044 -0
- package/core/src/kinetix-deterministic-stdlib.mjs +669 -0
- package/core/src/kinetix-legacy-profile-contracts.mjs +69 -0
- package/core/src/kinetix-native-product.mjs +36 -0
- package/core/src/kinetix-platformer2d-errors.mjs +25 -0
- package/core/src/kinetix-platformer2d-level.mjs +323 -0
- package/core/src/kinetix-platformer2d-mechanics.mjs +616 -0
- package/core/src/kinetix-platformer2d-registry.mjs +154 -0
- package/core/src/kinetix-platformer2d-runtime.mjs +1266 -0
- package/core/src/kinetix-platformer2d-source-manifest.generated.mjs +16 -0
- package/core/src/kinetix-product-contract.mjs +223 -0
- package/core/src/kinetix-project-compiler.mjs +105 -0
- package/core/src/kinetix-render-projection.mjs +28 -0
- package/core/src/kinetix-runtime-adapter-utils.mjs +270 -0
- package/core/src/kinetix-runtime-contract.mjs +54 -0
- package/core/src/kinetix-runtime-identity.mjs +12 -0
- package/core/src/kinetix-session-config.mjs +181 -0
- package/core/src/kinetix-source-snapshot.mjs +60 -0
- package/core/src/kinetix-world-kernel.mjs +580 -0
- package/core/src/kinetix-world-runtime.mjs +178 -0
- package/core/src/physics/index.mjs +3187 -0
- package/core/src/physics/mass-properties.mjs +472 -0
- package/core/src/physics/physics-wasm-module.generated.mjs +16 -0
- package/core/src/runtime.mjs +59 -0
- package/core/src/shared/f64-bits.mjs +14 -0
- package/core/src/shared/kinetix-envelope-v1.mjs +589 -0
- package/core/src/shared/render-records-v1.mjs +168 -0
- package/core/src/shared/sha256.mjs +73 -0
- package/dist/authority-room.d.ts +1 -1
- package/dist/authority-room.js +1 -1
- package/dist/dev-authority-room.js +1 -1
- package/dist/match-log.d.ts +1 -1
- package/dist/networked-client.d.ts +6 -5
- package/dist/networked-client.js +1 -0
- package/dist/platformer-content.js +1 -1
- package/dist/r3f-render-adapter.js +1 -1
- package/dist/replay.d.ts +1 -1
- package/dist/replay.js +1 -1
- package/dist/runner.d.ts +2 -1
- package/dist/runner.js +2 -0
- package/dist/runtime-session.d.ts +15 -8
- package/dist/runtime-session.js +12 -1
- package/dist/sdk-session.js +1 -0
- package/dist/session-snapshot.d.ts +1 -1
- package/dist/session-wire.d.ts +1 -1
- package/dist/session-wire.js +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +52 -7
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# RUN Syncplay
|
|
2
2
|
|
|
3
|
-
Syncplay is the orchestration layer over a signed
|
|
4
|
-
deterministic
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Syncplay is the orchestration layer over a signed deterministic runtime. The
|
|
4
|
+
deterministic core ships inside this package under the `/core` subpaths
|
|
5
|
+
(`@series-inc/rundot-syncplay/core/...`): it owns deterministic state, RNG
|
|
6
|
+
streams, stepping, opaque checkpoints, serialization, hydration, and checksums.
|
|
7
|
+
Syncplay owns inputs, prediction, confirmation, rollback policy, replay logs,
|
|
8
|
+
late join, secrets, and transport.
|
|
7
9
|
|
|
8
10
|
> **Upgrading an existing game?** See
|
|
9
11
|
> [MIGRATING-SESSION-PRIMITIVES.md](./MIGRATING-SESSION-PRIMITIVES.md). Two
|
|
@@ -15,9 +17,9 @@ rollback policy, replay logs, late join, secrets, and transport.
|
|
|
15
17
|
| Concern | Owner |
|
|
16
18
|
|---|---|
|
|
17
19
|
| Committed source capture, upload authority, build lifecycle | Pack API + CLI |
|
|
18
|
-
| Compilation, exact product schema, runtime identity |
|
|
20
|
+
| Compilation, exact product schema, runtime identity | core compiler/baker |
|
|
19
21
|
| Artifact immutability, signing, key trust, catalog eligibility | Pack service + KMS/GCS/Firestore |
|
|
20
|
-
| Deterministic state, RNG streams, step, checkpoint bytes, canonical checksum |
|
|
22
|
+
| Deterministic state, RNG streams, step, checkpoint bytes, canonical checksum | core runtime |
|
|
21
23
|
| Inputs, prediction, confirmation, rollback policy, replay log, late join, secrets, transport | Syncplay |
|
|
22
24
|
| Rendering/interpolation/effects | Presentation adapters outside authoritative state |
|
|
23
25
|
|
|
@@ -25,10 +27,12 @@ There is one session factory:
|
|
|
25
27
|
|
|
26
28
|
```ts
|
|
27
29
|
import { createSyncplaySession } from '@series-inc/rundot-syncplay/browser';
|
|
28
|
-
import {
|
|
30
|
+
import { createInstalledPlatformer2dRuntime } from '@series-inc/rundot-syncplay/core/runtime';
|
|
29
31
|
|
|
30
|
-
const runtime =
|
|
31
|
-
|
|
32
|
+
const runtime = createInstalledPlatformer2dRuntime({
|
|
33
|
+
pack,
|
|
34
|
+
levelBytes,
|
|
35
|
+
identity,
|
|
32
36
|
sessionConfigBytes,
|
|
33
37
|
});
|
|
34
38
|
|
|
@@ -37,16 +41,19 @@ const session = createSyncplaySession(runtime, {
|
|
|
37
41
|
defaultInput: { throttle: 0, steer: 0, brake: false },
|
|
38
42
|
snapshotBufferSize: 256,
|
|
39
43
|
checksumIntervalFrames: 30,
|
|
44
|
+
requires: { projection: true },
|
|
40
45
|
});
|
|
41
46
|
```
|
|
42
47
|
|
|
43
|
-
The runtime must implement `@series-inc/rundot-
|
|
48
|
+
The runtime must implement `@series-inc/rundot-syncplay/core/runtime`. Syncplay never
|
|
44
49
|
accepts an initial state, reducer, or creator-authored step callback. There is no
|
|
45
|
-
compatibility mode for the removed reducer API.
|
|
50
|
+
compatibility mode for the removed reducer API. A non-platformer game supplies
|
|
51
|
+
the same ABI through `createInstalledRuntimeAdapter` and binds its source with
|
|
52
|
+
`deriveCustomRuntimeIdentity` plus `kinetixRuntimeModuleManifest`.
|
|
46
53
|
|
|
47
54
|
## Runtime and snapshot contract
|
|
48
55
|
|
|
49
|
-
Live play retains opaque
|
|
56
|
+
Live play retains opaque core checkpoint handles. Rollback restores those
|
|
50
57
|
handles directly; it does not serialize or hydrate them. A v2 promotion or
|
|
51
58
|
late-join snapshot contains one opaque `runtimeBytes` payload plus the signed
|
|
52
59
|
runtime identity, canonical session-config digest, frame, and checksum. The
|
|
@@ -57,6 +64,23 @@ session-config bytes, asks the game for a matching runtime through its runtime
|
|
|
57
64
|
factory, and rejects a locally loaded pack mismatch before frame 0. Replays use
|
|
58
65
|
the same identity/config/factory path.
|
|
59
66
|
|
|
67
|
+
### Capability requirements
|
|
68
|
+
|
|
69
|
+
Session policies and runner configs accept
|
|
70
|
+
`requires?: { commands?: boolean; projection?: boolean }`. Requirements are
|
|
71
|
+
checked when each offline or networked session is constructed, before any frame
|
|
72
|
+
advances:
|
|
73
|
+
|
|
74
|
+
| Requirement | Failure |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `projection: true` without `runtime.project` | `SYNCPLAY_PROJECTION_UNSUPPORTED` |
|
|
77
|
+
| `commands: true` with no capabilities declaration | `SYNCPLAY_RUNTIME_CAPABILITY_UNKNOWN` |
|
|
78
|
+
| `commands: true` with `capabilities.commands !== true` | `SYNCPLAY_RUNTIME_COMMANDS_UNSUPPORTED` |
|
|
79
|
+
|
|
80
|
+
The runner forwards one `requires` policy through both `startOffline()` and
|
|
81
|
+
`startNetworked()`, including reconfigured network sessions. Unknown capability
|
|
82
|
+
metadata never silently passes negotiation.
|
|
83
|
+
|
|
60
84
|
## Presentation frames
|
|
61
85
|
|
|
62
86
|
`session.getState()` returns a detached deep copy of the current frame, which
|
|
@@ -113,7 +137,7 @@ npm run test:core
|
|
|
113
137
|
|
|
114
138
|
The core suite covers checkpoint ownership/release, frame-zero rollback, v2
|
|
115
139
|
snapshot hydration, replay verification, authority persistence, latency/loss
|
|
116
|
-
convergence, late join, spectators, bots, secrets, and a real
|
|
140
|
+
convergence, late join, spectators, bots, secrets, and a real core world
|
|
117
141
|
driven through `createSyncplaySession`.
|
|
118
142
|
|
|
119
143
|
## Unified session runner
|
|
@@ -199,8 +223,8 @@ level length — those are game-specific fields inside `sessionConfigBytes`, and
|
|
|
199
223
|
decode them with your own session-config schema:
|
|
200
224
|
|
|
201
225
|
```ts
|
|
202
|
-
import { decodeKinetixSessionConfig } from '@series-inc/rundot-
|
|
203
|
-
import { kinetixPlatformer2dSessionConfigSchema } from '@series-inc/rundot-
|
|
226
|
+
import { decodeKinetixSessionConfig } from '@series-inc/rundot-syncplay/core/runtime';
|
|
227
|
+
import { kinetixPlatformer2dSessionConfigSchema } from '@series-inc/rundot-syncplay/core/runtime';
|
|
204
228
|
|
|
205
229
|
const prepareNetworkRuntime = async (descriptor, signal) => {
|
|
206
230
|
const session = decodeKinetixSessionConfig(
|
|
@@ -241,8 +265,8 @@ permanently unjoinable. `preparePlatformerLevel(api, declaration)` resolves a pi
|
|
|
241
265
|
and raises the typed `SYNCPLAY_LEVEL_CONTENT_CHANGED` (naming the entry id and the
|
|
242
266
|
edit-vs-pin cause) rather than an opaque `KINETIX_AUX_ASSET_MISMATCH` deep inside
|
|
243
267
|
runtime construction. `declaration.encodeLevel` is an **injected callback**, not a
|
|
244
|
-
static
|
|
245
|
-
|
|
268
|
+
static core import, so Syncplay's compiled output never hard-binds a specific
|
|
269
|
+
core build.
|
|
246
270
|
|
|
247
271
|
**Capacity and late-join budgets.** Snapshot transfer defaults are **256 KiB**
|
|
248
272
|
chunks and a **4 MiB** total ceiling; the immutable level payload is fetched and
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type KinetixInstalledProfileName = 'deterministic-f64' | 'fixed-1000-3d';
|
|
2
|
+
|
|
3
|
+
export type KinetixSessionField =
|
|
4
|
+
| { type: 'string'; maxBytes: number; required?: boolean }
|
|
5
|
+
| { type: 'integer'; min: number; max: number; required?: boolean }
|
|
6
|
+
| { type: 'boolean'; required?: boolean }
|
|
7
|
+
| { type: 'enum'; values: readonly string[]; required?: boolean };
|
|
8
|
+
|
|
9
|
+
export interface KinetixSessionConfigSchema {
|
|
10
|
+
id: string;
|
|
11
|
+
version: number;
|
|
12
|
+
maxBytes: number;
|
|
13
|
+
fields: Readonly<Record<string, KinetixSessionField>>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface KinetixProjectDeclaration {
|
|
17
|
+
id: string;
|
|
18
|
+
installedProfile: KinetixInstalledProfileName;
|
|
19
|
+
tickRate: 10 | 20 | 30 | 60;
|
|
20
|
+
inputSchema: Readonly<Record<string, unknown>>;
|
|
21
|
+
sessionConfigSchema: KinetixSessionConfigSchema;
|
|
22
|
+
mechanics: readonly Readonly<Record<string, unknown>>[];
|
|
23
|
+
components: readonly Readonly<Record<string, unknown>>[];
|
|
24
|
+
systems: readonly Readonly<Record<string, unknown>>[];
|
|
25
|
+
presentationBindings: readonly Readonly<Record<string, unknown>>[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function defineKinetixProject<const Project extends KinetixProjectDeclaration>(
|
|
29
|
+
project: Project,
|
|
30
|
+
): Readonly<Project>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export interface DeterministicVec2 {
|
|
2
|
+
readonly x: number;
|
|
3
|
+
readonly y: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface DeterministicVec3 {
|
|
7
|
+
readonly x: number;
|
|
8
|
+
readonly y: number;
|
|
9
|
+
readonly z: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DeterministicQuaternion extends DeterministicVec3 {
|
|
13
|
+
readonly w: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface DeterministicMathApi {
|
|
17
|
+
readonly fixedScale: number;
|
|
18
|
+
readonly minFixed: number;
|
|
19
|
+
readonly maxFixed: number;
|
|
20
|
+
toFixed(value: number): number;
|
|
21
|
+
fromFixed(value: number): number;
|
|
22
|
+
add(a: number, b: number): number;
|
|
23
|
+
sub(a: number, b: number): number;
|
|
24
|
+
mul(a: number, b: number): number;
|
|
25
|
+
div(a: number, b: number): number;
|
|
26
|
+
saturatingAdd(a: number, b: number): number;
|
|
27
|
+
saturatingSub(a: number, b: number): number;
|
|
28
|
+
quantize(value: number, engine: number): number;
|
|
29
|
+
sqrt(value: number): number;
|
|
30
|
+
integerSqrt(value: number): number;
|
|
31
|
+
abs(value: number): number;
|
|
32
|
+
sign(value: number): number;
|
|
33
|
+
min(a: number, b: number): number;
|
|
34
|
+
max(a: number, b: number): number;
|
|
35
|
+
lerp(a: number, b: number, t: number): number;
|
|
36
|
+
mod(a: number, b: number): number;
|
|
37
|
+
inverseLerp(a: number, b: number, value: number): number;
|
|
38
|
+
remap(inMin: number, inMax: number, outMin: number, outMax: number, value: number): number;
|
|
39
|
+
smoothstep(edge0: number, edge1: number, value: number): number;
|
|
40
|
+
log2Fixed(value: number): number;
|
|
41
|
+
log(value: number): number;
|
|
42
|
+
exp(value: number): number;
|
|
43
|
+
sinTurns(turns: number): number;
|
|
44
|
+
cosTurns(turns: number): number;
|
|
45
|
+
tanTurns(turns: number): number;
|
|
46
|
+
atan2(y: number, x: number): number;
|
|
47
|
+
atan2Signed(y: number, x: number): number;
|
|
48
|
+
wrapTurns(turns: number): number;
|
|
49
|
+
angleDeltaTurns(a: number, b: number): number;
|
|
50
|
+
turnsToRadians(turns: number): number;
|
|
51
|
+
radiansToTurns(radians: number): number;
|
|
52
|
+
hypot(x: number, y: number): number;
|
|
53
|
+
vec2(x: number, y: number): DeterministicVec2;
|
|
54
|
+
vec2Add(a: DeterministicVec2, b: DeterministicVec2): DeterministicVec2;
|
|
55
|
+
vec2Sub(a: DeterministicVec2, b: DeterministicVec2): DeterministicVec2;
|
|
56
|
+
vec2Scale(value: DeterministicVec2, scale: number): DeterministicVec2;
|
|
57
|
+
vec2Dot(a: DeterministicVec2, b: DeterministicVec2): number;
|
|
58
|
+
vec2Cross(a: DeterministicVec2, b: DeterministicVec2): number;
|
|
59
|
+
vec2LengthSq(value: DeterministicVec2): number;
|
|
60
|
+
vec2Length(value: DeterministicVec2): number;
|
|
61
|
+
vec2DistanceSq(a: DeterministicVec2, b: DeterministicVec2): number;
|
|
62
|
+
vec2Distance(a: DeterministicVec2, b: DeterministicVec2): number;
|
|
63
|
+
vec2Normalize(value: DeterministicVec2): DeterministicVec2;
|
|
64
|
+
vec2Perp(value: DeterministicVec2): DeterministicVec2;
|
|
65
|
+
vec2Negate(value: DeterministicVec2): DeterministicVec2;
|
|
66
|
+
vec2Rotate(value: DeterministicVec2, turns: number): DeterministicVec2;
|
|
67
|
+
vec2FromAngleTurns(turns: number, length: number): DeterministicVec2;
|
|
68
|
+
vec2AngleTurns(value: DeterministicVec2): number;
|
|
69
|
+
vec2Lerp(a: DeterministicVec2, b: DeterministicVec2, t: number): DeterministicVec2;
|
|
70
|
+
vec3(x: number, y: number, z: number): DeterministicVec3;
|
|
71
|
+
vec3Add(a: DeterministicVec3, b: DeterministicVec3): DeterministicVec3;
|
|
72
|
+
vec3Sub(a: DeterministicVec3, b: DeterministicVec3): DeterministicVec3;
|
|
73
|
+
vec3Scale(value: DeterministicVec3, scale: number): DeterministicVec3;
|
|
74
|
+
vec3Dot(a: DeterministicVec3, b: DeterministicVec3): number;
|
|
75
|
+
vec3Cross(a: DeterministicVec3, b: DeterministicVec3): DeterministicVec3;
|
|
76
|
+
vec3LengthSq(value: DeterministicVec3): number;
|
|
77
|
+
vec3Length(value: DeterministicVec3): number;
|
|
78
|
+
vec3Distance(a: DeterministicVec3, b: DeterministicVec3): number;
|
|
79
|
+
vec3Normalize(value: DeterministicVec3): DeterministicVec3;
|
|
80
|
+
vec3Lerp(a: DeterministicVec3, b: DeterministicVec3, t: number): DeterministicVec3;
|
|
81
|
+
vec3Negate(value: DeterministicVec3): DeterministicVec3;
|
|
82
|
+
quatFromYawTurns(turns: number): DeterministicQuaternion;
|
|
83
|
+
quatLerp(a: DeterministicQuaternion, b: DeterministicQuaternion, t: number): DeterministicQuaternion;
|
|
84
|
+
clamp(value: number, min: number, max: number): number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface FixedTurnsMathApi {
|
|
88
|
+
readonly ONE: number;
|
|
89
|
+
F(value: number): number;
|
|
90
|
+
mul(a: number, b: number): number;
|
|
91
|
+
div(a: number, b: number): number;
|
|
92
|
+
clamp(value: number, min: number, max: number): number;
|
|
93
|
+
fabs(value: number): number;
|
|
94
|
+
fsign(value: number): number;
|
|
95
|
+
lerp(a: number, b: number, t: number): number;
|
|
96
|
+
fsin(turns: number): number;
|
|
97
|
+
fcos(turns: number): number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface DeterministicRandomSnapshot {
|
|
101
|
+
readonly state: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function createDeterministicMath(
|
|
105
|
+
fixedScale?: number,
|
|
106
|
+
minFixed?: number,
|
|
107
|
+
maxFixed?: number,
|
|
108
|
+
): DeterministicMathApi;
|
|
109
|
+
|
|
110
|
+
export function createFixedTurnsMath(scale: number): FixedTurnsMathApi;
|
|
111
|
+
|
|
112
|
+
export class DeterministicRandom {
|
|
113
|
+
state: number;
|
|
114
|
+
constructor(seed: number);
|
|
115
|
+
nextUint32(): number;
|
|
116
|
+
nextInt(minInclusive: number, maxInclusive: number): number;
|
|
117
|
+
nextFixed(scale?: number): number;
|
|
118
|
+
fork(label: string): DeterministicRandom;
|
|
119
|
+
nextBool(): boolean;
|
|
120
|
+
nextRangeFixed(minFixed: number, maxFixed: number): number;
|
|
121
|
+
nextAngleTurns(fixedScale: number): number;
|
|
122
|
+
pickOne<T>(items: readonly T[]): T;
|
|
123
|
+
weighted<T>(items: readonly T[], weights: readonly number[]): T;
|
|
124
|
+
gaussian(math: DeterministicMathApi): number;
|
|
125
|
+
snapshot(): DeterministicRandomSnapshot;
|
|
126
|
+
restore(snapshot: DeterministicRandomSnapshot): void;
|
|
127
|
+
}
|
package/core/index.d.ts
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
// Hand-authored public surface. The runtime is ESM JavaScript (.mjs) moved
|
|
2
|
+
// verbatim out of the console lab; these declarations give consumers types
|
|
3
|
+
// without touching a byte of runtime behavior.
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
assertKinetixRuntime,
|
|
7
|
+
assertKinetixRuntimeIdentity,
|
|
8
|
+
kinetixRuntimeIdentitiesEqual,
|
|
9
|
+
kinetixRuntimeAbiVersion,
|
|
10
|
+
} from './runtime';
|
|
11
|
+
export {
|
|
12
|
+
createInstalledRuntimeAdapter,
|
|
13
|
+
describeKinetixAuxiliaryAsset,
|
|
14
|
+
verifyKinetixAuxiliaryAsset,
|
|
15
|
+
} from './runtime';
|
|
16
|
+
export type {
|
|
17
|
+
InstalledRuntimeAdapterOptions,
|
|
18
|
+
KinetixAdvanceRequest,
|
|
19
|
+
KinetixAdvanceResult,
|
|
20
|
+
KinetixAuxiliaryAssetDeclaration,
|
|
21
|
+
KinetixRuntime,
|
|
22
|
+
KinetixRuntimeCapabilities,
|
|
23
|
+
KinetixRuntimeIdentity,
|
|
24
|
+
KinetixSessionConfigEnvelope,
|
|
25
|
+
} from './runtime';
|
|
26
|
+
export {
|
|
27
|
+
KINETIX_PLATFORMER2D_LEVEL_FORMAT,
|
|
28
|
+
KINETIX_PLATFORMER2D_PACK_FORMAT,
|
|
29
|
+
KINETIX_PLATFORMER2D_PACK_FORMAT_V1,
|
|
30
|
+
KINETIX_PLATFORMER2D_LEVEL_FORMAT_V1,
|
|
31
|
+
KINETIX_PLATFORMER2D_SPENT_TILE_ID,
|
|
32
|
+
KinetixPlatformerLevelError,
|
|
33
|
+
KinetixPlatformerRegistryError,
|
|
34
|
+
MAX_KINETIX_PLATFORMER2D_LEVEL_BYTES,
|
|
35
|
+
applyKinetixPlatformer2dTileOverrides,
|
|
36
|
+
createInstalledPlatformer2dRuntime,
|
|
37
|
+
createKinetixPlatformer2dRegistry,
|
|
38
|
+
createKinetixPlatformer2dSession,
|
|
39
|
+
decodeKinetixPlatformer2dLevel,
|
|
40
|
+
defineKinetixPlatformer2dPack,
|
|
41
|
+
deriveKinetixPlatformer2dRuntimeIdentity,
|
|
42
|
+
describeKinetixPlatformer2dLevel,
|
|
43
|
+
encodeKinetixPlatformer2dLevel,
|
|
44
|
+
kinetixPlatformer2dBuiltInEntityTypes,
|
|
45
|
+
kinetixPlatformer2dDeterministicAbi,
|
|
46
|
+
kinetixPlatformer2dLevelBonusBlocks,
|
|
47
|
+
kinetixPlatformer2dLevelBreakableTileIds,
|
|
48
|
+
kinetixPlatformer2dLevelOpenBounds,
|
|
49
|
+
kinetixPlatformer2dLevelSlopeTiles,
|
|
50
|
+
kinetixPlatformer2dSessionConfigSchema,
|
|
51
|
+
kinetixPlatformer2dSourceManifest,
|
|
52
|
+
migrateKinetixPlatformer2dLevel,
|
|
53
|
+
migrateKinetixPlatformer2dPack,
|
|
54
|
+
nextRngUint32,
|
|
55
|
+
rngInt,
|
|
56
|
+
seedRng,
|
|
57
|
+
} from './runtime';
|
|
58
|
+
export type {
|
|
59
|
+
KinetixPlatformer2dAbilities,
|
|
60
|
+
KinetixPlatformer2dBonusBlock,
|
|
61
|
+
KinetixPlatformer2dBonusContents,
|
|
62
|
+
KinetixPlatformer2dEntityDescriptor,
|
|
63
|
+
KinetixPlatformer2dPackV1,
|
|
64
|
+
KinetixPlatformer2dEntityValidationContext,
|
|
65
|
+
KinetixPlatformer2dIdentityOptions,
|
|
66
|
+
KinetixPlatformer2dEvent,
|
|
67
|
+
KinetixPlatformer2dGoalMode,
|
|
68
|
+
KinetixPlatformer2dInput,
|
|
69
|
+
KinetixPlatformer2dLevel,
|
|
70
|
+
KinetixPlatformer2dLevelEntity,
|
|
71
|
+
KinetixPlatformer2dPack,
|
|
72
|
+
KinetixPlatformer2dPhase,
|
|
73
|
+
KinetixPlatformer2dPlayerProjection,
|
|
74
|
+
KinetixPlatformer2dPowerUpKind,
|
|
75
|
+
KinetixPlatformer2dProjection,
|
|
76
|
+
KinetixPlatformer2dRegistry,
|
|
77
|
+
KinetixPlatformer2dSessionSetup,
|
|
78
|
+
KinetixPlatformer2dSlopeTile,
|
|
79
|
+
KinetixPlatformer2dTickRate,
|
|
80
|
+
KinetixPlatformerLevelErrorCode,
|
|
81
|
+
KinetixRuntimeModuleManifestEntry,
|
|
82
|
+
} from './runtime';
|
|
83
|
+
export { defineKinetixProject } from './authoring';
|
|
84
|
+
export type { KinetixProjectDeclaration, KinetixSessionConfigSchema } from './authoring';
|
|
85
|
+
export {
|
|
86
|
+
createDeterministicMath,
|
|
87
|
+
createFixedTurnsMath,
|
|
88
|
+
DeterministicRandom,
|
|
89
|
+
} from './deterministic-stdlib';
|
|
90
|
+
export {
|
|
91
|
+
applyDeterministicImpulse3D,
|
|
92
|
+
applyDeterministicImpulses3D,
|
|
93
|
+
applyDeterministicWorldEdit3D,
|
|
94
|
+
applyPhysicsImpulse,
|
|
95
|
+
applyPhysicsImpulses,
|
|
96
|
+
applyPhysicsWorldEdit,
|
|
97
|
+
createPhysicsWorld,
|
|
98
|
+
createDeterministicPhysicsWorld3D,
|
|
99
|
+
createTrustedDeterministicPhysicsWorld3D,
|
|
100
|
+
cookPhysicsCollider,
|
|
101
|
+
contactDetailsDeterministicPhysics3D,
|
|
102
|
+
contactDetailsPhysics,
|
|
103
|
+
initPhysics,
|
|
104
|
+
initPhysics3D,
|
|
105
|
+
overlapDeterministicPhysics3D,
|
|
106
|
+
overlapPhysics,
|
|
107
|
+
physicsReady,
|
|
108
|
+
physics3DReady,
|
|
109
|
+
physicsWasmMetadata,
|
|
110
|
+
raycastDeterministicPhysics3D,
|
|
111
|
+
raycastDeterministicPhysics3DDetailed,
|
|
112
|
+
raycastPhysics,
|
|
113
|
+
raycastPhysicsDetailed,
|
|
114
|
+
resetPhysics3DCache,
|
|
115
|
+
setDeterministicBodyVelocity3D,
|
|
116
|
+
setPhysicsBodyVelocity,
|
|
117
|
+
shapeCastDeterministicPhysics3D,
|
|
118
|
+
shapeCastPhysics,
|
|
119
|
+
stepPhysicsWorld,
|
|
120
|
+
stepDeterministicPhysicsWorld3D,
|
|
121
|
+
} from './physics';
|
|
122
|
+
export type {
|
|
123
|
+
KinetixPhysicsActivePair,
|
|
124
|
+
KinetixPhysicsBody,
|
|
125
|
+
KinetixPhysicsContactCacheEntry,
|
|
126
|
+
KinetixPhysicsContactDetail,
|
|
127
|
+
KinetixPhysicsContactEvent,
|
|
128
|
+
KinetixPhysicsHit,
|
|
129
|
+
KinetixPhysicsJointCacheEntry,
|
|
130
|
+
KinetixPhysicsOverlapQuery,
|
|
131
|
+
KinetixPhysicsQuaternion,
|
|
132
|
+
KinetixPhysicsQueryOptions,
|
|
133
|
+
KinetixPhysicsRaycastQuery,
|
|
134
|
+
KinetixPhysicsScheduledQuery,
|
|
135
|
+
KinetixPhysicsShape,
|
|
136
|
+
KinetixPhysicsShapeCastQuery,
|
|
137
|
+
KinetixPhysicsStepOptions,
|
|
138
|
+
KinetixPhysicsStepResult,
|
|
139
|
+
KinetixPhysicsVec3,
|
|
140
|
+
KinetixPhysicsWorld,
|
|
141
|
+
} from './physics';
|
|
142
|
+
export type {
|
|
143
|
+
DeterministicMathApi,
|
|
144
|
+
DeterministicQuaternion,
|
|
145
|
+
DeterministicRandomSnapshot,
|
|
146
|
+
DeterministicVec2,
|
|
147
|
+
DeterministicVec3,
|
|
148
|
+
FixedTurnsMathApi,
|
|
149
|
+
} from './deterministic-stdlib';
|
|
150
|
+
|
|
151
|
+
export type KinetixTargetProfile = 'deterministic-f64' | 'fixed-1000-3d';
|
|
152
|
+
|
|
153
|
+
export interface KinetixCompileInput {
|
|
154
|
+
projectRoot: string;
|
|
155
|
+
expectedCommit: string;
|
|
156
|
+
targetProfile: KinetixTargetProfile;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface KinetixDiagnostic {
|
|
160
|
+
code: string;
|
|
161
|
+
message: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface KinetixEnvelope {
|
|
165
|
+
profiles: { id: string }[];
|
|
166
|
+
entities: {
|
|
167
|
+
id: string;
|
|
168
|
+
components: { id: string; type: string; properties: Record<string, unknown> }[];
|
|
169
|
+
}[];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface KinetixCompiled {
|
|
173
|
+
envelope: KinetixEnvelope | null;
|
|
174
|
+
diagnostics: KinetixDiagnostic[];
|
|
175
|
+
sourceSnapshot: unknown;
|
|
176
|
+
semanticCoverage: unknown;
|
|
177
|
+
unmatchedBehaviors: unknown[];
|
|
178
|
+
runtimeContract: KinetixRuntimeContract | null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface KinetixRuntimeContract {
|
|
182
|
+
readonly tickRate: 10 | 20 | 30 | 60;
|
|
183
|
+
readonly targetProfile: KinetixTargetProfile;
|
|
184
|
+
readonly numericProfile: string;
|
|
185
|
+
readonly deterministicAbi: string;
|
|
186
|
+
readonly deterministicVersion: string;
|
|
187
|
+
readonly inputSchema: Readonly<Record<string, unknown>>;
|
|
188
|
+
readonly stateSchema: Readonly<Record<string, unknown>>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface KinetixSystem {
|
|
192
|
+
id: string;
|
|
193
|
+
phase: string;
|
|
194
|
+
phaseIndex: number;
|
|
195
|
+
order: number;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface KinetixProducts {
|
|
199
|
+
sourceDigest: string;
|
|
200
|
+
manifest: {
|
|
201
|
+
runtime: KinetixRuntimeContract;
|
|
202
|
+
systems: KinetixSystem[];
|
|
203
|
+
payloads: { name: string; digest: string; byteLength: number }[];
|
|
204
|
+
/**
|
|
205
|
+
* Immutable external deterministic data bound by content hash. Sorted by
|
|
206
|
+
* name, unique. When non-empty it is folded into `engineIdentityHash`, so a
|
|
207
|
+
* signed product covers the asset's identity without embedding its bytes.
|
|
208
|
+
*/
|
|
209
|
+
auxiliaryAssets?: { name: string; digest: string; byteLength: number }[];
|
|
210
|
+
};
|
|
211
|
+
simulation: unknown;
|
|
212
|
+
presentation: unknown;
|
|
213
|
+
binding: unknown;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface KinetixCompilation {
|
|
217
|
+
compiled: KinetixCompiled;
|
|
218
|
+
products: KinetixProducts;
|
|
219
|
+
runtimeIdentity: import('./runtime').KinetixRuntimeIdentity;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface KinetixInstalledProfile {
|
|
223
|
+
readonly abi: string;
|
|
224
|
+
readonly runtimeContract: KinetixRuntimeContract;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface KinetixWorldHandle {
|
|
228
|
+
readonly id: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface KinetixWorld {
|
|
232
|
+
step(input: unknown): number;
|
|
233
|
+
snapshot(): unknown;
|
|
234
|
+
restore(snapshot: unknown): void;
|
|
235
|
+
canonicalStateBytes(): Uint8Array;
|
|
236
|
+
read(handle: KinetixWorldHandle): {
|
|
237
|
+
components: { type: string; properties: Record<string, unknown> }[];
|
|
238
|
+
};
|
|
239
|
+
directHandle(entityId: string): KinetixWorldHandle;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface KinetixRenderRecord {
|
|
243
|
+
kind: string;
|
|
244
|
+
source: string;
|
|
245
|
+
component: string;
|
|
246
|
+
transform: unknown;
|
|
247
|
+
bindingDigest: string;
|
|
248
|
+
worldTick: number;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface KinetixRenderProjection {
|
|
252
|
+
project(): KinetixRenderRecord[];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface KinetixBakeResult {
|
|
256
|
+
valid: boolean;
|
|
257
|
+
products: KinetixProducts | null;
|
|
258
|
+
runtimeIdentity: import('./runtime').KinetixRuntimeIdentity | null;
|
|
259
|
+
diagnostics: KinetixDiagnostic[];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export function compileKinetixProject(input: KinetixCompileInput): KinetixCompiled;
|
|
263
|
+
export function compileTrustedKinetixSource(input: {
|
|
264
|
+
sourceRoot: string;
|
|
265
|
+
expectedCommit: string;
|
|
266
|
+
targetProfile: KinetixTargetProfile;
|
|
267
|
+
classifyInstalledBranches?: boolean;
|
|
268
|
+
}): KinetixCompiled;
|
|
269
|
+
export function kinetixCanonicalSourceDigest(sourceRoot: string): string;
|
|
270
|
+
|
|
271
|
+
export function bakeKinetixEnvelope(
|
|
272
|
+
envelope: KinetixEnvelope,
|
|
273
|
+
installedProfiles: Map<string, KinetixInstalledProfile>,
|
|
274
|
+
): KinetixBakeResult;
|
|
275
|
+
export type KinetixRuntimeModuleDeclaration = import('./runtime').KinetixRuntimeModuleManifestEntry;
|
|
276
|
+
|
|
277
|
+
export interface KinetixBakeOptions {
|
|
278
|
+
/**
|
|
279
|
+
* Canonical manifest of the installed runtime's implementation modules,
|
|
280
|
+
* sorted by path. Folded into the simulation payload (and so into
|
|
281
|
+
* engineIdentityHash), binding the custom step implementation to the signed
|
|
282
|
+
* product. Build with kinetixRuntimeModuleManifest.
|
|
283
|
+
*/
|
|
284
|
+
runtimeModules?: readonly KinetixRuntimeModuleDeclaration[];
|
|
285
|
+
/** Emitted as manifest.auxiliaryAssets; bound into engineIdentityHash when non-empty. */
|
|
286
|
+
auxiliaryAssets?: readonly { name: string; digest: string; byteLength: number }[];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export function bakeKinetixProjectDefinition(
|
|
290
|
+
project: import('./authoring').KinetixProjectDeclaration,
|
|
291
|
+
options?: KinetixBakeOptions,
|
|
292
|
+
): {
|
|
293
|
+
products: KinetixProducts;
|
|
294
|
+
runtimeIdentity: import('./runtime').KinetixRuntimeIdentity;
|
|
295
|
+
contentDigest: string;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
/** Node-only build-time helper: hashes module files into a sorted canonical manifest. */
|
|
299
|
+
export function kinetixRuntimeModuleManifest(
|
|
300
|
+
sourceRoot: string,
|
|
301
|
+
relativePaths: readonly string[],
|
|
302
|
+
): KinetixRuntimeModuleDeclaration[];
|
|
303
|
+
|
|
304
|
+
export function encodeKinetixSessionConfig(
|
|
305
|
+
schema: import('./authoring').KinetixSessionConfigSchema,
|
|
306
|
+
value: Readonly<Record<string, unknown>>,
|
|
307
|
+
): Uint8Array;
|
|
308
|
+
export function decodeKinetixSessionConfig(
|
|
309
|
+
schema: import('./authoring').KinetixSessionConfigSchema,
|
|
310
|
+
bytes: Uint8Array,
|
|
311
|
+
): Record<string, unknown>;
|
|
312
|
+
export function kinetixSessionConfigDigest(bytes: Uint8Array): string;
|
|
313
|
+
export const MAX_KINETIX_SESSION_CONFIG_BYTES: 65_536;
|
|
314
|
+
export function createKinetixSessionConfig(
|
|
315
|
+
schema: import('./authoring').KinetixSessionConfigSchema,
|
|
316
|
+
value: Readonly<Record<string, unknown>>,
|
|
317
|
+
): import('./runtime').KinetixSessionConfigEnvelope;
|
|
318
|
+
|
|
319
|
+
export function stableKinetixProductBytes(products: KinetixProducts): Buffer;
|
|
320
|
+
export function stableKinetixSourceBytes(envelope: KinetixEnvelope): Buffer;
|
|
321
|
+
export function scanKinetixPayloadTree(value: unknown): void;
|
|
322
|
+
export function validateInstalledKinetixProfile(profileId: string, profile: KinetixInstalledProfile): void;
|
|
323
|
+
export function assertKinetixProductContract(products: KinetixProducts): KinetixProducts;
|
|
324
|
+
export function assertKinetixRuntimeContract(contract: KinetixRuntimeContract): KinetixRuntimeContract;
|
|
325
|
+
export function deriveKinetixRuntimeIdentity(
|
|
326
|
+
products: KinetixProducts,
|
|
327
|
+
runtimeContract?: KinetixRuntimeContract,
|
|
328
|
+
): import('./runtime').KinetixRuntimeIdentity;
|
|
329
|
+
export function assertKinetixRuntimeIdentityMatchesProducts(
|
|
330
|
+
products: KinetixProducts,
|
|
331
|
+
identity: import('./runtime').KinetixRuntimeIdentity,
|
|
332
|
+
): import('./runtime').KinetixRuntimeIdentity;
|
|
333
|
+
|
|
334
|
+
export interface CustomRuntimeIdentityOptions {
|
|
335
|
+
readonly tickRate: number;
|
|
336
|
+
readonly inputSchema: object;
|
|
337
|
+
readonly stateSchema: object;
|
|
338
|
+
readonly runtimeModules: ReadonlyArray<{ readonly path: string; readonly digest: string }>;
|
|
339
|
+
readonly deterministicVersion: string;
|
|
340
|
+
readonly auxiliaryAssets?: ReadonlyArray<{
|
|
341
|
+
readonly name: string;
|
|
342
|
+
readonly digest: string;
|
|
343
|
+
readonly byteLength: number;
|
|
344
|
+
}>;
|
|
345
|
+
readonly deterministicAbi?: string;
|
|
346
|
+
readonly sessionConfigSchema?: object;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Derives a source-bound runtime identity for a fully-custom installed runtime,
|
|
351
|
+
* folding its `runtimeModules` manifest (and optional `auxiliaryAssets` /
|
|
352
|
+
* `sessionConfigSchema` / `deterministicAbi`) into `engineIdentityHash` the same
|
|
353
|
+
* canonical way `deriveKinetixRuntimeIdentity` does. The supported path for
|
|
354
|
+
* custom `createInstalledRuntimeAdapter` runtimes, which cannot go through the
|
|
355
|
+
* profile-locked `defineKinetixProject` baker.
|
|
356
|
+
*/
|
|
357
|
+
export function deriveCustomRuntimeIdentity(
|
|
358
|
+
options: CustomRuntimeIdentityOptions,
|
|
359
|
+
): import('./runtime').KinetixRuntimeIdentity;
|
|
360
|
+
export const kinetixBakerVersion: string;
|
|
361
|
+
export const kinetixPhases: readonly string[];
|
|
362
|
+
|
|
363
|
+
export function createKinetixWorld(options: {
|
|
364
|
+
worldId: string;
|
|
365
|
+
products: KinetixProducts;
|
|
366
|
+
installedProfiles: Map<string, KinetixInstalledProfile>;
|
|
367
|
+
initialization?: Record<string, unknown>;
|
|
368
|
+
}): KinetixWorld;
|
|
369
|
+
|
|
370
|
+
export function createKinetixWorldRuntime(options: {
|
|
371
|
+
world: KinetixWorld;
|
|
372
|
+
identity: import('./runtime').KinetixRuntimeIdentity;
|
|
373
|
+
sessionConfigBytes?: Uint8Array;
|
|
374
|
+
}): import('./runtime').KinetixRuntime<unknown, unknown>;
|
|
375
|
+
|
|
376
|
+
export function createKinetixRenderProjection(options: {
|
|
377
|
+
world: KinetixWorld;
|
|
378
|
+
products: KinetixProducts;
|
|
379
|
+
}): KinetixRenderProjection;
|
|
380
|
+
|
|
381
|
+
/** Compiles twice and byte-compares, so a nondeterministic product fails loudly. */
|
|
382
|
+
export function compileStableKinetixProducts(input: KinetixCompileInput): KinetixCompilation;
|
|
383
|
+
export function compileStableKinetixProductsFromTrustedSource(input: {
|
|
384
|
+
sourceRoot: string;
|
|
385
|
+
expectedCommit: string;
|
|
386
|
+
targetProfile: KinetixTargetProfile;
|
|
387
|
+
}): KinetixCompilation;
|
|
388
|
+
|
|
389
|
+
/** Builds the portable C++ core and returns the binary path. */
|
|
390
|
+
export function buildNative(): string;
|