-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monsters are not replicable with same seed #2856
Comments
Do you have random reseeding enabled? Are there AI empires? |
Random reseeding enabled, AI empires present. Edit: for some reason, I thought random reseeding had to be enabled (checked) to get consistent results. After reading the tooltip, I see it should be disabled to get the same sequence of random numbers and more repeatable games. However, I have started 3 games with random reseeding enabled and another 3 games with it disabled, and I got not once the monsters on the same positions (they are similar sometimes, but there is always some differences, not only names but type of monster). |
AFAIK that has always been a problem. While we managed to get the same map on all platforms when using the same seed, monster placement can't be reproduced. The problem is that, when it comes to monster and monster nest placement, not everything is done by the universe generation scripts, but also by FOCS effects on turn 1. As effect execution is multi-threaded, the order in which effects are executed isn't strictly determined, making it impossible to get the same results from the RNG on each run. We've yet to find a solution to this problem. |
You can set the server options to use just one thread for effect evaluation. |
Would that affect performance?
Could the effects be executed by a fixed and know number of threads (independent of multithreaded capabilities of the local system) and be instantiated sequentially in a fixed and known order with each of them getting a (different) seed determined by the galaxy seed so that RNG used in each thread produces a known sequence of random numbers that does not depend on the order in which the threads are executed/mixed? Sorry for the long sentence. It makes me think of David F. Wallace and Thomas Bernhard. |
Possibly, but the threads aren't operating on independent gamestates, so inconsistent and unpredictable timing issues could occur even if each thread generates random numbers independently from all the other threads' random number generation. |
I am aware that the problem of thread schedulers and reproducible "randomness" has been tackled by using a different design from traditional PRNGs. Notably, so-called "splittable" PRNGs have been developed for use in "isolated parallel computations that may generate subtasks", such as event processing that could be done by individual threads:
Essentially, splittable PRNGs give each task its own PRNG, rather than using global or thread-local PRNGs. In this case, a unique PRNG could be passed to Python's
|
It should. If it didn't, having multithreaded effect evaluation would be pointless. |
Environment
Description
The location of monsters and monster nests at game start are not replicable using the same seed and galaxy settings (including Experimentors enabled/disabled).
Expected Result
The starting location of monsters and nests should depend on galaxy seed and settings, so that games can be replicated without a save file.
Steps to reproduce
The text was updated successfully, but these errors were encountered: