Page 1 of 1

Determinism

Posted: 09 Feb 2023, 15:02
by Heartman
Hi,

I am wondering how SpringRTS maintains determinism while it uses Streflop? Because Streflop mentions:

"If you want to use the hardware FPU in a controlled environment that can retain some reproducibility, then use this library."

So it seems it is not 100% deterministic, does this mean that things can get desynced during a regular network game for example?

Re: Determinism

Posted: 09 Feb 2023, 23:25
by Beherith
In practice is has worked quite well for us in the past 15 years.

Re: Determinism

Posted: 10 Feb 2023, 09:51
by Heartman
That's great!

I read on a blog that it was quite hard to implement was that in getting streflop to produce the desired results or in getting the Spring code to properly use it?

Re: Determinism

Posted: 10 Feb 2023, 17:10
by TarnishedKnight
Determinism is a larger subject than just FPU-issues. For BAR we're using SSE in preference to x87, which tends to have fewer configuration conflicts. The engine regularly checks that the hardware FPU settings are correct and will flag when they are not. We haven't seen any such warnings being raised.

I recall claims from some developers in the past that you cannot achieve a deterministic simulation using hardware floating-point math, but then they seemed to be oblivious to Spring (and Supreme Commander.) They would likely claim you can't multi-thread either, but we have done that as well and it is working well for us.

Re: Determinism

Posted: 13 Feb 2023, 21:33
by Heartman
Yeah that's what made me wonder, nice that it worked out!