Another Plea for the Innocent Numbers!

Originally posted by Tassadar
Beamup

Do you know where rpng take their seed ? fluctuation in power supply, clock, natural radioctivity ?

Once you know where the random seed is taken ( and understand its mathematical behavior) and know the programm then you know which number is next. right ?
I believe most PRNG's take their original seed from the system timer, that is the number of milliseconds since the computer started up. So if you manage to start two different games at the exact same millisecond after startup, you'll get generated the exact same map etc.

However, there is a possibility of not doing this seeding, and instead start off with the number that happens to be in the correct place in memory, a number that may have been set when the program started - and therefore will have the same value each time. I remember from my old game programming where I needed to call the randomize function which picked a seed. If I didn't call randomize, I would get the same start point each time I ran the program. Great for debugging, but terrible for real use. I have actually read about lottry programs that did exactly this, which probably is part of the reason for not using programs to compute lottery number.

There are probably other reasons as well, like the fact that a programmer could make the program pick a special seed on a special future date (in which some of his family would have selected those lottery numbers), and the fact that people would start to question the validity of the random generator ("9 has come out 7 of the 10 last times, the RNG must be incorrect!).

None of these reasons disqualify CIV's RNG in any way, although we see a lot of whining like "a spearman beats 4 swordmen - the RNG is faulty", when the probability of such an occurencer is pretty high and the whining only shows that it's the player's imagination that is faulty.
 
Originally posted by Agamemnus
But it's only one engine and not a column's full...

To answer your comment more directly. The U.S. had tried to kill Sadaam in the previous war against Iraq. What if they had succeeded? Would that change the current strategic situation? Though not directly depicted in the game, the death of an important commander may make a huge difference. To quote Wellington concerning Napoleon, "his presence on the field made the difference of forty thousand men." What if a celebrated bullet kills not his horse, but Wellington himself?

Maybe one too many tanks on an important bridge causes it to collapse, or not. Maybe one extraordinary soldier holds a chokepoint through a subterfuge, which allows reinforcements to arrive just in the nick of time, or not. Maybe a simple handwriting mistake results in peanuts instead of shells being requisitioned.

What if some general tries to board an ammo ship with a lit cigar (U.S. Grant)? What if some lowly soldier tries to stop him? Will he be demoted, or not?

Of course, in the vast majority of cases, superior firepower will win. But we are only discussing the occassional event.

"Life exists on the edge of chaos." ;)
 
Originally posted by Kilroy
I invite you to come bang your head against the brick wall to my immediate right.

All my walls are padded. Hmm. I wonder why.

Anyway, concerning the suggestion for a slider. What would this slider do? Would it adjust between attacker and defender? If so, this would effect the AI combat, too. By making the attacker stronger, when you defend you are more likely to lose. Then you could complain about how your infantry defenders lost to swordsmen instead. Would it adjust between AI and human? This might help you win, but it would be a big cheat. The last option would be to "hump" the random numbers. This would reduce the chance of unusual results. The problem with this is that unusual events would still happen, just less frequently. This would not answer the objections of those who believe that tanks should never breakdown. So make it that advanced units never lose to inferior ones under any circumstances. This would be unhistorical to say the least. Most importantly, the game would end the moment anyone reached the next age. Chivarly = end of game. What fun would that be?

They're coming for my medication now. I must get in combat position.

EXECTER: There's five to one; besides, they all are fresh.
SALISBURY: God's arm strike with us! 'tis a fearful odds.
 
What a slider proposed by Agamemnus (adjusting the 'randomness' in combat) could do would be to tweak the attack/defence stats of engaged units in the following way before calculating the outcome:

Snew = Sold ^ R,

Where Snew is the new attack/defence stat, Sold is the old stat and R is the randomness factor, 1 in default rules.

Let's consider the case of 24 to 3 odds, moder armor attacking a pikeman, not taking into account defensive bonuses.

Now, if R was 0.5, the stats would be square-rooted before calculating battle outcome and the out-come would no longer be 8 to 1 but instead 2.8 to 1, making it far more likely for a pikeman to survive the assault.

