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
[Bug]: World generation seed from openttd.cfg is ignored #9433
Comments
The way I read genworld.cpp near line 95, the intended behavior is like this:
However, somehow, OpenTTD seems to rewrite the "generation_seed" on some occasions (game closing?), with a seemingly random value (which is not the previous seed value nor is it UINT32_MAX). This might be linked to this bug. |
Line 96 in f4dd2d8
That line is a bit weird .. we shouldn't be changing Edit: there are a few more places that set the |
genworld_gui.cpp at line 980 seems to be the culprit, setting Unfortunately, if generation_seed is set to 4294967295 (i. e. UINT32_MAX), this will lead to a random seed being used for the next world generation (as intended) but the generation_seed will be overwritten after that, and from then on OpenTTD will spit out the same map over and over again. |
Cross-post from #9435 for visibility: The more I think about this, the more I think generation_seed shouldn't be stored in openttd.cfg. It makes very little sense to store it there to me. Let me explain my thinking: You can use -G on startup to force a seed. This I can fully understand, as that is something people sometimes want to do. Other than that .. there are very few usecases where you want to force a seed. I can understand that you want to enter a seed number when you start a game .. but other than that .. it should always be a random value. Why storing it in openttd.cfg is weird to me: if you ever by accident put a number in there that is not GENERATE_NEW_SEED, and looking at this PR many people already have that now in their openttd.cfg, you will always get the same map over and over and over and over and over again, without clear feedback why this is the case. So the more I think about it, the less sense it all makes. Either way, that does result in a real problem with this PR: as many people have non-GENERATE_NEW_SEED in their openttd.cfg, this PR would make my example a reality: maps will be very static all of a sudden for a lot of people :) Maybe we should approach this problem differently, and put the seed in the "New Game" menu as many games do. And a "randomize" next to it. And always randomize it on opening the GUI. That way people who want a fixed value can fill it in there. But that is just one opinion; I would love to hear others :) |
As it is, -G apparently doesn't work either. |
|
All of these sound very logical to me too. My feeling is that this may one day become a reality in the game, so i'd like to add a small request here. It would be very useful if the seed given at startup would be visible somewhere after the game has started (perhaps in the About box?), so it would be easier for someone who wishes to replay the specific seed. |
Hi all, how to set the generation_seed that game always generate new seed map after restart a game on dedicated server? Thanks! |
I was having the same issue on my dedicated server, I fixed it by using the "on_dedicated.scr" script, with the command "newgame". Upon restarting, it will trigger the newgame command, which forces a random seed. |
As far as I can tell, that used to be the case in older versions of OpenTTD (before 775c96a or release 1.5). |
Version of OpenTTD
master @ commit f4dd2d8, Windows 10 x64
Expected result
Setting the parameter "generation_seed" in the "game_creation" section of openttd.cfg should lead to OpenTTD using the provided seed for game creation.
Actual result
World generation ignores the "generation_seed" parameter.
Steps to reproduce
The text was updated successfully, but these errors were encountered: