@series-inc/rundot-syncplay 5.23.0 → 5.24.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 +20 -0
- package/dist/browser.d.ts +4 -1
- package/dist/browser.js +1 -0
- package/dist/checksum-basis.d.ts +4 -0
- package/dist/checksum-basis.js +17 -0
- package/dist/cjs/browser.js +4 -2
- package/dist/cjs/checksum-basis.js +22 -0
- package/dist/cjs/collider-cooking.js +834 -0
- package/dist/cjs/deterministic-session.js +2 -0
- package/dist/cjs/engine-parity-matrix.js +32 -9
- package/dist/cjs/engine-parity.js +1 -1
- package/dist/cjs/index.js +8 -2
- package/dist/cjs/instant-replay.js +4 -9
- package/dist/cjs/movement3d.js +17 -1
- package/dist/cjs/networked-client.js +11 -9
- package/dist/cjs/node.js +5 -1
- package/dist/cjs/offline-session.js +52 -24
- package/dist/cjs/physics-cert.js +7 -2
- package/dist/cjs/physics3d-hull.js +381 -0
- package/dist/cjs/physics3d-joints.js +163 -31
- package/dist/cjs/physics3d-recipes.js +197 -0
- package/dist/cjs/physics3d-shared.js +6 -0
- package/dist/cjs/physics3d-solver.js +746 -89
- package/dist/cjs/physics3d-stacking.js +154 -0
- package/dist/cjs/physics3d-toi.js +251 -0
- package/dist/cjs/physics3d-vehicle.js +35 -10
- package/dist/cjs/physics3d.js +401 -20
- package/dist/cjs/runtime-support.js +71 -0
- package/dist/cjs/session-promotion.js +5 -5
- package/dist/cjs/synctest.js +49 -0
- package/dist/cjs/testing.js +4 -1
- package/dist/cli.js +163 -41
- package/dist/collider-cooking.d.ts +141 -0
- package/dist/collider-cooking.js +829 -0
- package/dist/deterministic-session.js +2 -0
- package/dist/engine-parity-matrix.js +32 -9
- package/dist/engine-parity.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/instant-replay.d.ts +2 -2
- package/dist/instant-replay.js +4 -9
- package/dist/movement3d.js +18 -2
- package/dist/networked-client.js +11 -9
- package/dist/node.d.ts +2 -0
- package/dist/node.js +2 -0
- package/dist/offline-session.js +53 -25
- package/dist/physics-cert.js +7 -2
- package/dist/physics3d-hull.d.ts +53 -0
- package/dist/physics3d-hull.js +376 -0
- package/dist/physics3d-joints.d.ts +7 -0
- package/dist/physics3d-joints.js +163 -31
- package/dist/physics3d-recipes.d.ts +29 -0
- package/dist/physics3d-recipes.js +193 -0
- package/dist/physics3d-shared.js +6 -0
- package/dist/physics3d-solver.d.ts +65 -1
- package/dist/physics3d-solver.js +744 -89
- package/dist/physics3d-stacking.d.ts +26 -0
- package/dist/physics3d-stacking.js +147 -0
- package/dist/physics3d-toi.d.ts +70 -0
- package/dist/physics3d-toi.js +245 -0
- package/dist/physics3d-vehicle.js +35 -10
- package/dist/physics3d.d.ts +20 -2
- package/dist/physics3d.js +400 -21
- package/dist/runtime-support.d.ts +60 -0
- package/dist/runtime-support.js +66 -0
- package/dist/session-promotion.js +5 -5
- package/dist/synctest.d.ts +1 -1
- package/dist/synctest.js +49 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.js +1 -0
- package/dist/types.d.ts +21 -2
- package/package.json +8 -3
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { DeterministicPhysicsShape3D } from './physics3d.js';
|
|
2
|
+
import type { Point3D } from './physics3d-shared.js';
|
|
3
|
+
export interface ColliderSourceMesh {
|
|
4
|
+
/** Triangle-list vertices; `length` must be a positive multiple of 3. */
|
|
5
|
+
readonly vertices: readonly Point3D[];
|
|
6
|
+
}
|
|
7
|
+
export interface ColliderCookOptions {
|
|
8
|
+
/** Voxel grid resolution along the mesh's longest axis (4..96). */
|
|
9
|
+
readonly resolution?: number;
|
|
10
|
+
/** Upper bound on emitted hull children (1..64). */
|
|
11
|
+
readonly maxHulls?: number;
|
|
12
|
+
/** Vertex cap per emitted hull (8..16); 8 is the voxel-AABB fallback's size. */
|
|
13
|
+
readonly maxHullVertices?: number;
|
|
14
|
+
/** Stop splitting a part once `1 - partVolume/hullVolume` falls under this. */
|
|
15
|
+
readonly concavityTolerance?: number;
|
|
16
|
+
/** Output vertex quantum; must match the runtime's distance quantum or be coarser. */
|
|
17
|
+
readonly quantum?: number;
|
|
18
|
+
/** Candidate split planes evaluated per axis. */
|
|
19
|
+
readonly splitCandidates?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface CookedColliderHull {
|
|
22
|
+
readonly vertexCount: number;
|
|
23
|
+
/** `1 - partVoxelVolume / hullVolume` for the part this hull covers. */
|
|
24
|
+
readonly concavity: number;
|
|
25
|
+
}
|
|
26
|
+
export interface CookedCollider {
|
|
27
|
+
readonly schemaVersion: 1;
|
|
28
|
+
readonly kind: 'deterministic-convex-decomposition';
|
|
29
|
+
readonly shape: Extract<DeterministicPhysicsShape3D, {
|
|
30
|
+
readonly type: 'compound';
|
|
31
|
+
}>;
|
|
32
|
+
readonly hulls: readonly CookedColliderHull[];
|
|
33
|
+
readonly sourceTriangles: number;
|
|
34
|
+
readonly resolution: number;
|
|
35
|
+
/** Volume-weighted mean concavity across the emitted hulls. */
|
|
36
|
+
readonly concavity: number;
|
|
37
|
+
readonly hash: string;
|
|
38
|
+
}
|
|
39
|
+
interface Lattice {
|
|
40
|
+
/** Grid dimensions in voxels. */
|
|
41
|
+
readonly nx: number;
|
|
42
|
+
readonly ny: number;
|
|
43
|
+
readonly nz: number;
|
|
44
|
+
readonly voxelSize: number;
|
|
45
|
+
readonly originX: number;
|
|
46
|
+
readonly originY: number;
|
|
47
|
+
readonly originZ: number;
|
|
48
|
+
/** Occupied voxel indices, ascending. */
|
|
49
|
+
readonly occupied: readonly number[];
|
|
50
|
+
}
|
|
51
|
+
/** A voxel-index subset of the lattice. */
|
|
52
|
+
interface Part {
|
|
53
|
+
readonly voxels: readonly number[];
|
|
54
|
+
readonly hull: LatticeHull;
|
|
55
|
+
readonly concavity: number;
|
|
56
|
+
}
|
|
57
|
+
/** Convex hull in corner-lattice integer coordinates. */
|
|
58
|
+
interface LatticeHull {
|
|
59
|
+
readonly vertices: readonly (readonly [number, number, number])[];
|
|
60
|
+
readonly faces: readonly (readonly [number, number, number])[];
|
|
61
|
+
/** Exact hull volume in corner-lattice units (voxel = 1 unit³). */
|
|
62
|
+
readonly volume: number;
|
|
63
|
+
}
|
|
64
|
+
export declare function cookConvexDecomposition(source: ColliderSourceMesh, options?: ColliderCookOptions): CookedCollider;
|
|
65
|
+
/**
|
|
66
|
+
* Re-run every runtime guard the cooked collider will meet at world creation,
|
|
67
|
+
* so a bad cook fails in the asset pipeline rather than in a game.
|
|
68
|
+
*/
|
|
69
|
+
export declare function assertCookedColliderIsRuntimeValid(cooked: CookedCollider): void;
|
|
70
|
+
declare function voxelize(triangles: readonly (readonly [Point3D, Point3D, Point3D])[], resolution: number): Lattice;
|
|
71
|
+
/**
|
|
72
|
+
* Akenine-Möller triangle/AABB overlap, box centred at `center` with half-width
|
|
73
|
+
* `half`, biased outward by `tol`.
|
|
74
|
+
*
|
|
75
|
+
* The bias is load-bearing, not a fudge. Axis-aligned source faces land exactly
|
|
76
|
+
* on voxel boundaries whenever the voxel size is not a binary fraction (`1/24`
|
|
77
|
+
* is not), so the overlap test is decided at exact tangency and rounding rejects
|
|
78
|
+
* roughly half the cells. That punches holes in the surface shell, the exterior
|
|
79
|
+
* flood fill leaks through them, and the mesh cooks hollow. A conservative
|
|
80
|
+
* rasteriser must resolve tangency as "overlapping".
|
|
81
|
+
*/
|
|
82
|
+
declare function triangleIntersectsBox(triangle: readonly [Point3D, Point3D, Point3D], center: Point3D, half: number): boolean;
|
|
83
|
+
declare function makePart(voxels: readonly number[], lattice: Lattice): Part;
|
|
84
|
+
declare function bestSplit(part: Part, lattice: Lattice, splitCandidates: number): readonly [Part, Part] | undefined;
|
|
85
|
+
type IVec = readonly [number, number, number];
|
|
86
|
+
/**
|
|
87
|
+
* Incremental convex hull over integer points. Degenerate inputs (collinear or
|
|
88
|
+
* coplanar) return an empty face set with zero volume; callers treat that as a
|
|
89
|
+
* flat part and fall back to its voxel AABB.
|
|
90
|
+
*/
|
|
91
|
+
declare function convexHullLattice(points: readonly IVec[]): LatticeHull;
|
|
92
|
+
declare function collinear(a: IVec, b: IVec, c: IVec): boolean;
|
|
93
|
+
declare function finalizeHull(part: Part, lattice: Lattice, maxHullVertices: number, quantum: number): readonly Point3D[];
|
|
94
|
+
/**
|
|
95
|
+
* Drop the least load-bearing vertex until the cap is met.
|
|
96
|
+
*
|
|
97
|
+
* A vertex's cost is the volume of the cone its incident faces subtend from the
|
|
98
|
+
* hull's centroid — the part of the hull only that vertex carries. Scoring from
|
|
99
|
+
* the current hull's faces costs one hull rebuild per removal rather than one
|
|
100
|
+
* per candidate, which is the difference between a cook that takes a second and
|
|
101
|
+
* one that takes a minute. It is a greedy proxy, and it is allowed to be: the
|
|
102
|
+
* caller re-inflates the survivor until it contains the original hull, so a
|
|
103
|
+
* suboptimal choice costs tightness, never correctness.
|
|
104
|
+
*/
|
|
105
|
+
declare function reduceLatticeHull(hull: LatticeHull, maxHullVertices: number): readonly IVec[];
|
|
106
|
+
/**
|
|
107
|
+
* Inflate `hullPoints` about their centroid by the smallest factor that puts
|
|
108
|
+
* every point of `mustContain` back inside. A cooked collider is never smaller
|
|
109
|
+
* than the geometry it stands for.
|
|
110
|
+
*/
|
|
111
|
+
declare function inflateToContain(hullPoints: readonly Point3D[], mustContain: readonly Point3D[]): readonly Point3D[];
|
|
112
|
+
interface SupportPlane {
|
|
113
|
+
readonly normal: Point3D;
|
|
114
|
+
/** Signed distance from the centroid to the plane; always > 0. */
|
|
115
|
+
readonly offset: number;
|
|
116
|
+
}
|
|
117
|
+
declare function supportingPlanes(points: readonly Point3D[], centroid: Point3D): readonly SupportPlane[];
|
|
118
|
+
/** Vertices of `points` that survive on the convex boundary, in canonical order. */
|
|
119
|
+
declare function boundaryVertices(points: readonly Point3D[]): readonly Point3D[];
|
|
120
|
+
declare function dedupePoints(points: readonly Point3D[]): readonly Point3D[];
|
|
121
|
+
/**
|
|
122
|
+
* Internals exposed for direct testing. The cook's public entry only ever feeds
|
|
123
|
+
* these well-formed inputs, so their degenerate branches (collinear/coplanar
|
|
124
|
+
* point sets, unsplittable parts, the voxel-AABB fallback) are unreachable
|
|
125
|
+
* through `cookConvexDecomposition` alone.
|
|
126
|
+
*/
|
|
127
|
+
export declare const __colliderCookingInternals: {
|
|
128
|
+
bestSplit: typeof bestSplit;
|
|
129
|
+
boundaryVertices: typeof boundaryVertices;
|
|
130
|
+
collinear: typeof collinear;
|
|
131
|
+
convexHullLattice: typeof convexHullLattice;
|
|
132
|
+
dedupePoints: typeof dedupePoints;
|
|
133
|
+
finalizeHull: typeof finalizeHull;
|
|
134
|
+
inflateToContain: typeof inflateToContain;
|
|
135
|
+
makePart: typeof makePart;
|
|
136
|
+
reduceLatticeHull: typeof reduceLatticeHull;
|
|
137
|
+
supportingPlanes: typeof supportingPlanes;
|
|
138
|
+
triangleIntersectsBox: typeof triangleIntersectsBox;
|
|
139
|
+
voxelize: typeof voxelize;
|
|
140
|
+
};
|
|
141
|
+
export {};
|