Thread overview
Making floating point deterministic cross diffrent platforms/hardware
Nov 20, 2016
Chainingsolid
Nov 20, 2016
ketmar
Nov 20, 2016
Guillaume Piolat
Nov 20, 2016
ketmar
Nov 20, 2016
Ilya Yaroshenko
Nov 20, 2016
Chainingsolid
Nov 20, 2016
Guillaume Piolat
November 20, 2016
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?
November 20, 2016
write your own software fp library. this is the only way to cover all your broad cases.
November 20, 2016
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.
November 20, 2016
On Sunday, 20 November 2016 at 21:31:09 UTC, Guillaume Piolat wrote:
> I think you can roughly have that with ldc, always using SSE and the same rounding-mode.

ARM. oops.
November 20, 2016
On Sunday, 20 November 2016 at 21:31:09 UTC, Guillaume Piolat wrote:
> 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.

I'm making an rts so the client/server model would require very unrealistic bandwidth, hence the lock step peer to peer system.
November 20, 2016
On Sunday, 20 November 2016 at 21:42:30 UTC, ketmar wrote:
> On Sunday, 20 November 2016 at 21:31:09 UTC, Guillaume Piolat wrote:
>> I think you can roughly have that with ldc, always using SSE and the same rounding-mode.
>
> ARM. oops.

No problem with ARM + x86 for double and float.
November 20, 2016
On Sunday, 20 November 2016 at 22:36:12 UTC, Chainingsolid wrote:
> I'm making an rts so the client/server model would require very unrealistic bandwidth, hence the lock step peer to peer system.

Indeed, peer to peer require determinism I guess.