Something is UP.

Discussion among members of the development team.

Moderator: Forum Moderators

User avatar
Ankka
Posts: 594
Joined: January 2nd, 2005, 2:40 pm
Location: Finland

Post by Ankka »

In Civilization 3 the RNG was made so that if you did everything in the same order again you got excectly the same results.

I wonder if it's the same in BfW: if you do no other battles before the mage one it will always be the same result..?

Just a thought, and I hope someone understood.
freecraft
Posts: 94
Joined: April 28th, 2005, 12:49 am
Location: Serbia
Contact:

Post by freecraft »

Yeap, it is called the "seed". Did you said 32!? OMG ... :)
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

@Cod: Do you really think the RNG on your machine is broken? Can you do some kind of stat test to see if it is?
Ankka wrote:In Civilization 3 the RNG was made so that if you did everything in the same order again you got excectly the same results.

I wonder if it's the same in BfW: if you do no other battles before the mage one it will always be the same result..?
Nope, that's not how it works.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
User avatar
Elvish_Pillager
Posts: 8129
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Re: Something is UP.

Post by Elvish_Pillager »

Cod wrote:For 31 CONSECUTIVE ATTEMPTS, I hit him no more than 2 times out of 4 with my magical attack.
:shock: Wow.
Cod wrote:On average, there is at least one incident per MP game where a character at 70 defense will be hit at least four, often five straight times.
First, why is it that almost every multiplayer game you play, you attack or have attacked 70% defense units? There's only a few of them...

Second, there's about a 1% chance of that happening, which means that in a game with at least 100 attacks against them (which is not a particularly large amount) that this should happen about once. So, it is statistically accurate in most cases, as long as there are a lot of 70% defense units around.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Quentin
Posts: 64
Joined: May 3rd, 2004, 8:05 am

Post by Quentin »

For 31 CONSECUTIVE ATTEMPTS, I hit him no more than 2 times out of 4 with my magical attack.
That's really too bad you played Wesnoth instead of playing roulette :lol:
scott
Posts: 5242
Joined: May 12th, 2004, 12:35 am
Location: Alexandria, VA

Post by scott »

Is there any reason to assume the RNG is not ergotic? We're assuming it is, right?
Hope springs eternal.
Wesnoth acronym guide.
ryn
Posts: 196
Joined: August 23rd, 2004, 4:01 am
Location: Israel

Post by ryn »

perhaps we could modify the 'random' number generator to keep the average deviation within a certain range from average? it would, of course, change a lot of things (such as how much you can rely on luck, etc) but it would keep people from complaining (I hope). This (and the range) could also be added as an option. There are technical difficulties involved, such as that the RNG is just a built in function which has no idea why it's being called, but it could be done (I think).
2B |! 2B = 3F
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

I've gotta say that considering how often I've seen people complain, and how little it is backed up by anything that looks like a rigorous mathematical criticism of the number generator, I am really jaded enough to disregard anything that looks the least bit 'anecdotal'. :)

However, perhaps just to please people we should switch the RNG to a uniform one rather than relying on rand() in the implementation's standard library.

GNU Go (http://www.gnu.org/software/gnugo/gnugo.html) seems to have a nice enough random number generator that we could poach and use. (Actually their developer wrote to me a long time ago and recommended we do precisely that; it sounds like he researched it pretty thoroughly).

Of course, even if we did this, we'd still get someone complaining about the RNG every month or two.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
SL
Posts: 70
Joined: May 8th, 2005, 1:15 am

Post by SL »

Personally, I love the Mersenne Twister.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Cod wrote:
Dave wrote: However, perhaps just to please people we should switch the RNG to a uniform one rather than relying on rand() in the implementation's standard library.

David
Who made the one currently being used?
Depends on your OS; the RNG used is the default one for whatever system your using. No specific RNG is actually packaged with Wesnoth.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Cod wrote:
Dave wrote: However, perhaps just to please people we should switch the RNG to a uniform one rather than relying on rand() in the implementation's standard library.

David

Who made the one currently being used?
The C Standard defines a function called 'rand()' which returns a random number. That's what we use.

It's up to the implementor of the C/C++ implementation to provide the rand() function, so rand() was written by the vendor that supplied the C standard library that was used in compiling the version of Wesnoth you're using.

That is to say,

- if you are using the Windows binary supplied, it was Microsoft
- if you are using the Mac binary supplied, it was probably Apple
- if you compiled on GNU/Linux or used a GNU/Linux binary, it was probably the GNU C compiler team.

Personally I would trust any of these vendors to be able to write a decent random number implementation. Apparently other people don't....
turin wrote: Depends on your OS; the RNG used is the default one for whatever system your using.
Well, not quite -- it depends on the C standard library used in compilation; not the OS. For instance, if you use Windows, there are C++ implementations available from Microsoft, Borland, and GNU, among others, each of these likely has its own standard library implementation, including rand(). Even with GNU/Linux, there is a compiler available from Intel, which I believe has its own standard library implementation (actually I'm not sure about this, it might just use the GNU implementation).

The basic point though is, are we going to decide we need to write our own sorting routines next, because we don't trust those supplied by the vendors? :)

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
SL
Posts: 70
Joined: May 8th, 2005, 1:15 am

Post by SL »

I've seen some bizarre results with the standard rand() in Borland's C++ 3.1 (which is pretty old, it compiles DOS programs), for instance. It didn't behave well with some seeds, instead doing strange things like having rand() return the same value over and over and over... That was the bizarrest one, but it also did other strange things.

It should be pretty simple to whip up a program to test to see if the RNG is putting out results which are fairly evenly distributed statistically. Of course we'd have to test with a bunch of different seeds, because it could give sensible results for some seeds and totally ridiculous results with others.
Woodwizzle
Posts: 719
Joined: December 9th, 2003, 9:31 pm
Contact:

Post by Woodwizzle »

Like Dave, I'm not convinced a new RNG is needed, but I would put in a vote for the Mersenne Twister if rand() does get replaced. As I understand it, it is public domain now (used to be GPL), so its certainly available. Also I think there are some Angband Variant(s) that use it. Angband makes extensive use of the RNG, more so than even most other roguelikes I believe. If its good enough for them, its most likely good enough for us.

However, I know nothing of the Go game's RNG implementation, and it could very well be significantly better than the Mersenne Twister. If the devs do go through with this, they should be extensively compared to each other so we get the best one for the job. Speed is probably the biggest factor to consider, but the ability to tweak it for balance and additional uses like the random character names, town names, and multiplayer maps would all weigh heavily too.
Signature dropped due to use of img tag
dtw
Posts: 478
Joined: September 27th, 2004, 1:32 pm

Post by dtw »

i do also serious doubts about the RNG sometimes - esp when it comes to shamens and thunderer units!
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

SL wrote: It should be pretty simple to whip up a program to test to see if the RNG is putting out results which are fairly evenly distributed statistically.
Indeed, and this has already been done by several people, including myself, all of whom found that the RNGs are good quality.

All we need is for someone to produce a program which shows that there is a serious problem with the RNG on a major platform for our purposes, and we will concede that we have a problem and try to do something about it.

But, no-one has yet done this...

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Post Reply