Overview
Deterministic Mode is a setting meant to bypass nondeterminism in the physics simulation introduced by hardware-related variations in computation time. Because video games are rendered at variable frame rates, and the simulation is advanced based on the time between those frames, multiple simulations of the same scenario can vary slightly due them being paced at nondeterministic rates. Deterministic Mode makes that rate constant, eliminating that source of randomness at the cost of possibly choppier graphics output.
Usage
This mode requires the frame limiter to be enabled in the graphics settings. To do so, navigate to Options > Graphics > FPS Limiter
and set it to a desired value. Standard monitors operate at a refresh rate of 60Hz, so 60 is a safe choice:
Once the FPS limiter is enabled, the actual deterministic mode can be set using the following Lua function:
be:setPhysicsSpeedFactor(factor)
Sets the physics timing between frames.
Args:
factor(int): The factor to set. Which mode the physics are running in are determined by the exact value passed. It boils down to:
- -1: Run 1000/fpslimit ms of physics per frame
- 0: Simulate physics time based on wallclock delta to the last frame
- n: Simulate n * 50ms of physics per frame (for any positive n)
Any nonzero input will make physics deterministic, as the times between steps is made constant and not tied to rendering times.
Returns:
nil
Note: Deterministic Mode is still work in progress. While the above settings will make physics deterministic, there can be other sources of nondeterminism specific to other aspects of the simulation.