What RNG does Civ use?

@Bungus

Look at the following two diagrams:
random.JPG

Both of these diagrams have 50 white squares and 50 grey squares, but one is randomly distributed while the other is not. When asked which one it is most people will answer "B", but in fact only diagram "A" is randomly distributed. That's because people assume that a random distribution should "look random" on a small scale.

You're making exactly the same mistake with respect to expected Civ results.
 
Aha. Well thanks for the information guys. Seems likely that Civ's RNG is, in fact, random.
That was a pretty good idea looking at the seed, Oystein.

That is a good example, Brian. We are talking about different versions of the same thing, though. Without counting, I'll assume both of that black and white are approximately equal in each diagram (although in reality its too small a sample). In diagram B, although the black and white are equal, they are too scattered to be truely random. By the same token, it is possible to have squares that are too "clumped" to be random as well, although black and white may equal.
It is good to observe that true randomness is stringier than we might expect, although in my last post I was trying to point the possibilty that in the RNG, previous outcomes could slightly effect future ones, and still yield seeemingly random results. I didn't base my belief that Civ's RNG was prone to strings on my own observations, but rather on other members' assertions, and my understanding that RNGs are commonly screwed up.
 
Bungus said:
I don't buy it.
Anybody who says they sat there and watched 10,000 fights between a spearman and, whatever, is either crazy or a liar.

Hah! I do tend to exaggerate when I'm making a point. I'm not sure anymore what the exact numbers of units were. Large enough to make me think, "wow, that guy has way too much time on his hands". (Not that I'm any better.) You could undoubtedly find the posts if you did a search; there have been several of them.

Renata
 
Oystein said:
The seed value is stored in the save file. I looked at how it changed and tried to find a pattern. After some investigation I concluded that the number 12345 was central and made a google search including that number and the correct algorithm popped up.
While we're at it:
There is one problem with your formula (at least, as far as I understand it...).
If you transfer a safe to a different machine, you will get a different RN.
Classical example here are those Goody Hut saves ('Look, I got a Horseman!' - 'Uh, I get a Tech').
Of course, the same save on your machine will always have the same result, even years later.

So, there must be a "local" modifier somewhere in the equitation - serial number of your gfx card, time stamp, maybe even a hidden registry number of your Civ installation...
 
Do you have a save?

The only posibility I can think of is different round off. Someone found out that the prng uses reals rather than integers in the calculations. I have noticed microscopic difference in two number series calculated with the same prng on diffrent machine, so that could be it. But then there should be a very small chance of different result.
 
Doc Tsiolkovski said:
Like this save: On my machine, I get a SGL for Polytheism when ending the turn.
Did something familiar by reloading to see if a SGL would spawn again
after researching the same tech.He didn't show up the second time.
 
Brain said:
@Bungus

Both of these diagrams have 50 white squares and 50 grey squares, but one is randomly distributed while the other is not. When asked which one it is most people will answer "B", but in fact only diagram "A" is randomly distributed. That's because people assume that a random distribution should "look random" on a small scale.

You're making exactly the same mistake with respect to expected Civ results.


Brain, it's an excellent example. All those people who've sat through their "500 combats" tests are skewing the perception of the game, and ultimately the test of a PRNG is in how it's perceived by the player. No one actually PLAYS through 500 combats, and so it's useless to prove randomness by doing so.

It may be true that diagram B isn't truely random; but it would feel more random if the game used a similar generator.

In addition, it's been said that the game includes its own "trend" modifier--a period of "good" turns and bad turns. This obviously can affect the outcome of any PRNG. My opinion: I'm with Bungus. I don't buy it. Chicanery is a foot.
 
So a near-perfect pRNG generator should be replaced with something that that gives you a warm fuzzy feeling about perceived randomness but really isn't random at all? As if there weren't enough problem with reloading in competition games now, people would be able to predict outcomes ahead of time. "Oh, ok, I just won three times in a row in 50-50 combat. That means the next one's only 2% likely to be a win as well. Better toss in my crud unit instead." It would be oh-so-expoitable.

In addition, it's been said that the game includes its own "trend" modifier--a period of "good" turns and bad turns.

Said by whom? People whose tanks lost to pikemen three times in one game after never having had it happen before in three years of playing the game? People need to get over their wrong perceptions and sit down and flip a coin 500 times. See how many strings of six or seven consecutive heads or tails show up.

Renata
 
All I know is that yesterday a Chinese Rider attacked one of my leftover Spearmen - and the Spearman beat him! So, right now I'm happy with the RNG. Tomorrow, that could change.
 
Renata said:
So a near-perfect pRNG generator should be replaced with something that that gives you a warm fuzzy feeling about perceived randomness but really isn't random at all?
Renata


Yes! Exactly!

A PRNG isn't really random at all either! As for being oh-so exploitable, you assume I'm suggesting a static number generator, which I'm not.

I'm not enough of a math wiz to give numbers, but I have a hunch that the formula can be modified to create a smaller variance, which would "reduce randomness" (in the purest sense, as calculated over a long series) but would feel more random in the scale we experience it in the game: in the scale of dozens to hundreds.

Maybe I'll consult with my brother. He's got a PhD in Math, fercrine-owt-lowd.
 
Renata said:
Said by whom? People whose tanks lost to pikemen three times in one game after never having had it happen before in three years of playing the game? People need to get over their wrong perceptions and sit down and flip a coin 500 times. See how many strings of six or seven consecutive heads or tails show up.

Renata

Try it yourself and see. Roll a pair of dice 10 000 times and write down every result, then average them. You'll find it isn't exactly 7. I know this because I've done it. I did it for a reason (don't ask the reason) but it did tell me that even the "perfect" RNG--if there is a perfect one, it'd be dice--isn't perfect. This is because no two dice are the same (I used the same pair of dice in that 10 000 rolls test) and in the same vein, no PRNG is truely random. That's why they call it a pseudo- RNG...

