Changes between Version 1 and Version 2 of SimulationRequirements


Ignore:
Timestamp:
Nov 1, 2009, 6:25:15 PM (15 years ago)
Author:
Philip Taylor
Comment:

remove incorrect speculation on SpiderMonkey 64-bit differences

Legend:

Unmodified
Added
Removed
Modified
  • SimulationRequirements

    v1 v2  
    2121By "determinism", we mean that given a certain simulation state, and a certain sequence of inputs, and a certain set of scripts and data files, the subsequent simulation states are precisely determined. (That is, the simulation should not be affected by external inputs, timings, hardware, OS, compiler settings, etc). That's necessary for the multiplayer system to work.
    2222
    23 Guaranteeing determinism in JS seems to be infeasible. E.g. 32-bit and 64-bit versions of !SpiderMonkey probably(?) have different ranges for integers, and a script could detect whether the interpreter switched from ints to doubles for large numbers. It would also require much stricter isolation between simulation and GUI, making any interactions more complex.
     23Guaranteeing determinism in JS seems to be very hard to do perfectly, e.g. scripts could trigger out-of-memory errors that vary between instances of SpiderMonkey. It would also require much stricter isolation between simulation and GUI, making any interactions more complex.
    2424
    2525The goal should instead be to ensure non-malicious scripts will be deterministic, by minimising the opportunities for non-determinism. `Math.random` should be replaced with a network-synchronised RNG. Trigonometric functions should be carefully examined, and modified or removed, if they are not consistent between platforms. Any engine functions exposed to scripts must take care of determinism themselves.