Sid Meier's Civilization VI

Sid Meier's Civilization VI

View Stats:
jimmerseia Nov 5, 2017 @ 11:37am
Random seed?
Is there any way to change the random seed on reloads? I know you can blank out the fields in advanced startup, but that only applies to the very first turn. From then on, it's clearly using the same chain of seeds.
< >
Showing 1-15 of 15 comments
terry Nov 5, 2017 @ 11:54am 
Im guessing you are using the save/load configuration options. I dont really use that simply because when i start a new game i play a different civ and different map settings so i would have to change that stuff anyways. So im not sure this will help you but once youre in the game, go to the menu and clicking the restart button should give you a new map seed.
jimmerseia Nov 5, 2017 @ 1:38pm 
I am using the config stuff, but I tried it without it, too.

The game saves the seed chain completely once you've saved the game (or startup configuration). This includes even the amount of damage done in various combats, the results of goody huts, and even the movement of barbarians.

I'm trying to learn the game's ruleset by going back to saved games and replaying them, to see what happens. The only time a new seed is used is when I choose to do something different. Which is really strange, because why would my choosing animal husbandry over mining even be known to the barbarians or other civs? Yet, they change their moves (etc.) if I make a change like that. Or, if I take a different path with my warrior (that they can't see); it takes them down a different decision tree.

This is yet another example of something that existed in previous versions, SHOULD exist in this version, but doesn't appear to be there in VI. I'm just hoping I missed it.
Kyl Nov 5, 2017 @ 2:26pm 
You can type in new random seeds when you load a saved configuration. Just type in some random number from google's random number generator.
jimmerseia Nov 5, 2017 @ 3:03pm 
I guess I wasn't clear: I know about the random seeds in saved configurations. That's not what I'm referring to.

The problem is that if you revert to a saved GAME (not configuration), the game will play out exactly as it did the first time you played through it. In other words, the random seed each game starts with remains in place for the life of the game, regardless of whether you revert to a saved game or which saved game you revert to.

This is a very basic programming error. Any developer should know how to avoid this (or force it, should that be the desire).

In fact, Civ V had a checkbox for whether you wanted it on or off. It's like the hired a whole different development staff, and burned the notes from previous versions.
Kyl Nov 5, 2017 @ 3:05pm 
Oh right, I see what you mean. Yea, stuff happens exactly the same as it did before you reloaded. I too wish there was an option for new random seeds like in Civ 5.
jimmerseia Nov 5, 2017 @ 3:19pm 
I guess I should explain this more. Random numbers on a computer aren't random at all. They are what's called "pseudo-random". That means there is a sequence that will be followed from one "random" number to the next.

Algorithms are used to generate a list of "random numbers". But, from any starting "random" number, the list will always be identical going forward.

I'll give an example using only single-digit numbers (and none of the numbers repeat). Let's say the algorithm produces this list:

2 7 4 9 3 5 0 1 6 8

The sequence used in computers has a lot more numbers, but the key is that the list repeats itself. So, if I start with 2 in my list, it will always follow the pattern 2 7 4 9 3 5 0 1 6 8 2 7 4 9 3 5 0 1 6 8 (etc.) But, if I start with 9 instead, the list goes 9 3 5 0 1 6 8 2 7 4 9 3 5 0 1 6 8 2 7 4.

The value I started with (2 and 9, which are in positions 1 and 4 in the sequences) are called the "seed". No matter what seed I choose, the list will always go back around on itself.

Programs that use "random" numbers (like Civ) have algorithms generate the sequence, and the sequence is huge ("billions" of numbers would be grossly inadequate to describe them).

If you start with any given number, the sequence will always be identical. Thus, games will play out in exactly the same sequence of random choices made.
Kyl Nov 5, 2017 @ 3:47pm 
I know you're just giving a quick summary of how it works, but I just had two comments.

Originally posted by jimmerseia:
I'll give an example using only single-digit numbers (and none of the numbers repeat).

Why can't they repeat in your example? The sequences generated are designed so that they mimic the statistical properties of random number sequences, so the sequence can be 2 3 1 9 2 9 8 1 3 1 6 4 7 .... etc. and then at some point it wraps back around to ... 2 3 1 9 2 9 8 1 3 1 6 4 7.. etc.

Originally posted by jimmerseia:
The value I started with (2 and 9, which are in positions 1 and 4 in the sequences) are called the "seed".

Its a bit misleading to say if your random seed is 2 that you start wherever the number 2 is. Its more like what you were say about the position numbers. If your seed is 2, you start in the sequence at position 2 (at the number 4 in your example with a zero-based index).
Last edited by Kyl; Nov 6, 2017 @ 8:06am
jimmerseia Nov 5, 2017 @ 8:09pm 
Originally posted by MadManCam:
I know you're just giving a quick summary of how it works, but I just had two comments.

Originally posted by jimmerseia:
I'll give an example using only single-digit numbers (and none of the numbers repeat).

Why can't they repeat in your example? The sequences generated are designed so that they mimic the statistical properties of random number sequences, so the sequence can be 2 3 1 9 2 9 8 1 3 1 6 4 7 .... etc. and then at some point it wraps back around to ... 2 3 1 9 2 9 8 1 3 1 6 4 7.. etc.

Originally posted by jimmerseia:
The value I started with (2 and 9, which are in positions 1 and 4 in the sequences) are called the "seed".

Its a bit misleading to say if your random seed is 2 that you start wherever the number 2 is. Its more like what you were say about the position numbers. If your seed is 2, you start in the sequence at position 2 (at the number 4 in your example with a zero-based index).

Otherwise, a good explanation of how random seeds work and why the same exact stuff happens if you start with the same seed.
They can repeat, if the algorithm allows for it. But, typically, they don't, because it's much easier to code for. Plus, you can debug "random" problems. (pun intended)

That's why prime numbers are so important to cryptography: the easiest algorithms to code use a formula with one prime number raised to a power that's another prime number (and a few other terms). If that one prime number is 2, it works almost like magic on a computer, because computers use nothing but zeros and ones. So, the math can take advantage of the architecture built into every computer's hardware, if they choose their number "nicely" (for them).

Typically, though, the numbers are really REALLY large, and the "random" number delivered to the program is just part of that individual number's digits. For example, maybe the specific random number is 12345678901. But, for a program, they might grab just the digits in every other position.

Now, if you have a billion numbers, nobody really checks to make sure there are no duplicates. It just falls out of the formula.

Interestingly, not only are there no duplicates, but every number in the range will eventually be used. That's why I had all 10 single-digit numbers. (But, I really should have explained that. It's not at all clear why all 10 digits are used.)