If R was 2, the stats would be squared making the stats 64 to 1, almost completely removing the chance of a pikeman killing a modern armor.

You could adjust R to any value between 0.5 and 2 and thus effectively achieve what people are doing by tweaking unit hitpoints, which is rather cumbersome and slows the game down.

What do you think?

Heikki
 
I think it's not going to happen in any case because
(a) Anything of the kind would require a good bit of recoding.
(b) It doesn't add anything that cannot be done in the editor.
Meaning that the return on the probably quite significant investment of time would be quite small.
 
Beamup: if you refer to my proposal as requiring more than a little re-coding, think about if for a while: one global parameter that would be added in the formula they use for calculating results for a round of combat. Piece of cake.

Heikki
 
1) **** happens. Both to human or AI.
2) Realistic? Depends how you look at it? You can argue for eternity and there will be no answer.
3) Is it good? Some like it. Some hate it. For me, I like my game to be more predictable. This is a strategy game, not monopoly!!
 
Nope, not that simple. You have to add, at an absolute minimum, the following things I can come up with off the top of my head:
1. Need to construct an interface to set said parameter. Likely entails restructuring of the game options screen to make a place to put it.
2. Save file needs to be reformatted to include it. (By nature this is better suited to a game parameter rather than a preference setting, kind of like Preserve Random Seed)
3. Game saving routines must be rewritten to take it into account.
4. Game loading routines must be rewritten to read it.
5. Have to code in how to deal with opening old save files without that parameter - more rewriting of game loading routines.
6. Actually have to put it in to the combat code - almost certainly in multiple places.
7. AI needs to be rewritten so it knows about this parameter and can react to it - a major project in and of itself.
8. Before doing any of that, have to figure out precisely how to implement it. Does it apply to bombardment, too? Should it be applied before or after defense modifiers? Is a power-law form appropriate or should it be applied differently? What range would be appropriate to allow? Should it be reflected in the score? (If so, that's another whole set of interface and file system changes to deal with the high scores.)
9. All of that extra code must be tested to make sure it works properly, and more testing is needed to make sure something hasn't been missed that should be changed.
10. Extensive playtesting should be done to ensure that it works properly and has an appropriate degree of effect on balance.

This isn't some slight tweak of a parameter here.
 
I'm only going to reply to Beamup's previous post because I think we have already sufficiently discussed other things (except for one point, at end). As a programmer, I think this will be at least of some credibility. :)

Nope, not that simple. You have to add, at an absolute minimum, the following things I can come up with off the top of my head:

1. Need to construct an interface to set said parameter. Likely entails restructuring of the game options screen to make a place to put it.

True, but not that hard. Two lines of code at most.

2. Save file needs to be reformatted to include it. (By nature this is better suited to a game parameter rather than a preference setting, kind of like Preserve Random Seed)

No. It doesn't need to be reformatted. It can be tagged as 'HEY, I'm a random factor value! = R' or just omitted to give a default value.

3. Game saving routines must be rewritten to take it into account.
4. Game loading routines must be rewritten to read it.


True. Only two lines of code.

5. Have to code in how to deal with opening old save files without that parameter - more rewriting of game loading routines.

No. The loader will tests if the parameter is there, if not, just leave it as is and set it to default.

6. Actually have to put it in to the combat code - almost certainly in multiple places.

Depends on if we're modding just the battle random factor or the whole thing. In actual combat, only a fraction of a line would be required to add in the extra variable.

7. AI needs to be rewritten so it knows about this parameter and can react to it - a major project in and of itself.

No it doesn't. That's like telling the AI to build lots of spearmen because they're cheaper than Modern Armor! :scan:

8. Before doing any of that, have to figure out precisely how to implement it. Does it apply to bombardment, too? Should it be applied before or after defense modifiers? Is a power-law form appropriate or should it be applied differently? What range would be appropriate to allow? Should it be reflected in the score? (If so, that's another whole set of interface and file system changes to deal with the high scores.)

Yeah, but that's what we're here for, er, right? :confused:

Does it apply to bombardment too? I think it should.
Is a power-law form appropriate or should it be applied differently? Not sure on that.

What range would be appopriate to allow? 0 to present-time Random Factor.

Or perhaps you set the slider x from 0 to 100. After modded stats, a unit with x percent of defense/offense of the other unit would have 0 percent chance of winning the round. 100 = no random factor. 0 = all messed up. :)

