## RNG produces proper distribution. But that isn't everything

Discussion of all aspects of the game engine, including development of new and existing features.

Moderators: Forum Moderators, Developers

lipk
Developer
Posts: 631
Joined: July 18th, 2011, 1:42 pm
Location: Here and there and everywhere

### Re: RNG produces proper distribution. But that isn't everyth

Is there any chance to get option in MP lobby "RNG mode" with options: "Modified linear congruential", "Hyperheometric"?
Not sure what you mean by that. Hypergeometric distribution is a probability distribution, the linear congruential generator is an algorithm.

Xudo
Posts: 561
Joined: April 3rd, 2009, 5:26 pm

### Re: RNG produces proper distribution. But that isn't everyth

lipk wrote: Not sure what you mean by that. Hypergeometric distribution is a probability distribution, the linear congruential generator is an algorithm.
Okay. I will try to say it in other way.

I believe what main reason behind this topic is "Wesnoth RNG is unfair". Nobody cares about math until it gets hurts.

Hypergeometric distribution is a very "fair" way to modify RNG. Of course noone will going to change all game to allow it.

So I think it is a good idea to give a choice to user: whether he wants to use "fair" random or "unfair". This choice should be shared and visible for all players -> make an option in MP lobby (create new game dialog).

lipk
Developer
Posts: 631
Joined: July 18th, 2011, 1:42 pm
Location: Here and there and everywhere

### Re: RNG produces proper distribution. But that isn't everyth

Hypergeometric distribution is a very "fair" way to modify RNG.
That is what I don't understand. Do you want the random generated numbers to follow hypergeometric distribution? No offense, but that's just plain silly. Wesnoth needs uniform distribution so that hit chance depends only on the size of the appropriate subset of the sample space, and can be adjusted by changing that. To illustrate the problem imagine the following: let's assume that the RNG produces numbers between 1-100. If the generated numbers follow a uniform distribution, all 100 numbers have exactly the same chance to appear. As a result you have the double chance to get a number between 1-80 than between 1-40. Now imagine that the RNG produces some different distribution, so not all numbers have the same chance to be generated. For example, let's say that it generates only numbers smaller than 10 or bigger than 90. Now what? The chances of getting a number between 1-80 are exactly the same as getting one between 1-40. Is that better? Surely not. This applies to any probability distribution other than uniform, since those all have more and less "favored" atomic events.

Xudo
Posts: 561
Joined: April 3rd, 2009, 5:26 pm

### Re: RNG produces proper distribution. But that isn't everyth

lipk wrote:Wesnoth needs uniform distribution so that hit chance depends only on the size of the appropriate subset of the sample space, and can be adjusted by changing that.
Wesnoth is not cryptographical system. It is a game.
Only reason behind HGD is to make feel what unit have (for example) 60% chance to hit, not to make 60% of all of this attacks being hit.

lipk
Developer
Posts: 631
Joined: July 18th, 2011, 1:42 pm
Location: Here and there and everywhere

### Re: RNG produces proper distribution. But that isn't everyth

xudojnik wrote:
lipk wrote:Wesnoth needs uniform distribution so that hit chance depends only on the size of the appropriate subset of the sample space, and can be adjusted by changing that.
Wesnoth is not cryptographical system. It is a game.
That's not cryptography, it's high school mathematics Maybe I wasn't clear enough, though. 30% hit chance means that the RNG spits a number smaller than 30. Naturally, you'd expect 60% to be exactly twice that chance. However, if the generator doesn't produce uniform distribution, that will not be the case. 60% chance won't be 30%*2. You think you could settle the complaints this way?

What you have a point in is that people may feel that the RNG is unfair at times, but unlike you, I don't believe that it's the machine's fault. In my opinion, it's simple psychology; people just interpret the numbers in a wrong way. 60% is a synonym of "ideal circumstances", although it's barely more than half-half chance to hit or miss (in case of two attacks, the most probable scenario is one hit). I suspect that in many people's mind 70% is equal to "sure hit", despite it means only two out of three.

And of course you still haven't explained how would your suggestion help matters...

Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

