Tutorial: (G)ZDoom multiplayer between Windows & Linux

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux

Post by Graf Zahl » Sat Feb 28, 2015 0:53

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.

Fincer
Posts: 12
Joined: Mon Feb 02, 2015 14:11

Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux

Post by Fincer » Sat Feb 28, 2015 2:12

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.

User avatar
Edward850
Posts: 63
Joined: Fri Mar 20, 2009 21:48

Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux

Post by Edward850 » Sat Feb 28, 2015 4:41

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.

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux

Post by Graf Zahl » Sat Feb 28, 2015 9:46

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.

Edward-san
Developer
Developer
Posts: 197
Joined: Sun Nov 29, 2009 16:36

Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux

Post by Edward-san » Sat Feb 28, 2015 15:32

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).

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux

Post by Graf Zahl » Sat Feb 28, 2015 16:13

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.

User avatar
Edward850
Posts: 63
Joined: Fri Mar 20, 2009 21:48

Re: Tutorial: (G)ZDoom multiplayer between Windows & Linux

Post by Edward850 » Mon Mar 02, 2015 2:02

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.

Locked

Return to “GZDoom”