jrouwe / JoltPhysics.js

Port of JoltPhysics to JavaScript using emscripten
MIT License
270 stars 21 forks source link

Cross-platform determinism for JS runtimes #172

Closed jeyum2 closed 5 months ago

jeyum2 commented 5 months ago

Does JoltPhysics.js guarantee cross-platform determinism? It seems like you're assuming determinism is applied in #22. If so, what is required for the JS runtime? In rapier.rs, IEEE 754-2008 compliance is required for determinism. Also, do the npm packages(wasm, asm) guarantee cross-platform determinism?

Thank you for nice work 👍

jrouwe commented 5 months ago

Currently JoltPhysics.js compiles without the JPH_CROSS_PLATFORM_DETERMINISTIC C++ define, which means it at least is not cross platform deterministic with native (non-JS) x86/ARM executables (changing this is easy though).

If the run-time offers IEEE 754-2008 compliance, I would expect the JS version to be deterministic when compared to the JS version running on other platforms even without the JPH_CROSS_PLATFORM_DETERMINISTIC define. There is currently no test verifying this though.