@series-inc/rundot-syncplay 6.0.0-rc.31 → 6.0.0-rc.34

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.
Files changed (36) hide show
  1. package/MIGRATING-RC31-TO-RC32.md +67 -0
  2. package/MIGRATING-RC33-TO-RC34.md +105 -0
  3. package/core/native/physics/physics.cpp +747 -145
  4. package/core/native/physics/physics.hpp +49 -0
  5. package/core/native/physics/world.cpp +211 -31
  6. package/core/native/physics/world.hpp +34 -0
  7. package/core/native/physics/world_abi.cpp +214 -0
  8. package/core/native/physics/world_abi.hpp +49 -0
  9. package/core/scripts/build-wasm-physics.mjs +5 -0
  10. package/core/src/kinetix-deterministic-math.mjs +73 -3
  11. package/core/src/kinetix-deterministic-stdlib.mjs +68 -0
  12. package/core/src/physics/physics-profile-wasm-module.generated.mjs +6 -6
  13. package/core/src/physics/physics-wasm-module.generated.mjs +6 -6
  14. package/core/src/physics/world.d.mts +1 -0
  15. package/core/src/physics/world.mjs +244 -50
  16. package/core/src/physics2d/physics2d-wasm-module.generated.mjs +1 -1
  17. package/core/world.d.ts +20 -0
  18. package/dist/api-deprecations.generated.d.ts +24 -0
  19. package/dist/api-deprecations.generated.js +24 -0
  20. package/dist/index.d.ts +6 -2
  21. package/dist/index.js +10 -2
  22. package/dist/math.d.ts +2 -0
  23. package/dist/math.js +68 -0
  24. package/dist/modules/rts.js +1 -1
  25. package/dist/movement3d.js +63 -27
  26. package/dist/physics/3d.d.ts +75 -1
  27. package/dist/physics/3d.js +610 -327
  28. package/dist/physics/portal-render3d.d.ts +126 -0
  29. package/dist/physics/portal-render3d.js +228 -0
  30. package/dist/physics/units.d.ts +14 -5
  31. package/dist/physics/units.js +56 -6
  32. package/dist/physics/vehicle-state3d.d.ts +6 -0
  33. package/dist/physics/vehicle-state3d.js +172 -31
  34. package/dist/tools/module-certification.js +1 -0
  35. package/dist/tools/static-checker.js +9 -2
  36. package/package.json +7 -5