Should it be reflected in the score?: should not matter IF the AI gets the same random factor advantage the human player does.

9. All of that extra code must be tested to make sure it works properly, and more testing is needed to make sure something hasn't been missed that should be changed.
10. Extensive playtesting should be done to ensure that it works properly


and has an appropriate degree of effect on balance.

Not necessary - random factor decreases 'balance', I think. Since when did Firaxis do extensive playtesting anyways? Especially with their 'minimum requirements, sound off' settings? :crazyeye:

LAST POINT:
11. Keep battle the way it is, but don't let the defender get that last hitpoint in. (option?)

Excellent discussion. :goodjob:
 
Originally posted by Agamemnus

Not necessary - random factor decreases 'balance', I think. Since when did Firaxis do extensive playtesting anyways? Especially with their 'minimum requirements, sound off' settings? :crazyeye:

I agree that it wouldn't be that hard to program (as far as those sorts of things go).

However, I disagree on the balance issue. Losing 3% of your tanks in a major campaign against a so-called primitive culture is not unbalancing. Combine that with the fact that I don't even remember ever attacking a spearman with a tank, the chances of such a mis-matched confrontation is probably quite small. Combine THAT with the very slim chance that a single tank combat in the industrial age (hundreds of combat units) would be decisive, this is a non-problem.

In a previous thread on this topic, it took days for anyone to actually post such an example; but as I then said, in 6 million years of game play, it was bound to happen sooner or later.

As an historical matter, uncertainty rules.
 
Originally posted by Agamemnus
But it's only one engine and not a column's full...

For the want of a nail the shoe was lost,
For the want of a shoe the horse was lost,
For the want of a horse the rider was lost,
For the want of a rider the battle was lost,
For the want of a rider the battle was lost,
For the want of a battle the kingdom was lost--
And all for the want of a horseshoe nail.

The importance of seemingly insignificant events is now known as the Butterfly Effect*. This poem was inspired by King Richard III. In his last battle, one of his military wings was rapidly deteriorating. With his immediate presence, Richard might organize a rally. Yet, his horse threw a shoe. “A horse! A horse! My kingdom for a horse!”

http://www.stjohns-ucc.org/sermons_spark.html

* This dependence on initial conditions, the "Butterfly Effect" is ascribed to Lorenz's paper, Predictability: Does the Flap of a Butterfly’s Wings in Brazil set off a Tornado in Texas?

http://www.cmp.caltech.edu/~mcc/chaos_new/Lorenz.html
 
Agamemnus -
In the middle of writing this post, I realized we're BOTH wrong (or, at least, missing the easy way to do things). The save games now include the rules under which they were started, so this modifier could be applied ONCE when a game is started to directly change the strengths of all the units. Just loop through all the units and modify their values. It doesn't need to manifest in the combat calculation at all, Spearmen could BE 1/4/1 exactly as if changed in the editor. Heh.

Modulo that, however, I agree with what you wrote for the most part - my post was in response to Heikki's apparent assumption that one change to one line of code would do it. Looking at your more in-depth analysis demonstrates that quite well.

I do want to make a couple points, though:
#2 - even adding in the possibility of having such a factor in the file counts as reformatting, at least as I use the term. After all, there has to be some specification (a format) telling the program that one sequence of bits is a game that has such a factor and another sequence of bits is a game that doesn't.
#5 - what you wrote is exactly what I meant needed to be done. A simple bit of code, yes, but it needs to be written.
#7 - If it were programmed into the combat resolution (i.e. not implemented as an actual change to the AD values) it would also need to be programmed into the AI (since the AI presumably just looks directly at the AD values), since an MA becomes even better than it used to be compared to Warriors. If you leave it be, the AI will still act as if MAs only have an attack of 24 instead of the modified value.

