146 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
c96feaccea v1.4.3 2026-02-10 15:31:37 +03:30
Ali Shakiba
cbec05b7e8 v1.4.2 2025-06-01 21:33:59 +03:30
Ali Shakiba
23e89ec1f7 v1.4.1 2025-05-30 16:16:08 +03:30
Ali Shakiba
37414c7dad v1.4.0 2025-05-26 19:43:18 +03:30
Ali Shakiba
1c50a3f381 build v1.3.0 2024-12-28 02:03:06 +03:30
Ali Shakiba
7c400fa896 build v1.2.0 2024-12-24 20:11:59 +03:30
Ali Shakiba
0b31620212 build v1.1.6 2024-12-23 18:30:56 +03:30
Ali Shakiba
97b1a8387d v1.1.5 2024-12-19 23:15:21 +03:30
Ali Shakiba
a1753d5a1d build v1.1.4 2024-12-18 15:24:45 +03:30
Ali Shakiba
c11f0493f6 build v1.1.3 2024-12-18 14:17:43 +03:30
Ali Shakiba
71f4e5c286 v1.1.2: add body.setTransform(xf) signature 2024-12-03 22:19:17 +03:30
Ali Shakiba
0e58a85d1a v1.1.1: fix serializing chain with loop 2024-11-30 23:31:39 +03:30
Ali Shakiba
b4d7ffa0ee v1.1.0 2024-11-24 09:31:10 +03:30
Ali Shakiba
e5048fe80d
v1.1.0-alpha: vite build migration 2024-11-23 16:08:24 +03:30
Ali Shakiba
733e30b659 v1.0.9: fix exported internal.Settings and hide internal, stats 2024-11-19 12:57:40 +03:30
Ali Shakiba
0e0bef9c1e v1.0.8: lint 2024-11-18 11:29:36 +03:30
Ali Shakiba
55a9b170d2 Build v1.0.7: testbed minor update 2024-11-17 23:03:44 +03:30
Ali Shakiba
9e20146bc5 Build v1.0.6: use es5 stage.js 2024-09-30 23:38:39 +03:30
Ali Shakiba
4b6d6ec0ab build v1.0.5 2024-08-17 01:40:15 +03:30
Ali Shakiba
0d2efe6ae0 replace vec2 with vec2value in the api, update docs 2024-05-23 23:07:21 +03:30
Ali Shakiba
f089bb0c66 use new stage version 2024-04-24 23:38:42 +03:30
Ali Shakiba
2b0dd3d0e9 build 1.0.2 2024-03-13 16:49:16 +03:30
Ali Shakiba
6de9126f75 build 1.0.1 2024-01-01 20:01:49 -08:00
Ali Shakiba
282c3fac45 build v1.0.0 2023-12-30 16:09:06 -08:00
Ali Shakiba
041726a83f build v1.0-beta.20 2023-12-26 19:39:48 -08:00
Ali Shakiba
0a2556722b build beta.18 2023-12-25 19:04:39 -08:00
Ali Shakiba
eade1934a0 build v1.0.0-beta.18 2023-12-24 23:22:20 -08:00
Ali Shakiba
4de71d9038 build v1.0.0-beta.17 2023-12-24 22:33:09 -08:00
Ali Shakiba
820f6105d7 fix setMassData 2023-09-09 11:54:00 -07:00
Ali Shakiba
6b3113eb57 build v1.0.0-beta.15 2023-08-26 16:42:08 -07:00
Ali Shakiba
4a54360b54 build v1-beta.14 2023-08-26 11:56:32 -07:00
Ali Shakiba
ee8785ff30 build v1-beta.13 2023-08-24 12:29:59 -07:00
Ali Shakiba
57d8126998 remove old build files 2023-08-24 11:55:03 -07:00
Ali Shakiba
33eabb680c build v1-beta.12 2023-08-23 21:58:00 -07:00
Ali Shakiba
9d86ecc65b convert MassData to interface 2023-08-23 02:34:55 -07:00
Ali Shakiba
d43d2c1919 update api doc 2023-08-22 12:40:19 -07:00
Ali Shakiba
a971fb7908 refactor testbed api 2023-08-20 09:23:47 -07:00
Ali Shakiba
ce047fa2e9 build v1.0-beta.9 2023-08-16 19:50:00 -07:00
Ali Shakiba
2b297519d9 update build v1-beta.8 2023-08-11 09:54:13 -07:00
Ali Shakiba
277f60eb13 update build v1-beta.7 2023-08-11 08:15:49 -07:00
Ali Shakiba
2ca89b0ad2 update stage.js version 2023-08-06 19:55:25 -07:00
Ali Shakiba
1a4b19d3ee fix build, js files default to esm 2023-08-06 19:16:45 -07:00
Ali Shakiba
39a983b7c5
make build backward compatible (#245) 2023-08-01 14:30:08 -07:00
Ali Shakiba
cbfba8ccc8
typescript testbed and vite build (#244) 2023-07-31 21:47:06 -07:00
Ali Shakiba
499075d715
refactor exports and add esm export (#243) 2023-07-31 19:35:10 -07:00
Oliver Zell
3b262124ce alpha.4 2022-03-29 12:23:36 +02:00
Oliver Zell
1229528e05 alpha.3 2022-01-23 09:51:49 +01:00