On Sunday, 20 November 2016 at 19:12:06 UTC, Chainingsolid wrote:
I planning out a game that has to use a lock step, peer to peer networking model to achieve multiplayer, and thus I need to have any floating point used produce the exact same results, no matter what, aka be completely deterministic. What would I need to do to achieve this?
I think you can roughly have that with ldc, always using SSE and the same rounding-mode. If you use the FPU then the excess precision will make things diverge. I've not compared the results across OSes but I get the exact same results across 32-bit and 64-bit.
Another way for deterministic FP is to round to a lower precision, or used fixed-point/integers.
If you use client prediction, and the server (authoritative) sends the correct player position to clients regularly (action game), then no determinism is actually needed. Ask Manu who knows more about this.