779 Commits

Author SHA1 Message Date
11e53383c7 feat: deterministic natural logarithm
The rocket equation produces par-fuel and delta-v figures that ship inside
level data. A value that differs between platforms is the same class of bug
as a desynced replay, so log belongs in the kernel rather than falling back
to the host libm.

Reduce x = m*2^k with m in [2/3, 4/3), then ln(m) = 2*atanh((m-1)/(m+1)).
Accurate to <1e-13 against the host libm across the tested range.
2026-09-15 01:05:10 +03:00
4c82aabc5d feat: deterministic cross-platform math kernel
Replaces every host-libm call in the physics source with a kernel built from
IEEE-754-exact operations only, so simulation results are bit-identical on
ARM64/JavaScriptCore and x86-64/V8.

ECMAScript permits Math.sin/cos/atan2 to be implementation-dependent
approximations, and Rot.setAngle and Sweep.getTransform call them for every
rotating body on every step. Without this, a replay recorded on mobile does
not reproduce on desktop, which breaks replay verification and leaderboards.

- add src/common/DeterministicMath.ts (fdlibm-derived polynomials and
  Cody-Waite range reduction, plus a seeded mulberry32 PRNG)
- rewire the nine hoisted aliases in Math, Matrix, Rot, Sweep and
  dynamics/Position; no host libm call remains in src/
- export DeterministicMath and seedRandom for consumers
- add determinism tests, incl. a free fall matching the analytic solution

All 14 upstream tests still pass (22 total).
2026-09-15 00:52:19 +03:00
Ali Shakiba
93dd64df0f v1.5.0 2026-04-07 15:59:37 +03:30
Ali Shakiba
6ede4f3d2d Publish add-body, add-fixture, add-joint events 2026-04-07 15:16:03 +03:30
Ali Shakiba
86c9079d69 Remove hasVertex0 and hasVertex3 from serialize Edge 2026-04-07 15:15:48 +03:30
Ali Shakiba
7791ea1f1b Remove temp fields from distance-joint serialization 2026-04-07 15:15:40 +03:30
Ali Shakiba
9415379691 Add fixedRotation to body serialize 2026-04-07 15:15:31 +03:30
Ali Shakiba
4fc10a7fee In polygon and chain deserialize use Vec2Value 2026-04-07 15:14:59 +03:30
Ali Shakiba
c96feaccea v1.4.3 2026-02-10 15:31:37 +03:30
Ali Shakiba
0bba3b2911 Bug fix addVec2 2026-02-10 15:30:00 +03:30
Ali Shakiba
f6d90c2703 Cleanup eslint, upgrade dev deps 2026-02-08 23:08:31 +03:30
Ali Shakiba
83e5f622be remove api doc, ignore docs/dist 2026-02-08 20:15:49 +03:30
Ali Shakiba
18a00bdcf6 use vitepress 2026-02-08 20:00:27 +03:30
Ali Shakiba
cdbf302d41 update docs 2025-10-21 14:05:17 -05:00
Ali Shakiba
3b561c1880 fix example 2025-06-06 07:21:41 +03:30
Ali Shakiba
724e410c8f fix example 2025-06-01 21:38:46 +03:30
Ali Shakiba
cbec05b7e8 v1.4.2 2025-06-01 21:33:59 +03:30
Ali Shakiba
9343ffc8ec fix testbed drawing 2025-06-01 21:32:45 +03:30
Ali Shakiba
be9b789942 clean up assert and unused statements 2025-06-01 11:24:41 +03:30
Ali Shakiba
3aee543586 fix testbed page 2025-06-01 11:03:05 +03:30
Ali Shakiba
23e89ec1f7 v1.4.1 2025-05-30 16:16:08 +03:30
Ali Shakiba
d12d0cc9df fix shape name export 2025-05-30 16:14:31 +03:30
Ali Shakiba
54cfa2d206 add setup and teardown to benchmark 2025-05-29 21:14:22 +03:30
Ali Shakiba
37414c7dad v1.4.0 2025-05-26 19:43:18 +03:30
Ali Shakiba
97e4fcd011 change changesets scripts 2025-05-26 19:41:16 +03:30
Ali Shakiba
75ece37751 pretty code 2025-05-26 19:41:12 +03:30
Ali Shakiba
0dcc98b053 split TestbedInterface and Testbed class 2025-05-26 19:41:05 +03:30
Ali Shakiba
e1a271755d mark serialize and deserialize as hidden instead of internal 2025-05-26 17:31:08 +03:30
Ali Shakiba
3446820c88 fix aabb raycast 2025-05-26 17:25:07 +03:30
Ali Shakiba
1999deb142
fix typo in contacts doc 2025-04-28 15:18:15 -05:00
Ali Shakiba
02600898af update docs 2025-04-14 21:28:32 +03:30
Ali Shakiba
ffc8cb316d change local dev testbed url format and handling 2025-04-13 13:24:34 +03:30
Ali Shakiba
f628eabc36
Update limitations.md 2025-02-10 01:31:52 +03:30
Ali Shakiba
6cfb385214 update docs, use object literal 2025-01-29 19:25:02 +03:30
Ali Shakiba
8416d7b516 Add playground link to docs 2024-12-28 02:26:06 +03:30
Ali Shakiba
1c50a3f381 build v1.3.0 2024-12-28 02:03:06 +03:30
Ali Shakiba
ce1c486efa No pointer interaction when mouseForce===0 2024-12-28 02:00:31 +03:30
Ali Shakiba
56193e788c Add DataDriver (experimental) 2024-12-27 22:42:56 +03:30
Ali Shakiba
bb9bb873fc Testbed rendering rewrite 2024-12-27 22:41:01 +03:30
Ali Shakiba
7c400fa896 build v1.2.0 2024-12-24 20:11:59 +03:30
Ali Shakiba
97bb79eb94 Improve queueUpdate 2024-12-24 20:09:56 +03:30
Ali Shakiba
4b06bb31bd Unify createFixture usage in examples 2024-12-24 19:58:07 +03:30
Ali Shakiba
f0127f4fe6
Add world.queueUpdate 2024-12-24 17:41:58 +03:30
Ali Shakiba
5b611d70fb Unify createBody usage in examples 2024-12-24 15:07:16 +03:30
Ali Shakiba
3b496b846c migrate examples to Vec2Value 2024-12-23 18:57:15 +03:30
Ali Shakiba
0b31620212 build v1.1.6 2024-12-23 18:30:56 +03:30
Ali Shakiba
922ff97583 Add static Vec2.normalize 2024-12-23 18:29:40 +03:30
Ali Shakiba
bee0e1609a Change clampVec2 arg to Vec2Value 2024-12-23 18:25:46 +03:30
Ali Shakiba
fe31a9101e fix api docs links 2024-12-20 15:08:27 +03:30
Ali Shakiba
97b1a8387d v1.1.5 2024-12-19 23:15:21 +03:30