Page 1 of 1
Cross platform multiplayer
Posted: 30 May 2008, 05:54
by revcompgeek
I own a PowerBook G4 that I play spring on. The only other computer in the house is a Vista computer and I would like to play multiplayer. I understand the endianness issues with PPC and x86. How hard would it be to add endian switching code into the networking code for the PPC version? Does someone have code for the Mac version or can I just use SVN for Mac modifications?
Re: Cross platform multiplayer
Posted: 30 May 2008, 06:12
by Peet
Aside from the endian issues, a G4 has a significantly different architecture from an x86 processor, which results in differences in FPU math results. The two are unable to maintain a synchronized simulation because of this.
Re: Cross platform multiplayer
Posted: 30 May 2008, 07:05
by revcompgeek
In other words, the networking code would have to be re-written to allow for cross-architecture multiplayer. Is the current networking transmitting raw objects?
Re: Cross platform multiplayer
Posted: 30 May 2008, 07:07
by revcompgeek
Just a thought: if I used qemu usermode to run spring, would that fix the issues? It probably wouldn't run fast enough anyway.
Re: Cross platform multiplayer
Posted: 30 May 2008, 10:29
by Acidd_UK
revcompgeek wrote:In other words, the networking code would have to be re-written to allow for cross-architecture multiplayer. Is the current networking transmitting raw objects?
AFAIK, the networking code transmits the player's commands (e.g. "move unit 53 to position 10234,54654"). Because all clients execute that command in the same game simulation frame, the result of the command on all clients is the same. If you change architechture, then your floating point calculations may come out (slightly) differently, leading ot the game states diverging (desync).
Re: Cross platform multiplayer
Posted: 30 May 2008, 14:13
by jackoverfull
revcompgeek wrote:Just a thought: if I used qemu usermode to run spring, would that fix the issues? It probably wouldn't run fast enough anyway.
theoretically it will work, but i doubt that the game will be playable: it's barely usable as it is, on my ibook├óÔé¼┬ª
the game code still needs a lot of things to be enabled to run as it should on non x86 archs├óÔé¼┬ª
Re: Cross platform multiplayer
Posted: 30 May 2008, 19:10
by revcompgeek
Acidd_UK wrote:AFAIK, the networking code transmits the player's commands (e.g. "move unit 53 to position 10234,54654"). Because all clients execute that command in the same game simulation frame, the result of the command on all clients is the same. If you change architechture, then your floating point calculations may come out (slightly) differently, leading ot the game states diverging (desync).
I am tempted now to write some identical code on Mac and PC (as much as possible) to test how different the floating point calculations are. It doesn't make sense that the calculations would be even slightly different, because then the calculations wouldn't be accurate, but I guess it could be differences in rounding.
Re: Cross platform multiplayer
Posted: 30 May 2008, 19:18
by Peet
Floating point operations, by definition, are not 100% accurate. See
this.
edit: very related:

Re: Cross platform multiplayer
Posted: 30 May 2008, 19:36
by revcompgeek
Ahh, that makes sense. I guess the only alternative is using GMP or MPFR, or running it in qemu-user. Using GMP or MPFR has the disadvantage of being slow and will be hard to change in the code, and qemu-user has the problems of being slow and that I can't compile it on my Mac. Grrr.