The wrong perceptions are about RNGs, and I'm posting this because I've seen the AI lose only 5 times in 800+ years with Archers. Not an isolated event.
 
I'm sorry, I can't even figure out half of what you're saying. 800+years? I've killed more AI archers, on offense and defense, than I can shake a stick at. I must have killed 100 of them in the Regent AW game I played a couple of months ago.

And what does "not exactly 7" have to do with anything? Of course it won't be exactly 7 -- even perfect random numbers wouldn't yield exactly 7 over any finite number of trials. My point, which you seem to have missed entirely, was that strings of heads or tails (or odd numbers or small numbers or whatever, if you're talking dice) will prove to be common -- if people would just do that once or twice in their lives maybe we could get over all this silliness about strings somehow not being random.

Renata
 
Hm. What I'm saying about the 800 years is that war broke out about 300 AD and by 1100 AD (how many turns? hm... roughly 60 turns) I had counted exactly 5 times when the AI lost a battle using Archers. Winning numerous dozens of times, of course. It got so bad that whenever I saw an enemy Archer, I'd contemplate retreating, and it got me thinking... Rather than throw my Zerk into the fray, which took several turns to build, knowing that it'd almost certainly lose to the herd of Archers, I would retreat.

This is definitely not rational thinking; since I'm fully aware of the fact that randomness isn't influenced by past events. But it gets too easy to believe that the game isn't generating numbers randomly, and that's my complaint...
 
What is interesting is that the AI actually suffers from the same problem with the PRNG. Based on a limited number of tests, I have reloaded after a combat and let the AI attack instead of me attacking. The result is that the AI most often has the same result that I had: When I attacked and won, the AI would win when it attacked. When I lost while attacking, the AI lost when attacking. I cannot see any reason why they would mess with the PRNG. There are so many other (easier) ways to give advantages to the AI. The barbarian bonus is an example.
 
I give up. If people want to keep ascribing order to near-randomness, I can't stop them.

Renata
 
Renata said:
I give up. If people want to keep ascribing order to near-randomness, I can't stop them.

Renata

A google search on "winning lottery system" returns about 2,400 results.

One: "Lottery predictions based on applying rules to patterns from Massachusetts state lottery results." Worthy of a Nobel Prize, if true.
 
Some bad assumptions are being made. For a start a pRNG is not a random number generator. It uses an algorithm to generate a string of numbers that appear to be random, but have an underlying predictability. The 'randomess' of this is increased IIRC by using a number seeded from the CPU's clock timer (which is why saves produce different results on different computers, despite a preserved seed. I may be a bit behind the times though :) )

Brain. Nice diagrams. How did you produce them? If A was produced by rolling a dice or tossing a coin, then it is random. Otherwise it used a pRNG and cannot truly be described as random. How did you produce B? Sure it looks suspicious, because there is a greater frequency of changes from Grey to White than would be expected from a random distribution, but you must have used some sort of algorithm to produce it, or you could not say that it is not random, hence you must have used a pRNG. I would guess that you used algorithms to produce both results (how else would you get perfect 50/50 grey/white distribution). The fact that they appear different shows that one is better than the other at mimicking true randomness. In actual fact they can both be considered random, looking at them, but one has a higher Fractal Dimension than the other.

When people complain about the RNG producing long strings of wins or defeats they do not neccessarily mean that it is not producing a good approximation of randomness, just that it looks unfair, and they would prefer the pseudo-randomness of Brain's diagram B, to that of A.

If you roll a pair of dice 10,000 times the 'laws of probability' in no way state that you should get an average roll of 7. But if you keep a record of the totals for each roll, I would be surprised if you didn't get a lovely bell shaped curve on a histogram. With 7 the most frequent result. I would be amazed if the average was 7.
 
:)
I have absolutely no problems with the (p)RNG. Sure, sometimes you loose a tank to a spear. But then, in my last game my MDI in a town defeated 3 Knights and 1 MDI on defence, before finally dying after another 3HP from the next MDI. No MGL, though.


But, what about the Horseman? That simply shouldn't happen. I did test that several hundred times (really; a map with ~100 GHs and Scouts with move=100) for RAR. And you only get a unit requiring a resource if you and some more Civs (4, to be exact) see that on and have the tech for the unit.

So results like this are either an extremely small chance (like " 1:10^6 -> Give any random unit"), or a glitch.
 
Back
Top Bottom