@@ -0,0 +1,67 @@
1
+ # Migrating from Syncplay 6.0.0-rc.31 to rc.32
2
+
3
+ `6.0.0-rc.32` was tagged but not published. `6.0.0-rc.33` is the first published release with these changes, and it adds joint island isolation (C1). Use this guide to move from rc.31 to rc.33.
4
+
5
+ Syncplay `6.0.0-rc.32` implements the complete Wreck Yard feature request roadmap (Sections A through E), delivering deterministic math parity, stable body keys, SI vector helpers, velocity retention aliases, KCC portal diagnostics, and partner test repro fixtures.
6
+
7
+ ---
8
+
9
+ ## 1. Deterministic `pow` and Static Checker (D1)
10
+
11
+ ### What Changed
12
+ - `pow(base, exp)` is now provided as a canonical deterministic float function across `@series-inc/rundot-syncplay`, `/core/deterministic-math`, and `DeterministicMath.pow`.
13
+ - IEEE 754 edge cases, negative bases with integral exponents, special powers ($\pm 0, \pm\infty, \pm 1$), and fractional powers are strictly preserved with bit-identical cross-platform determinism via the minimax/fdlibm standard.
14
+ - The static checker (`checkDeterminism`) now rejects the JavaScript exponentiation operators `**` and `**=` as well as direct calls to ambient `Math.pow`, emitting code `SYNCPLAY_MATH_NON_DETERMINISTIC_OPERATOR` and recommending `pow(base, exp)` from `@series-inc/rundot-syncplay`.
15
+
16
+ ### Action Required
17
+ Replace any usage of `Math.pow(x, y)` or `x ** y` in simulation code with `pow(x, y)`:
18
+ ```ts
19
+ import { pow } from '@series-inc/rundot-syncplay';
20
+ const result = pow(base, exponent);
21
+ ```
22
+
23
+ ---
24
+
25
+ ## 2. Stable Body Keys with O(1) Lookup (D2)
26
+
27
+ ### What Changed
28
+ - Physics body inputs now accept an optional `key?: string` in `createBody({ ..., key: 'chassis-root' })`.
29
+ - Keys must be non-empty, trimmed strings not exceeding 128 characters, and must be unique within the physics world.
30
+ - Worlds provide `world.resolveKey(key: string): PhysicsBodyHandle3D`, performing an $O(1)$ lookup to retrieve the current handle. If the key is not found, `world.resolveKey` throws `SyncplayError` with code `physics.handle-missing`.
31
+ - Query hits (`RaycastHit3D`, `ShapeCastHit3D`) and contact manifolds now annotate the resolved `bodyKey?: string` whenever a colliding body possesses a key.
32
+ - Key-to-body bindings are fully serialized in checkpoint trailers and restored bit-identically across rollback and resimulation.
33
+
34
+ ---
35
+
36
+ ## 3. SI Vector and Coordinate Helpers (D3)
37
+
38
+ ### What Changed
39
+ The root package entrypoint `@series-inc/rundot-syncplay` now provides enhanced `vec3` and `meters3` helpers:
40
+ - `vec3(x, y, z)` or `vec3([x, y, z])` or `vec3({ x, y, z }, scale?)`
41
+ - `meters3(x, y, z)` or `meters3([x, y, z])` or `meters3({ x, y, z }, scale?)`
42
+ These functions construct validated `PhysicsVector3D<Meters>` objects from three coordinate arguments, tuple arrays, or existing vector records with an optional uniform scaling factor.
43
+
44
+ ---
45
+
46
+ ## 4. Linear Velocity Retention Alias (D4)
47
+
48
+ ### What Changed
49
+ - Physics body inputs accept `linearVelocityRetention?: number` as an explicit semantic alternative to `linearDamping`.
50
+ - Worlds provide `world.setBodyLinearVelocityRetention(body, retention)` to update velocity retention at runtime.
51
+ - Specifying both `linearDamping` and `linearVelocityRetention` simultaneously throws `SyncplayError` with code `physics.definition-invalid`.
52
+
53
+ ---
54
+
55
+ ## 5. KCC Portal Diagnostics (D5)
56
+
57
+ ### What Changed
58
+ - Character controller traversal through portals now validates character dimensions against the aperture opening.
59
+ - If a capsule's radius or height exceeds the portal aperture, the KCC step blocks entry, zeros forward velocity toward the aperture plane, and emits a `'portal-blocked'` event with diagnostic reason `'capsule_larger_than_opening'`.
60
+
61
+ ---
62
+
63
+ ## 6. Partner Repro Suite & Provenance Tracking (E1, E2)
64
+
65
+ ### What Changed
66
+ - 26 partner repro fixtures are cataloged under `packages/syncplay/tests/fixtures/wreck-yard/` with cryptographic SHA-256 provenance tracking in `manifest.json`.
67
+ - Zero-tolerance CI tests enforce regression gates across all wall cases, latest-parity crossing frames, and rollback bit-identity.
@@ -0,0 +1,105 @@
1
+ # Migrating from Syncplay 6.0.0-rc.33 to rc.34
2
+
3
+ This release closes the rc.33 gaps that Wreck Yard reported and adds query,
4
+ vehicle, and portal work from the full request list. Each section names what
5
+ changes for a game and what does not.
6
+
7
+ ## Behavior changes
8
+
9
+ ### Portal host walls keep their own collision layers (A4)
10
+
11
+ Before rc.34, a portal host wall took one of the reserved layers 24 to 30, and
12
+ every body mask and every query layer mask silently included those layers. A
13
+ world could have at most 7 host walls.
14
+
15
+ From rc.34:
16
+
17
+ - A host wall keeps the layer and mask you gave it. `readBody(host).layer`
18
+ reports that layer.
19
+ - Body masks and query layer masks are exactly what you set. Layers 24 to 30
20
+ follow the normal rules. A body on layer 30 touches only bodies whose mask
21
+ includes layer 30.
22
+ - A query layer mask now applies to host walls like any other body. To hit a
23
+ host wall with a filtered query, include the host's layer.
24
+ - The number of host walls is limited only by body capacity.
25
+ - The step excludes contacts between a host wall and the bodies inside one of
26
+ its openings. Bodies outside an opening still touch the wall.
27
+
28
+ What to check: if a game relied on bodies on layers 24 to 30 touching
29
+ everything, give the other bodies masks that include those layers.
30
+
31
+ ### Portal checkpoints from rc.28 to rc.33
32
+
33
+ Serialized checkpoints that carry portal state now use portal trailer
34
+ version 2. A version 1 trailer (rc.28 through rc.33) stored the reserved host
35
+ layers and fails to restore with `physics.checkpoint-invalid`. Checkpoints with
36
+ no portal state have no trailer and restore as before. Rollback and late join
37
+ between peers on the same version are not affected.
38
+
39
+ ## Additions
40
+
41
+ ### Unit vectors from the physics entrypoint (D3)
42
+
43
+ Import `vec3` and `meters3` from `@series-inc/rundot-syncplay/physics/3d`.
44
+ The unit-typed form takes an optional scale:
45
+
46
+ ```ts
47
+ import { meters, vec3 } from '@series-inc/rundot-syncplay/physics/3d';
48
+
49
+ const offset = vec3(meters, [1, 2, 3], 0.5); // { x: 0.5, y: 1, z: 1.5 }
50
+ ```
51
+
52
+ The root exports stay as deprecated aliases of the same functions.
53
+
54
+ ### Body keys (D2)
55
+
56
+ - `PhysicsContactEvent3D` declares `bodyKeyA` and `bodyKeyB`.
57
+ - `PhysicsFluidInteraction3D` carries `bodyKey`.
58
+ - `world.resolveKeyId(key)` returns the live body id without reading the body.
59
+
60
+ ### Static checker (D1 follow-up)
61
+
62
+ `Math.sqrt` is allowed: IEEE 754 rounds it correctly in every engine. `pow`,
63
+ `hypot`, and `**` stay flagged.
64
+
65
+ ### Query index (B1)
66
+
67
+ Raycast, overlap, and shape cast use a spatial index. A query tests only the
68
+ bodies whose bounds overlap its own bounds, so its cost no longer grows with
69
+ far bodies. Hits, order, points, and normals are bit-identical to the linear
70
+ scan. `world.queryStats().testedBodies` reports the bodies the last query
71
+ tested. `queryIndex: false` in a world definition selects the linear scan.
72
+
73
+ ### Ray batches and the wheel layer mask (B3)
74
+
75
+ - `world.raycastBatch(queries)` runs 1 to 64 rays and returns each ray's hits.
76
+ The results equal separate `raycast` calls.
77
+ - `DeterministicVehicleDefinition3D.wheelCastLayerMask` lets the wheel rays
78
+ skip layers. A mask of `0xffffffff` gives the same results as no mask.
79
+
80
+ ### Vehicle step cost (C2)
81
+
82
+ The revision 2 vehicle step casts all wheels in one native call and reads its
83
+ support bodies in one batch. The tire solve is unchanged, and results are
84
+ bit-identical to separate reads.
85
+
86
+ ### Queries through portals (A3)
87
+
88
+ `shapeCast` and `overlap` now pass through open portals, like `raycast`. Hits
89
+ found through a portal carry `portalHops` and `portalPath`. A query that must
90
+ ignore portals sets `maxPortalDepth: 0`. The character controller already
91
+ handles portals itself and sets it.
92
+
93
+ ### Portal placement (A5)
94
+
95
+ `fitPortalEnd(world, { hostBodyId, point, normal, up, opening })` returns a
96
+ pose that fits fully on a static box host face, or null. Bodies take
97
+ `portalable: false`, and edits take `setPortalable(body, portalable)`.
98
+
99
+ ### Portal render helpers (A6)
100
+
101
+ Render-only helpers in `/physics/3d`: `portalTransformMatrix3D`,
102
+ `portalVirtualCameraMatrix3D`, `portalExitClipPlane3D`,
103
+ `portalPlaneInCameraSpace3D`, `portalObliqueProjection3D`, `planPortalViews3D`,
104
+ `portalPoseJumpBodyIds3D`, `interpolatePortalBodyPose3D`, and
105
+ `multiplyPortalMatrices`. They do not change the simulation.