Now, if you think about it, if you get the random number 1357924680, and the next number can (in theory) be any of the other 10-digit numbers, that's effectively random for games of chance. Unless I cheat (i.e. know the algorithm), there's no way I can predict the next number.

BUT, if the computer always uses the same sequence, it CAN predict it. In fact, it can predict every single number it will generate, in order.

So, if the starting number is somewhat random (computer programs sometimes use the last few digits of the microsecond clock as a seed, or another number generated by a different algorithm), then any human seeing it will not realize it isn't random.

UNLESS, of course, they're playing a game, and if they make the same series of choices, the game actions turn out exactly the same. Which is what happens in this game.
jimmerseia Nov 5, 2017 @ 8:13pm 
By the way, using the same seed is a way that programmers can prevent the players from cheating by reloading a saved game. But, is it really cheating when you can turn on the tuner and add units all over the place?

So, the preceding paragraph explains why "new random seed on reload" should be an OPTION, not automatic. Otherwise, an enterprising player can take a multiplayer saved game file and see what the next couple of moves might do to him. So, it prevents cheating in multiplayer. (Although, you have to be not playing at the time, so there are other ways to prevent cheating. But, yes, someone actually did that to me years ago.)
Ryika Nov 5, 2017 @ 10:50pm 
Originally posted by jimmerseia:
If you start with any given number, the sequence will always be identical. Thus, games will play out in exactly the same sequence of random choices made.
No they will not, as the player influences the events that are going on, which changes the situation the AIs are in, which changes how the game plays out, if not by direct influence, then by the fact that not every random choice will occur at the same time, and in the same place. Only if you too do exactly the same steps, will the game play out the same from front to end.

