C7-Game / Prototype

An early-stage, open-source 4X strategy game
https://c7-game.github.io/
MIT License
34 stars 9 forks source link

Log the seed, and allow setting the seed in the UI #335

Closed QuintillusCFC closed 1 year ago

QuintillusCFC commented 2 years ago

One of the things I've wished we had multiple times was the ability to look up the seed after the fact. Play a game, often just watching the AI, and see something interesting, but not being able to recreate it is unfortunate.

Civ3 does this by storing the seed in conquests.ini.

Either "New Game" or "Quick Start" should default to the last seed and allow you to set one. Probably New Game should let you enter the seed; this can be the first part of our "New game setup" screens.

Technically, my guess is we'll have to log randomly-generated seeds by generating them and then passing them in to the random component, as it doesn't seem like there's a way to extract a seed from a Random generated without any parameters. I could be wrong about this (and it's different in Java), but there doesn't seem to be such an API.

Sean-Brown commented 2 years ago

I'm wondering if this feature should be more of a "play/load last settings" feature? Don't the settings such as landmass, water percentage, climate, etc. affect how the seed generates the map? A couple times I've wanted to play the last seed but forgotten/not known (due to "random" setting) what the other parameters were, so I couldn't reproduce the world without pain of trying lots of combinations.

WildWeazel commented 2 years ago

Yes and yes, ultimately it should remember all of the settings. Since we're not generating maps yet, our seed is only relevant for the in-game RNG so far. Come to think of it, is the map seed the same as the RNG seed in Civ3? I don't think so, but maybe if you check "preserve random seed".

BTW if you have a save, you can use Jim's Civ3 Show-And-Tell (civ3sat) to print out the other map parameters.

QuintillusCFC commented 2 years ago

Play/load last settings is nice too, but having the seed also allows retroactive debugging. E.g. It's 11:42 PM and I notice a bug but am too tired to investigate, if I write down the seed I could re-generate the situation later, even if I forget about it the next day and generate a new seed in the meantime.

I'd always thought of there just being one seed in Civ3, but considering that if you don't check "preserve random seed", you can get "new" ones in-game, but civ3sat can still extract the map seed, they must in fact be separate. This could also be confirmed via starting two games with the same map-generation seed (and the same settings) and seeing if it played out exactly the same when the human did the same things. The current theory is it would not play out the same.