3 ms·
The random numbers I understand, because I’ve used a similar principle to make tests deterministic. The trick is to make the same number of calls to the generat
by eloff 4y ago
The random numbers I understand, because I’ve used a similar principle to make tests deterministic. The trick is to make the same number of calls to the generator and use the same seed. The floats are really thorny though, differing subtly across CPUs. Did they just rely strategically on rounding? Make heavier use of integers?
- simmonmt 4y agoDon't use floats (it wasn't a 3D game) or if you have to, make sure every float is derived from an integer that's kept in sync. And don't do anything that affects simulation state based on those floats.
- bsorbo 4y agoAge of Empires 2: Definitive Edition consistently de-syncs when playing across a M1 Mac (using Windows 11 Arm or Crossover) and an x86 machine, and I suspect the difference in floating point behavior described here is the culprit: https://developer.apple.com/documentation/apple-silicon/addressing-architectural-differences-in-your-macos-code https://developer.apple.com/documentation/apple-silicon/addr...
- magicalhippo 4y agoDoesn't sound unlikely. LHC@Home had big issues[1] with AMD and Intel machines giving very different results to the same work unit. They traced it down to the exp() function behaving different, and ended up using a library[2] for anything more fancy than basic arithmetic. [1] https://lhcathome.web.cern.ch/sites/default/files/OPENshort.pdf https://lhcathome.web.cern.ch/sites/default/files/OPENshort.... [2]: https://github.com/SixTrack/crlibm https://github.com/SixTrack/crlibm
- eloff 4y agoAnother reason for me to stay clear of the M1 for now. It’s really fascinating, but it’s not quite there yet. I’ll let others work the rough edges away before I give it a try.
- r3trohack3r 4y agoDitto - I use them to generate infinite mocks in GraphQL for local dev and staging: http://www.blankenship.io/essays/2022-11-30/ http://www.blankenship.io/essays/2022-11-30/ The id of the node acts as the deterministic seed. Really handy when building views that slice and dice data, it feels like you’re interacting with a database.