As promised, a Civ III combat test map

Status
Not open for further replies.
Originally posted by Loopy
When you combine results from multiple users, the power of the test goes up.

Not when every user is using the same string of numbers (which I gather is included in the saved game). Even if the battles are done in a different order, you can't consider the results as independent.

-ollie-
 
Originally posted by bloodysmurf


Not when every user is using the same string of numbers (which I gather is included in the saved game). Even if the battles are done in a different order, you can't consider the results as independent.

-ollie-

Exactly 8/

Hence my question earlier in this thread...

This whole saving the random number seed in the game is a bit of a problem. 8/ Riddle me this, though, I thought the save/reload reset of the RNG could be accomplished by exiting the game entirely, and then going back in -- therefore, to get a new seed, shouldn't all we have to do is load up the sav game, sav it AGAIN, bounce out to windows and then back in, and load up the re-saved game? If this doesn't work, why am I wrong/confused/babbling?


Also, should we be tracking this HP by HP or overall battle? For example, is it sufficient that the tank always wins, but does so with only 1 hp left more often than not? Obviously, I think *we* need to try and work this out a little better, because it is NOT sufficient to say "tank wins 20 to 0" when in fact, it lost almost half the 'battles' (assuming the hypothetical case where it always wins with 1 hp left)

I didn't think of it at the time, and thusly didn't track that so meticulously when i ran my initial test.
:rolleyes:
 
I never claimed that the results for each user would be independent, just that: 1) you can draw statistically defendable results from the current 240 battles and 2) adding results from multiple users would increase the power of the test.

I don't think exiting the game and re-entering resets all of the random effects of the game. It's never happened for me with battle results at least. It's probably just a little bit of misinformation that'll hang around for a couple of years.

I don't think there's any value in saving HP by HP results. It's much too much effort for very little gain. If your elite tank rolls over that rifleman without taking a point of damage, your conscript tank (with 3 less HP) or any tank, will win the battle without taking a point of damage. Aside for anecdotal evidence about that battle worn and bloodied spearman beating off a dozen swordsmen with only 1 hp, there isn't any reason to think HP matters in combat. But if you really want to run through all the battles a couple of dozen times, keeping track of each and every HP loss, no one's stopping you. :D I'd rather fire up another Emperor game myself.

I'm going into this believing that normal combat works as it was designed. I don't do many naval battles so I'll wait until there's more proof before making up my mind on that issue. Regardless of my opinions, there's little reason for Firaxis to lie about this issue, and combat outcome code is simple enough to write.
 
Originally posted by Loopy
I don't think there's any value in saving HP by HP results. It's much too much effort for very little gain. If your elite tank rolls over that rifleman without taking a point of damage, your conscript tank (with 3 less HP) or any tank, will win the battle without taking a point of damage.
Doesn't the seed change when you use a different unit? So the conscript tank could lose without doing any damage (complete opposite of what you said).
 
Originally posted by Loopy
If your elite tank rolls over that rifleman without taking a point of damage, your conscript tank (with 3 less HP) or any tank, will win the battle without taking a point of damage.

This is true. The seed is always the same, and will stay so throughout the entire game.
 
Wow! Has it really come to this, where Dan has to post stats just to validate Civ 3's combat system?