### Re: RNG produces proper distribution. But that isn't everyth

i'm a bit confused...

you want a 60% CTH not mean that the unit has 60% chances to hit, but a higher chance so people feel the RNG is more fair ???

i'm confused... we don't lie, we say you have 60% chances, and you do have 60% chances to hit. if you feel you unit doesn't hit enough you need to increase its CTH, and that's a MP balance problem, not a coding problem.

If we change the RNG to not be linear, the whole game balance needs to be redone...
Fight key loggers: write some perl using vim

Xudo
Posts: 561
Joined: April 3rd, 2009, 5:26 pm

### Re: RNG produces proper distribution. But that isn't everyth

Have you ever read about hypergeometric distribution?
It not about increasing chance to hit. It is about providing reliable chance to hit, which will stay same regardless of number of draws.

Now situation much different. You can get "good luck" and hit unit with 70% of defence 3/3 times , or you can get "bad luck" and miss 3/3 times with mage.

zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

### Re: RNG produces proper distribution. But that isn't everyth

xudojnik wrote:It not about increasing chance to hit. It is about providing reliable chance to hit, which will stay same regardless of number of draws.

Now situation much different. You can get "good luck" and hit unit with 70% of defence 3/3 times , or you can get "bad luck" and miss 3/3 times with mage.
And if you provide "reliable chance to hit", the probability of missing 3/3 times with a mage would no longer be 2.7%, but lower than that, or even 0% depending on what exactly you're suggesting.

Currently, you constantly face situations where you have to consider the risk of missing 3/3 with a mage (or similar), and have to choose whether to take the risk or find a safer alternative. If what you're suggesting means that the probability of your mage missing 3/3 would be decreased, then it most certainly is about increasing chance to hit.

AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

### Re: RNG produces proper distribution. But that isn't everyth

I suppose you intend something like the warcraft3 chance-to-hit system, which shifts the *probabilities* (not the numbers) depending on how long the unit's miss streak is. (and works out to approximately the same overall number of hits, so the initial chance to hit must be lower than stated)

Xudo
Posts: 561
Joined: April 3rd, 2009, 5:26 pm

### Re: RNG produces proper distribution. But that isn't everyth

AI wrote:I suppose you intend something like the warcraft3 chance-to-hit system
You are right. I proposed exactly this.
This link was in my first post of this thread, but who cares.

taptap
Posts: 980
Joined: October 6th, 2011, 5:42 pm

### Re: RNG produces proper distribution. But that isn't everyth

If the author had not written on the blog first and had his preferred RNG been introduced silently into Wesnoth or another game, he might have noticed that the complaints about the RNG would have remained exactly the same. Or if it were introduced with announcement soon you would have people complaining that the new one is even worse. Isn't it telling, that people are jumping on a blogpost, that asks for better randomness, with their usual request for less randomness (i.e. shorter streaks than would be expected in a random distribution)? Also, it might be quite interesting to give the number how many random numbers are involved in the "simple tests" that reveal the flaw of the Wesnoth RNG as compared to the number of random numbers generated in the collected games of Rigor (for example). To me it is quite obvious that confirmation bias is a force several magnitudes larger than any flaws.
I am a Saurian Skirmisher: I'm a real pest, especially at night.

AxalaraFlame
Posts: 690
Joined: December 4th, 2011, 1:07 pm

### Re: RNG produces proper distribution. But that isn't everyth

Find it. It is called "irrationaire", written by sauron. It is a good idea of introducing warcraft3 RNG, I would say. However, Dave's preferences of a game founded upon pure probability calculation also has nice advantages. But "luck management" could hardly be explained and taught to the players; they could only learn it themselves, so I would prefer to settle down the expected damage within a satisfactory range.

Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

### Re: RNG produces proper distribution. But that isn't everyth

Reminder: The topic of this thread is Does Wesnoth use a "Linear Congruential RNG", and if so, is there a problem with its sequences not having enough randomness. The topic is not how much influence should Luck have in Wesnoth. Failure to stay on the topic will result in your posts being split into a separate topic or deleted.

(This reminder is mostly directed at xudojnik)
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."