Hello there devs. I'm a dev working on MEga-Glest (a fork of the awesome Glest game). I was wondering if anyone here knows how Spring deals with x-platform floating point issues? So that a binary compiled on linux and another on windows can work together even though floating point calcs are done differently on each platform?
Thanks
Request for help for another Open Source Game
Moderator: Moderators
Re: Request for help for another Open Source Game
Spring deals with this in four ways:
1) via a special library (streflop) that emulates FP operations in software and handles denormal/transcendental numbers in a standardized way; streflop injects its own float datatype into all synced code
2) by making all synced calculations use single-precision arithmetic only
3) by forcing the FPU control word to the same value on all clients
4) by allowing only a restricted set of architecture/optimization-specific compilation flags, and by building official (Windows) binaries only with a specific version of mingw-gcc
Even so, it is not guaranteed the simulation will remain synchronized across platforms that are not exactly the same in hardware and software signature (even disregarding engine bugs).
1) via a special library (streflop) that emulates FP operations in software and handles denormal/transcendental numbers in a standardized way; streflop injects its own float datatype into all synced code
2) by making all synced calculations use single-precision arithmetic only
3) by forcing the FPU control word to the same value on all clients
4) by allowing only a restricted set of architecture/optimization-specific compilation flags, and by building official (Windows) binaries only with a specific version of mingw-gcc
Even so, it is not guaranteed the simulation will remain synchronized across platforms that are not exactly the same in hardware and software signature (even disregarding engine bugs).
Re: Request for help for another Open Source Game
also, it works only for i386 compatible CPUs (i think).
to point 4 of Kloot: We currently use SSE1, as we decided CPUs without that wont be able to run online games anyway.
a side note:
the JVM (and probably other VMs too) modifies the FPU control word, and in case you call into it (using JNI), you will have to reset the FPU control word each time the call returns back into native code.
to point 4 of Kloot: We currently use SSE1, as we decided CPUs without that wont be able to run online games anyway.
a side note:
the JVM (and probably other VMs too) modifies the FPU control word, and in case you call into it (using JNI), you will have to reset the FPU control word each time the call returns back into native code.