[ODE] Record and Playback
Martin C. Martin
martin at metahuman.org
Tue Jan 27 15:27:17 MST 2004
Marty Rabens wrote:
>>Why? All Intel CPUs and clones need to have 100% same behaviour, down
>>to the roundoff of the floating point. RTS games typically only send
>>user commands between computers, and rely on everything happening in
>>lockstep.
>
>
> Ahh, if only that were true. As a game developer, I absolutely love the
> idea of fixed interval updates and reproducible behavior.
...
> Unfortunately, different Intel CPUs and compatibles do NOT always give
> you identical results with floating point operations. I learned this
> the hard way when I relied on it for a 3D RTS.
That's funny, because that's how we did it on Star Trek: Armada. And
it's the way they'd done it before, on Dark Reign.
> I've done a little research, and it turns out that fp operations on
> different CPUs are IEEE compliant, but the IEEE standard allows CPUs to
> have differences in the precision of internal representation.
But the "real" standard is the user. If the user buys a non-Intel CPU
and is told it's "100% compatible," but then things don't work on it,
the user doesn't care about IEEE standards. They throw the machine in
the trash and bad mouth the company.
The differences you're describing sound more like bugs in the CPU design
than wiggle room in the standards. Remember the FDIV bug from a while ago?
> They're
> required to have a minimum of a certain number of bits for internal
> representation, but many (or most) CPUs have more than the minimum, but
> how MANY more varies. The upshot of all this is that you can
> occasionally get slightly different results on fp operations across
> different CPU's.
On the other hand, compilers offer options to save the results of all FP
calculations to RAM, which forces every computation to its minimum
number of bits, so that you don't get this. In gcc it's called
"--float-store," in MSVC it's called "improve floating point consistency."
In practice, relying on FP reproducibility & lockstep between machines
makes for a lot of headaches. Everything must depend only on state
that's shared between the two machines. Our network programmer spent
untold weeks (months?) sifting through logs, finding places where things
got out of sync. You have to be very careful about using "float store,"
and the fp precision/rounding modes, and saying the system requirements
are "Intel CPUs and 100% compatibles" rather than "Intel and AMD CPUs,"
and going at the speed of the slowest machine, etc. But as far as I
know, all RTSes do it, because you simply can't replicate the position &
orientation of 100 units to 3 other computers over a 56k phone line.
Not to mention that you'd open yourself up to all kinds of cheating.
- Martin
More information about the ODE
mailing list