Your point about Firaxis' testing process is well-taken, however. After all, we all know air superiority wasn't obviously broken in the initial release, right? I mean, if it was obviously broken they would've tested it and found out, wouldn't they?

Oh, and Zachriel - "Butterfly Effect" is actually an obsolete term in technical circles these days. It's properly called "sensitive dependence on initial conditions," (or just "sensitive dependence") and exhibiting that behavior is the precise definition of the term "chaotic." Not that you shouldn't continue using it in non-technical contexts (like this forum), I just thought you might like to know since you seem interested in the subject.

Edited to fix a bit of a brain freeze on my part, crossing two different issues.
Edited again to fix a spelling error in the original edit.
 
Originally posted by Beamup
Oh, and Zachriel - "Butterfly Effect" is actually an obsolete term in technical circles these days. It's properly called "sensitive dependence on initial conditions," (or just "sensitive dependence") and exhibiting that behavior is the precise definition of the term "chaotic."

No big deal, but I think you missed my footnote and link to Caltech. Quoting myself, ahmm,

* This dependence on initial conditions, the "Butterfly Effect" is ascribed to Lorenz's paper, Predictability: Does the Flap of a Butterfly’s Wings in Brazil set off a Tornado in Texas?

http://www.cmp.caltech.edu/~mcc/chaos_new/Lorenz.html


Lorenz was a meterologist who was interested in the application of computers to weather prediction. When running a simulation, they had to sometimes reenter the data. Due to rounding errors in the printouts, a second simulation might diverge dramatically from the previous simulation. This led to the discovery of a "strange attractor," an important contribution to the study of chaos.

Not bad for a weatherman.

lorenz1.gif


More images of the Lorenz Attractor:
http://astronomy.swin.edu.au/~pbourke/fractals/lorenz/
 
The Ikeda attractor looks a lot more interesting, IMO. And I'll admit I didn't actually click through. That's just one of my reflex reactions, I'm afraid (assuming people don't know something unless they prove they did - and unless I noticed said proof). Sorry about that.

BTW - for anyone who cares to know, the rounding errors in the printouts were due to an attempt to speed up the output - the printer involved could print only 6 llines per minute! This was OK, of course, because obviously those digits weren't going to change anything. Little did he know...
 
Originally posted by Beamup
BTW - for anyone who cares to know, the rounding errors in the printouts were due to an attempt to speed up the output - the printer involved could print only 6 llines per minute! This was OK, of course, because obviously those digits weren't going to change anything. Little did he know...

Which, of course, is another example of how little things can have profound and unexpected results. ;)

Excellent link, by the way. :goodjob: I have already begun to immerse myself in the Hypertextbook.

man.2.05.gif
 
Me too - I just found it as the first link that popped up in a search for "Ikeda Attractor," but it's definitely a good site.

Is it just me, or are we getting just a WEE bit OT here?
 
Wow I had thought this topic had finally begun to find its end when I left to work at camp two months ago. Guess not :) But yes we do need a tutorial of some sort on random numbers and probabilities in the FAQ. It has been shown that people don't have a good concept of randomness and that any string of numbers they generate will have two few "streaks" in it.

And being one of the "nut cases" who has made the maps and fought the hundreds of battles recording the results I can say that the game does work as described. And we had that poster months back who hacked into the game and proved that the the PRNG was correctly working.
 
Beamup:

Programming the AI to take into account the new stats is definitely a big task. Depending on how it is coded at the moment, it can range from a couple of days work to a huge amount of re-coding.

Most of the other tasks you refer to are more or less trivial. In a huge software project such as Civ 3, the inclusion of global parameters in save files, for instance, is probably automated so that the programmer only has to add the parameter to a data structure in one place in the code.

Anyways, I like the battle rules just the way they are and have no need for such a slider. Just proposed it for arguments sake.

Heikki the software engineer
 
Mostly trivial, yes, but they would need to be done (or not - note discussion above). Your previous post really sounded like you thought one change to one line of code would suffice (which it certainly wouldn't).
 
Back
Top Bottom