And that's... pretty standard actually, and a good thing. There is no reason for a system that generates random seeds should be active by default, as it does promote save-scumming ("Oh, I was unlucky with that combat roll, let's try again!") a lot more than a system that does use a consistent seed on every reload, and other than that... it does very little.

Random Seed on Reload should be an option for people who want it, but should it be the default? No.
Last edited by Ryika; Nov 6, 2017 @ 3:24am
Sisohiv Nov 6, 2017 @ 1:51am 
Originally posted by jimmerseia:
I guess I wasn't clear: I know about the random seeds in saved configurations. That's not what I'm referring to.

The problem is that if you revert to a saved GAME (not configuration), the game will play out exactly as it did the first time you played through it. In other words, the random seed each game starts with remains in place for the life of the game, regardless of whether you revert to a saved game or which saved game you revert to.

This is a very basic programming error. Any developer should know how to avoid this (or force it, should that be the desire).

In fact, Civ V had a checkbox for whether you wanted it on or off. It's like the hired a whole different development staff, and burned the notes from previous versions.

I have a 4000 BC save and I have loaded it up 3 times and while shape doesn't change, features do. I "knew" from the first scout that there was a desert SW and NE of me but second run there were no deserts. 3rd run they had thrown up a big mountain range where ther wasn't one the other two times. All Civs were in the same location but resources and features flipped around.
SamBC Nov 6, 2017 @ 3:04am 
Originally posted by jimmerseia:
Originally posted by MadManCam:
I know you're just giving a quick summary of how it works, but I just had two comments.



Why can't they repeat in your example? The sequences generated are designed so that they mimic the statistical properties of random number sequences, so the sequence can be 2 3 1 9 2 9 8 1 3 1 6 4 7 .... etc. and then at some point it wraps back around to ... 2 3 1 9 2 9 8 1 3 1 6 4 7.. etc.



Its a bit misleading to say if your random seed is 2 that you start wherever the number 2 is. Its more like what you were say about the position numbers. If your seed is 2, you start in the sequence at position 2 (at the number 4 in your example with a zero-based index).

Otherwise, a good explanation of how random seeds work and why the same exact stuff happens if you start with the same seed.
They can repeat, if the algorithm allows for it. But, typically, they don't, because it's much easier to code for. Plus, you can debug "random" problems. (pun intended)

That's why prime numbers are so important to cryptography: the easiest algorithms to code use a formula with one prime number raised to a power that's another prime number (and a few other terms). If that one prime number is 2, it works almost like magic on a computer, because computers use nothing but zeros and ones. So, the math can take advantage of the architecture built into every computer's hardware, if they choose their number "nicely" (for them).

Typically, though, the numbers are really REALLY large, and the "random" number delivered to the program is just part of that individual number's digits. For example, maybe the specific random number is 12345678901. But, for a program, they might grab just the digits in every other position.

Now, if you have a billion numbers, nobody really checks to make sure there are no duplicates. It just falls out of the formula.

Interestingly, not only are there no duplicates, but every number in the range will eventually be used. That's why I had all 10 single-digit numbers. (But, I really should have explained that. It's not at all clear why all 10 digits are used.)

Now, if you think about it, if you get the random number 1357924680, and the next number can (in theory) be any of the other 10-digit numbers, that's effectively random for games of chance. Unless I cheat (i.e. know the algorithm), there's no way I can predict the next number.

BUT, if the computer always uses the same sequence, it CAN predict it. In fact, it can predict every single number it will generate, in order.

So, if the starting number is somewhat random (computer programs sometimes use the last few digits of the microsecond clock as a seed, or another number generated by a different algorithm), then any human seeing it will not realize it isn't random.

UNLESS, of course, they're playing a game, and if they make the same series of choices, the game actions turn out exactly the same. Which is what happens in this game.
Really, don't post about this stuff when you don't understand it, especially when there are people who actually do on the same forum. I gotta tell you, you appear to have some vague idea about how pRNGs work, and then filled in the blanks from your own imagination - you're way off base.

