Deterministic Javascript / Phaser 3

Hello, yesterday i saw this script: https://deterministic.js.org

“It’s useful for writing distributed applications in which the same code executes simultaneously on multiple computers… Two examples which make use of this property are smart contract applications and multiplayer games.”

So my question is, can i use this script to make Phaser 3 collisions become deterministic ? I’m trying to find where is the calculation for collisions in the Phaser 3 script but i don’t find anything. Please help me, i want to make my game deterministic.

Thank you very much.

Brief look shows that it doesn’t really handle much. Mostly just Math.random and Date things. There’s lot more to go into making things deterministic. You could handle these things easily yourself (Phaser already includes deterministic random generator).
The main issue is floating point determinism, which this doesn’t handle, and as far as I know, isn’t feasible to be solved apart from using integer operations as substitute (which would be much slower), or locking your determinism to fixed hardware (e.g. a specific console).

So tldr: no.

There are still benefits to partial determinism though. A very good article about it here: http://ithare.com/deterministic-components-for-interactive-distributed-systems-with-transcript/

1 Like