Re:1500 Archers on a 28.8: Network Programming in Age of Emp...
by eloff on Monday January 16, 2023 @08:13AM
(#34400252)
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?
[ Parent
| on HN ]
Re:1500 Archers on a 28.8: Network Programming in Age of Emp...
by simmonmt on Monday January 16, 2023 @09:08AM
(#34400775)
Don'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.
Re:1500 Archers on a 28.8: Network Programming in Age of Emp...
by bsorbo on Monday January 16, 2023 @09:50AM
(#34401191)
Age 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/addr...
Re:1500 Archers on a 28.8: Network Programming in Age of Emp...
by magicalhippo on Monday January 16, 2023 @10:38AM
(#34401660)
Doesn'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....
Re:1500 Archers on a 28.8: Network Programming in Age of Emp...
by eloff on Monday January 16, 2023 @09:35PM
(#34408510)
Another 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.
Re:1500 Archers on a 28.8: Network Programming in Age of Emp...
by r3trohack3r on Monday January 16, 2023 @10:00AM
(#34401307)
Ditto - I use them to generate infinite mocks in GraphQL for local dev and staging: 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.