Page 2 of 2
Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux
Posted: Sat Feb 28, 2015 0:53
by Graf Zahl
I can tell you why GZDoom has these problems between Linux and Windows. Since floating point performance is critical for a hardware accelerated engine it uses a 'fast' floating point model that may yield different results with different compilers. This can result in floating point math being slightly different between those two. In addition there's no guarantee that the compilers will create the same code on both systems, especially if you compile Linux with SSE2 and Windows with x87 math.
Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux
Posted: Sat Feb 28, 2015 2:12
by Fincer
Allright, thanks for that valuable information! Pretty clear explanation. So basically only equally same (G)ZDoom compilations work between each other with 100% assurance. Any other combinations are likely doomed to desync at some point in the game.
Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux
Posted: Sat Feb 28, 2015 4:41
by Edward850
Not just same compilations, but same processors. The imprecise floats change how hardware FPUs produce the results (due to precision and rounding differences). This isn't as common in ZDoom.
I still wonder if software floats would have any definitive performance impact, because there really does need to be a solution to this.
Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux
Posted: Sat Feb 28, 2015 9:46
by Graf Zahl
I think the first step should be to remove all single-precision floats from the playsim. These are the most troublesome because of different compiler handling. But software emulated floats? Sorry, that'd be too slow if all places where float math is used had to run through an emulator.
I think the big issue is not that there may be minute differences in the least significant bit of floating point calculations but that single precision float math is inherently less precise than fixed point math.
Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux
Posted: Sat Feb 28, 2015 15:32
by Edward-san
It saddens me, but I suppose the solution is to use only the fixed point math in the playsim. Introduce a fixed64_t type for wider operations (the 'QWORD' annotation is unnatural, imho).
Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux
Posted: Sat Feb 28, 2015 16:13
by Graf Zahl
I think the first attempt should be to exchange floats for doubles throughout and see if that helps. It's quite a bit less work than removing float math entirely.
Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux
Posted: Mon Mar 02, 2015 2:02
by Edward850
Yikes, you're right. I thought it was all doubles to start with.
I'll go through and revise these functions. Hopefully that will improve these conditions.