|
|
|
 |
 |
| View previous topic :: View next topic |
| Author |
Message |
Quantum Explorer
Joined: 20 May 2005 Posts: 10
|
Posted: Fri May 20, 2005 3:01 pm Post subject: Random number generator |
|
|
| I am curious about your random number generator. Will it be seeded or based on one's moves? Have you run any tests on how random it is? My concern comes from other games that have based it on the moves made. This can totally frustrate me. I detest making brilliant moves and getting burned vs making totally stupid moves and getting rewarded. Any chance you could seed it off of the microsecond counters on imput-output chips if thats still possible? |
|
| Back to top » |
|
 |
Zaimat Dev. Team

Joined: 08 Aug 2003 Posts: 352 Location: Canada
|
Posted: Tue May 24, 2005 11:41 pm Post subject: |
|
|
The random number generator is indeed seeded with the time which is the standard way of generating random numbers in a C/C++ program. And trust me it's pretty random.
Horizon relies a good bit on randomness which allows a lot of variety for different functions and situations when making decisions. So you never get the same game twice and makes the AI decisions harder to predict.
I hope that answers your question. _________________ Horizon - Lead Designer |
|
| Back to top » |
|
 |
Quantum Explorer
Joined: 20 May 2005 Posts: 10
|
Posted: Wed May 25, 2005 9:49 pm Post subject: |
|
|
Actually, I was refering to combat. The best way I can think of explaining it is with the following idea. Let's say you roll 2 dice. The chances of getting the following numbers is:
2 or 12: 1/36 each
3 or 11: 2/36 each, etc. to
7: 6/36.
Now this is simplified greatly (a binomial probability function would be more accurate), but the results should follow this bell shaped curve.
( skewed toward the higher probability in the binomial probability function)
What I have found is that in many games you would get the following:
2 or 12 about 10/36 times each etc. with
7: maybe once in a blue moon.
This could be that someone is lazy and not doing the random number generator everytime, or a programming glitch.
However, the fun for me is actually calculating odds in any strategy game. If it doesn't work correctly it messes up the whole stategy. I have had things with probability of less than 1/1000 happen repeatedly in a row. That is my reason for asking.
Also if you run your probability 100, 1000, or million times does it generally fit the curve especially with the 100 times? |
|
| Back to top » |
|
 |
Wraith Voyager

Joined: 16 Mar 2005 Posts: 5
|
Posted: Thu May 26, 2005 3:12 am Post subject: |
|
|
There are a lot of good random generators that can be used; I don't think you need to worry too much about whichever one they use not being random enough. None of these generators are really 'random', they're actually only pseudo-random, but you generally won't be able to tell the difference. I personally use the L'ecuyer method whenever I need random numbers, which has a relatively flat distribution curve and a period of ~2.3 * 10^18; which is very good. (basically, if you generated 1 million random numbers a second, it'd take 73,000 years before the sequence started repeating; i.e. it stopped appearing random). If you seem to get several unlikely results in a row, it isn't neccesarily a failure of the random number generator. Statistically, those things must happen, and it could just be mere coincidence that it happened to you at those times.
With regards to the dice thing; not every game uses a dice analogy. Some prefer a flat distribution curve (think of it as rolling one die of an arbitrary number of sides) as opposed to the more bell-like results that you'd get when generating multiple random numbers and adding them.
About the games that use random numbers "based on the moves made," usually, they don't really. It may appear that way, but really they're just saving the seed they use. It's an anti-cheating tactic, since you can't reload the game and get different results. But I've never liked it that much since you can still reload and do things in a different order to get a different random number result. Civ3 was an example of this. |
|
| Back to top » |
|
 |
Quantum Explorer
Joined: 20 May 2005 Posts: 10
|
Posted: Sun Jun 05, 2005 7:58 pm Post subject: |
|
|
| Yes, Civ 3 was one of the main ones I noticed problems for. I even recorded it and verified how out of wack it was. I wasn't sure of the reason, but I also started noticing it in others such as MOO2. I understand probability quite well, and I sometimes wonder how well they check individual results. However Civ 3 was the worst I have ever seen with random number generating to the point that I instituted my own 5% rule (Throw away the top and bottom 5%, ie in two dice, 12 and 2 etc.). It shouldn't have made a big difference, but it did. |
|
| Back to top » |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
 |
|
|
 |
|