I can only recall losing a tank to spearman once, and that was because the tank had only 2 HP left and attacked the Spearman while it was fortified on a mountain (don't ask me what I was thinking...if at all.)

I have lost plenty of Cavalry to Spearmen though, but that's not as big of a reach as losing a tank to one. I don't think that the combat system is as randomly biased as some people would have you believe.
 
Originally posted by Hurricane
Hey, keep to the subject! There are hundreds of threads about combat strengths and historical accuracy.

What this thread about is to test whether the random number generator generates strange numbers or not. IMHO, the test results show nothing unspectacular, except for the lone killer spearman in cephyn´s first test. I can live with this.

As Dan and other point out, the main problem with this test is that it uses only a limited number - and most important - identical random numbers each time it is run. This way you can´t say the good random spread found here is a precise picture of the actual random numbers used throughout one whole game of Civ3.

However, this fact can be used for good, as well. First, everybody (I´m thinking Dillo and other here) who suspect that their computer in some strange way messes the PRNG up can use the savegame. Since everybody should get identical results, this is easy to prove once and for all.

Second, the savegame can possibly be used to finally decide if defenders always get a 10% bonus to their strength or not, by changing the order of the attacks.

You know what? I just come here now looking for a new patch. I play Empire Earth.Not so many screwy wierd things going on.Much more solid.Not as good a game, but its stable.So, I could actually care less about this test now. Remember I did sometests, and decided that there is a lot of randomeness,unfortunaly this test removes all the random factors.Like rivers or hills or plains.Its simply sidesteps the issue to me,.It uses the same seed everytime, andother problem for me.I was trying to figure out whgat the random factors that made the weird outcomes happen were.I validated that the battles actually comeout like they do for program specific reasons, intentional ones, defense bonuses,defensive units, damge ect.Mathmatecly the battle coutcomes work exactly like they were programed to do.There is no bug,its just some random factors that you can benifit from just like the AI. its called planning when you place a city or building, what square its on, ect. Its done like its done for game continuity not realisim.That was already stated by Dan there in other posts.No problem. There is nothing wrong. SO be fore you pull me bac into a debate, and point fingers, make sure you read ALL of the psosts I have made, and all the information I included in them.After the patch was applied,Finally, with no help from Infogrames or Fireaxis, as their no cd wouldnt help me.I down loaded a "Warze" version of the no cd hack, and it worked great.The patch seemed to level out the battle resoloution to a satisfactory level for me.So, with that I exited that debate with satisfaction that ,that part of the game was fixed,for me at least,It still happens, but not as much as before,(for me),Now, I only await, a real viable patch from fireaxis to fix the many "REAL" bugs that still remain in the game, like costal fortress and precision strike.Ect. there are scads of others.The game is playable, like I have stated.I have just played it to the point, that with all the messed up stuff that doesnt work or work right,the game has become annoying and boreing.So, when its finnally patched, and fixed, I will start playing again.In the mean time I have gone back to Skinning and mapping for Quake and Unreal games.Musch more fruitfull exercise, since they generally rush to fix problems, they e-mail back replies to me when I have trouble, and generaly do whatever they can to help to resolve a problem, EVEN STILL! after being out for so long, they still are more than helpfull.I went toe to toe with them everyday resloveing issues I , (only me) was haveing with part of the Unreal ed.They actually emailed me, asked me things, told me to try things and developed a patch off part of my information. So there ya go.Dont expect to see me post too much, as I am tired of seeing all the bug complaints and people saying they dont exsist.I will still come by and look and reply occasionaly, heck I check here every night, I have chosen to stop participateing though, becuase of the "Its not happening to me, so its not a bug" crowd who cant see past their rears to realize that, simply because they dont experience a bug,think it doesnt exist.Later.
 
Moderator Action: Dillo, as I pointed out to Troyens, and as Lefty reiterated, this thread is not a complaint area for you. There are plenty of threads for that so take it elsewhere. You should have seen the warning that was given to Troyens so you are eligible for a temp ban on posting privileges so I suggest that you edit your text to thank Dan M. before Lefty sees it and you have a better chance of avoiding that fate.
Please read the forum rules: http://forums.civfanatics.com/showthread.php?t=422889
Killer, it is out in an email, and don't use Netscape! ;)
 
Originally posted by PaleHorse76

Killer, it is out in an email, and don't use Netscape! ;)

:goodjob: thanx

I sadly have to use Netscape - bosses decision :(

I`ll try out the test right away....
 
First, I want to thank Dan for showing enough dedication to set up this test. It's always pleasing to see the creator involving themselves :)
Now, sadly, I have to say that the samples are much too small to give a statistical feedback, and all the more if you consider this pesky "save random seed" (why do the designers put this in the game ?? Afraid that we would cheat against ourselves ???).

I don't know how works the editor you use, but if it allows you to place several units in one click, I advise you to put not 10 units of each type, but at least 500-1000. I would equally advise to reduce them to 1 HP, to make sure that every calculus made show on the map.
 
Akka,

The random seed save thing was put in a LONG time ago, I suspect it was put in with an eye towards preventing multiplayer cheating, but I'm not sure. Don't read anything into that other than what it is, though :)

It actually took me about an hour or so to do the map, because what I used to create it was a debug version of the game with some quick and dirty programmer menus for placing units. It takes me about 4 mouse clicks to place an enemy unit (only 2 for one of my own), and there is no way to undo it so it's save every time you place something in case you messed up.

I was originally planning on putting a lot more units onto the map but my hand was starting to go numb :cry:


Dan
 
Dan, a simple way to eliminate all of this is if you could do us a favor, simply ask one of the developers how they get their random numbers?

Do they use a custom made RNG? Does it perform use a bell curve distribution? What language is this game written in? C++? If so, does it simply call randInt() or whatever the base function is? If the game simply calls the standard language library to retrieve a random number, then we know that the RNG isn't screwy (at least as far as Civ3 is concerned). If Firaxis modifies the results however, then we can assume that something Firaxis does is the problem. For instance, do you guys multiply the random number by anything? By x2 for instance?

The answers to these questions would remove doubt once and for all. And since Firaxis should still have the source code (I would seriously doubt you guys delete the source) it would be relatively simple to find this out.

Thanks.
 
I posted my little TCG Saved Game editor in the Creation/Utility Programs forum not long ago. One of its features allows you to alter the random number seed stored inside a .SAV file. I tested it only so far as to (1) load a saved game where I'm ready to attack, actually attack and see my guy get killed and then (2) Use the re-seed function in the editor to change the file, re-load the .SAV file and see my guy kill the defender. Without changing the random seed value, you'll get the same results every time.

I use the standard timeGetTime() function to get a new value. I think that's the same call the game uses to initialize its random number generator. I have no idea what other processing the game might be doing as far as massaging random number output.

Give it a try if you're so inclined.
 
Originally posted by Dan Magaha FIRAXIS
Akka,

The random seed save thing was put in a LONG time ago, I suspect it was put in with an eye towards preventing multiplayer cheating, but I'm not sure. Don't read anything into that other than what it is, though :)

Ah, well, then if you could ask them to remove this fixed see thing, please :)
It's hugely frustrative, and as there is no multiplayer for now and I like to be allowed to cheat against myself, it has not really any use :)


It actually took me about an hour or so to do the map, because what I used to create it was a debug version of the game with some quick and dirty programmer menus for placing units. It takes me about 4 mouse clicks to place an enemy unit (only 2 for one of my own), and there is no way to undo it so it's save every time you place something in case you messed up.

I was originally planning on putting a lot more units onto the map but my hand was starting to go numb :cry:


Dan

Ah well, then I suppose we can count you on for the petition about a real scenario editor ? :D
 
Of course what would solve this issue for all time would if there was a debug option that caused the game to log the random numbers it generated. Then it would be simple to do some stat anlysis on them and conclude that all is good or that there is a problem.

However, this is probably not something that can easily be added (if at all). And the more that I think about it, a misbehaving random number generator should be more evident than just in some screwy combat results. We should be seeing far many other things that are dependent on probability going screwy in those games as well.
 
I've long been of the opinion that the RNG in Civ3 is "broken". I need to try and pin down why it is I believe that to be true. In my experience, it's NOT because of combat results. I have never seen out-of-the-ordinary combat results to the extent others have reported. Having said that, I'll stop before I go off-topic.
 
Originally posted by etj4Eagle
We should be seeing far many other things that are dependent on probability going screwy in those games as well.

I for one, do! Talk about a Galley not sinking in ocean for 20 turns, then 27 Caravels all sinking on their first foray into open waters......

Talk about always finding Barbarians in the goody huts - quite anooying when you play a huge map and it`s >100 hut you walk into; while the only AI player gets 4 tech from the 4 huts on his little island (I don`t know how else he could be 9 tech ahead within 9 turns.....)

So there seems to be a high tendency for extreme strings in other random numbers as well.
 
Using a debugger I determined that Civ III uses a linear congruential RNG. Actually, it's a pseudo-random number generator, but I digress. The fundamental formula for updating the seed is given by the following formula which is done every time the base random number routine is called:

seed = (seed * 1103515245) + 12345

There's a suite of tests called DIEHARD that have become the de facto standard for evaluating RNG's. I ran the DIEHARD suite of tests on several data sets of output values from the Civ III RNG. Each data set had about 20 million numbers in it. DIEHARD has 15 different test routines in it, and with the exception of 1 of those (OPSO, OQSO and DNA are considered one test), the results were good. The OPSO, OQSO and DNA results were very bad, however, so I ran further tests.

For combat purposes, Civ III asks for a random number between 0 and 1023. I simulated the exact same mechanism used by the game to generate numbers in this range, and ended up with a data set of over 64,000 numbers. A histogram analysis of the results showed that the distribution of values was pretty even. I repeated this test several times and the results were consistently good. There was no noticable bias favoring any particular output.

I conclude that the RNG used in Civ III for determining the outcome of battles is pretty solid. If there are any problems with combat outcomes, they must lie elsewhere. And, of course, there's plenty of "elsewhere" to consider. For each battle, a number is calculated for the defending unit (I have no idea how that number is calculated). Then, for each whack that the attacker takes against the defender, a random number is generated in the range 0 .. 1023. If the resulting number is greater than the number calculated for the defender, then the attacker scores a "hit" and the defender's Hit Points get lowered by 1. Otherwise, the defender scores the "hit" and the attacker's Hit Points are lowered by 1. First one to 0 loses the battle. All this obviously depends on exactly how the defender's threshhold value is calculated by the game. If there's a problem with battle results, then that is most likely the area where the cause of the problem lies. It's not in the RNG.

The RNG uses several floating-point calculations which are deadly in terms of performance. The programmers could have achieved the exact same results without having to resort to floating point calculations. As a result, the calculation of random numbers takes anywhere from 4 to 6 times longer than is necessary. I don't know how often the RNG gets called on during the AI turns, but it would be interesting to see how much those late-game turns could be speeded up by eliminating all the floating point conversions in the RNG routine. It's used for much more than just determining who wins battles. It might not make any difference at all, but then again it just might. I'm going to try and replace the RNG routines in my copy of the game and see if there's any appreciable difference.

Summary: The algorithm used by the RNG in Civ III is good, and the numbers it produces pass most statistical tests with flying colors. The implementation of that algorithm is poor, unnecessarily impacting the performance of the game. They could have and should have done a much better job in that respect. It ain't rocket science. If I have any success in replacing the game's RNG routines with my own - and there's anything significant to report - I'll let you know.

Edit: I was able to substitute my no-floating-point RNG in the game. There was no noticeable difference in late-game slow-turn performance. Therefore, I'd like to back off my statement above that using a FP RNG was a bad implementation by the developers. In the grand scheme of things that tend to slow the game down, the RNG apparently is not a big factor.
 
Originally posted by hwinkels
For each battle, a number is calculated for the defending unit (I have no idea how that number is calculated). Then, for each whack that the attacker takes against the defender, a random number is generated in the range 0 .. 1023. If the resulting number is greater than the number calculated for the defender, then the attacker scores a "hit" and the defender's Hit Points get lowered by 1. Otherwise, the defender scores the "hit" and the attacker's Hit Points are lowered by 1.

/.../

The RNG uses several floating-point calculations which are deadly in terms of performance.

Great post, HW!

Some have suggested that one reason for strange results would be when draws occur (when the random number is exactly the same as the defender´s number, which means the defender wins the round). Your post clearly shows that this can not be the case, since the range used is so high (1024). Also, if floating point numbers are used in this calculation, the chance of a draw is almost nil. Is this the case?

Is it possible for you to log the random numbers used in actual gameplay? This way it would be easy to check exactly how the battle outcome is calculated.
 
Status
Not open for further replies.
Top Bottom