So I’m working on a multiplayer game that involves generated levels. Currently, every client generates for himself, and I base generation on an announced seed to synchronize.
However, I assume differing system architecture might be a problem then because floating point numbers might not be in sync? Is this a scenario that is likely to happen or not?
The only way to avoid this completely that I see would be to only Random on the server, and send all the results to all clients - yuck!
Please clarify - is a seeded Random reliable for differing CPUs/Systems?
Unity’s Random (and I assume C#'s default Random) will spit out the same sequence of numbers for the same seed. Otherwise the seed would not be very useful.
Having the randomness on the clients sounds like a nightmare waiting to happen. Seeded Random generators give you random values in a fixed order. This means that you have to make sure that all of the clients ask for random numbers exactly as many times. It sounds a lot easier to send the result of a random event to the clients than to sync their random checks.
Thank you, That is great news for me! I actually made sure the sequence is safe, as it is truly sequential by nature, and also by wrapping Unity’s Random in a state safe version that is only used for the Generation process. That one safes the Randoms state after every call and restores it on the next call, so I can be sure that even if some other place calls Random, it won’t affect the outcome.