Page 1 of 1

Deterministic Solver

Posted: Sun Mar 06, 2011 2:27 pm
by mehwoot
Couldn't find this information anywhere- is the engine deterministic? Are there multiple solvers and some of them deterministic, or a way of enabling this?

Re: Deterministic Solver

Posted: Sun Mar 06, 2011 9:29 pm
by Norbo
Working within a single platform, the single-threaded version should be deterministic so long as the needed care is taken to control external variables. I would not suggest trying to ensure identical determinism across two different platforms, though. See here for more information: http://gafferongames.com/networking-for ... terminism/

The default multithreaded version is definitely not deterministic. Instead, it focuses on speed. If you disable multithreading on the BroadPhase and Solver, it should still be possible to get a deterministic simulation.

In v0.14.3 there is a second batched solver, which supports multithreading and should be deterministic. It is mostly implemented in v0.15.0, but it's not a very high priority- it has a high base performance cost such that for most simulations, it's hard to say it's a win over a single threaded solver (unless, perhaps, you had a huge number of objects and processor cores).

So long story short, if you can possibly avoid relying on strict determinism, do so. But with some sacrifices and extreme care, it should be possible to keep things deterministic (at least locally).

For networking where the amount of update data being sent is reasonable, it's usually easier to assume things will stay in sync sufficiently between periodic updates and perform corrections on any divergence. It's also still possible to do replays without relying on determinism. The simulation can be transformed into a compressed animation with as-needed keyframes. That animation can be fairly tiny and can be sent over the network if needed to act as a deterministic replay on other people's computers.