However, how these things work isn't really on-topic for this discussion except inasmuch as it affects the actual situation of the RNG state being saved.
jimmerseia Nov 6, 2017 @ 9:06am 
Originally posted by Ryika:
Originally posted by jimmerseia:
If you start with any given number, the sequence will always be identical. Thus, games will play out in exactly the same sequence of random choices made.
No they will not, as the player influences the events that are going on, which changes the situation the AIs are in, which changes how the game plays out, if not by direct influence, then by the fact that not every random choice will occur at the same time, and in the same place. Only if you too do exactly the same steps, will the game play out the same from front to end.

And that's... pretty standard actually, and a good thing. There is no reason for a system that generates random seeds should be active by default, as it does promote save-scumming ("Oh, I was unlucky with that combat roll, let's try again!") a lot more than a system that does use a consistent seed on every reload, and other than that... it does very little.

Random Seed on Reload should be an option for people who want it, but should it be the default? No.
I agree: it shouldn't be the default. But, I'm a "save-scummer", so ... :)
jimmerseia Nov 6, 2017 @ 9:13am 
Originally posted by GamerEdwin:

I have a 4000 BC save and I have loaded it up 3 times and while shape doesn't change, features do. I "knew" from the first scout that there was a desert SW and NE of me but second run there were no deserts. 3rd run they had thrown up a big mountain range where ther wasn't one the other two times. All Civs were in the same location but resources and features flipped around.
This game repeats exactly the same things, provided the human player takes the same actions.

For example:

I have a game saved at the very beginning, before I do any movement or city construction. The map is identical (as it should be) in this saved game.

Now, if I run my warrior NE 1 hex, then E one hex, then another NE, then towards the goody hut that appears, I will receive a relic by some guy whose names starts with Th. Also, I will always have three battles with the next-hex barbarian encampment, and the damage numbers I inflict and receive will be identical for all three battles. Further, the path a barbarian explorer follows will lead it to me two turns after I conquer the encampment, and I will have two battles with him, two turns apart, in which the damage will also be identical.

I think you might be referring to a saved configuration, not a saved game.
jimmerseia Nov 6, 2017 @ 9:16am 
Originally posted by SamBC:
Originally posted by jimmerseia:
They can repeat, if the algorithm allows for it. But, typically, they don't, because it's much easier to code for. Plus, you can debug "random" problems. (pun intended)

That's why prime numbers are so important to cryptography: the easiest algorithms to code use a formula with one prime number raised to a power that's another prime number (and a few other terms). If that one prime number is 2, it works almost like magic on a computer, because computers use nothing but zeros and ones. So, the math can take advantage of the architecture built into every computer's hardware, if they choose their number "nicely" (for them).

Typically, though, the numbers are really REALLY large, and the "random" number delivered to the program is just part of that individual number's digits. For example, maybe the specific random number is 12345678901. But, for a program, they might grab just the digits in every other position.

Now, if you have a billion numbers, nobody really checks to make sure there are no duplicates. It just falls out of the formula.

Interestingly, not only are there no duplicates, but every number in the range will eventually be used. That's why I had all 10 single-digit numbers. (But, I really should have explained that. It's not at all clear why all 10 digits are used.)

Now, if you think about it, if you get the random number 1357924680, and the next number can (in theory) be any of the other 10-digit numbers, that's effectively random for games of chance. Unless I cheat (i.e. know the algorithm), there's no way I can predict the next number.

BUT, if the computer always uses the same sequence, it CAN predict it. In fact, it can predict every single number it will generate, in order.

So, if the starting number is somewhat random (computer programs sometimes use the last few digits of the microsecond clock as a seed, or another number generated by a different algorithm), then any human seeing it will not realize it isn't random.

UNLESS, of course, they're playing a game, and if they make the same series of choices, the game actions turn out exactly the same. Which is what happens in this game.
Really, don't post about this stuff when you don't understand it, especially when there are people who actually do on the same forum. I gotta tell you, you appear to have some vague idea about how pRNGs work, and then filled in the blanks from your own imagination - you're way off base.

However, how these things work isn't really on-topic for this discussion except inasmuch as it affects the actual situation of the RNG state being saved.
Well, I do understand it, and very well. However, I may not have explained it very well. And, the example was very low-level.

But, I agree that the root question is whether the RNG is static or not.
< >
Showing 1-15 of 15 comments
Per page: 1530 50

Date Posted: Nov 5, 2017 @ 11:37am
Posts: 15