Random Numbers ??

Druid

Chieftain
Joined
Jan 28, 2002
Messages
8
I dont understand the random number "thing" that is happening in combat.

I saved and then ran the following test combat.

My (American) Knight vs the (Indian) War Elephant.

Both on flat terrain, on road inside the Indian territory. Both Vets.

on paper this looks like the Knight (6/3) should win against the Elephant (6/3) about 2:1.

Maybe I'm misunderstanding, but if there is any degree of randomness, the Kt should win 2 of 3 times with varying degree of damage.

I ran the combat and reloaded and etc. 10 times. The exact same outcome came to pass. The Kt won, with the same number of damage points each time. OK.. so 10 is not a large number, but there should be SOME variation in outcome... I would think.

Where is the "random" part ??
 
supposedly, the random number decision is made prior to the save, all combat will be the same regardless of reloads.

however, i have noticed that if you vary the order of the units you attack with you will get different results.
 
The way I figure it happens is that while everything is "random" there is a some sort of stack that the random numbers are generated and stored in. When combat happens the first number in this stack is used and the next. I am not sure if this stack holds on over from turn to turn or when this stack is generated. However if you think about it like this you might be able to nudge the settings in your favorite.

As mentioned above if you change the order that you attack in there is a chance that you will get different outcomes. I will often start with very difficult combats ie: seiging that large city with cutting edge units. If that battle fails then I might try a simpler combat to 'burn' up the 'bad rolls' say cutting down some cavalry caught out in the field. Safe the game again and then try that city. If that fails then my crystal ball tells me that this year is not the year to attack. Next turn after either the stack has been reset or the computer has consumed some of those rolls during the CPU turns, Ill repeat the process hoping to get a decent result.

Some may consider this cheating, but then the computer has a crystal ball for your unit positions, you might as well pull yours out also.
 
The random number is generated before anything else happens, so reloading and reattacking won't produce different results.

You CAN get different results by attacking from a different square or altering the order of the attacking units. Coming from a different square is especially helpful in cheating at sea battles.:cool:
 
OK, brief course on "random" numbers:

Computers produce pseudo-random numbers (PRNs) using a pseudo-random number generator (PRNG) function. The output (i.e. one PRN) of a PRNG is determined by the "seed," a number that is given to the PRNG as input. The first time a given program produces a PRN, the PRNG must be given an intial seed - one of the common choices is to use the system time, as this results in a different set of results each time the program is executed (unless you know how to freeze your system clock, but that's beside the point). Subsequent PRNs are generated using the prior PRN as the seed, unless the PRNG is reseeded, which can be done at any time of the programmer's choice.

As a consequence, if the same seed is given to a specified PRNG, it will produce precisely the same series of results. In Civ 3, the PRNG is seeded at the beginning of a game, and is never reseeded. The current seed is saved in the .SAV. Therefore, any time you reload and perform the exact same series of inputs, the results will be exactly the same. As a matter of fact, if you so chose, you could start one game and play it out, recording all the input you gave. If you then went back to the 4000 BC autosave and played the game again, using exactly the same input, the results would be exactly the same, up to and including the modern age!

Note - one thing in this is speculative, I do not know for absolute certain that the PRNG is never reseeded... but I have gone through the Ancient era and into the Middle Ages like this, as a test, and was able to confirm that the PRNG was not reseeded even at the era switch. Thus I conclude that the overwhelming probability is that the PRNG is never reseeded.
 
Think of it like a shuffled deck of cards. The results are already decided, but you don't know what the results are, so they are random for the purpose of the game.
 
Top Bottom