Contemplating the RNG...

General feedback and discussion of the game.

Moderators: Forum Moderators, Developers

Post Reply
CarpeGuitarrem
Posts: 250
Joined: November 19th, 2007, 7:46 pm
Location: One among the Fence

Contemplating the RNG...

Post by CarpeGuitarrem » April 25th, 2008, 6:18 am

So I'd just experienced one of my luckiest RNG occurrences. One of my guys, absolutely down to almost no health, gets totally missed by three Orcish Grunts, and levels up by killing all of them off. That's when I realized just how powerful the RNG is...and just what the problem might be.

Is it possible that the RNG is a very polarizing force? In other words, you either get a lot of misses, or you get a lot of hits. Maybe the odds get satisfied in the grand scheme of things, but the similar results are clumped together, so that you miss when it matters. Maybe that's why people notice it. Because I've seen the all-miss scenario happen multiple times, which is very unlikely.

And I do know that this is an issue with RNGs in general. Is there a way to test this for sure?
Glory in Blood...Needs Programming Help!

If you have time, check out my ongoing serial story...
The Hidden: Secrets of the Future's Past

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Re: Contemplating the RNG...

Post by turin » April 25th, 2008, 6:45 am

People often think getting ten heads in a row while flipping a coin is an astonishingly rare event, but if you flip a coin a few thousand times (don't remember the exact number) it's extremely likely to happen...
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: 7067
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Contemplating the RNG...

Post by Dave » April 25th, 2008, 7:07 am

turin wrote:People often think getting ten heads in a row while flipping a coin is an astonishingly rare event, but if you flip a coin a few thousand times (don't remember the exact number) it's extremely likely to happen...
Just run this simple command in Linux:

Code: Select all

perl -e '$run = 0; for($i = 0;; ++$i) { if(rand() <= 0.5) { $run++; } else {$run = 0; } print "got run of 10 after $i\n" if $run == 10; }' |
It will simulate coin flipping and print out a message every time it gets a run of 10, saying how many flips it took to get it. Pipe it to head to only get the first few. It does indeed happen very quickly.

A run of 20 will take much longer (but you will see it after hundreds of thousands or millions of flips). A run of 30 is really very very unlikely, and a run of 50 is just never going to happen.

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

CarpeGuitarrem
Posts: 250
Joined: November 19th, 2007, 7:46 pm
Location: One among the Fence

Re: Contemplating the RNG...

Post by CarpeGuitarrem » April 25th, 2008, 4:27 pm

The actual odds of flipping a coin and getting three heads in a row is 1/8. 10 heads, 1/1024. 20 heads, 1/1,048,576. I call that highly unlikely. It will happen, if you run the thing for thousands, or millions, of iterations. But not a lot of times. And I get the feeling that runs are happening a lot more often than that. I recall that there was a computer version of RISK that I had played, and it suffered from the same weakness. You either got really good or really bad rolls.
Glory in Blood...Needs Programming Help!

If you have time, check out my ongoing serial story...
The Hidden: Secrets of the Future's Past

Dave
Founding Developer
Posts: 7067
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Contemplating the RNG...

Post by Dave » April 25th, 2008, 9:30 pm

CarpeGuitarrem wrote:And I get the feeling that runs are happening a lot more often than that.
Well I would suggest to you that they are not, and that it's an artefact of human thinking to think that.

This issue has been brought up several times and I have done rather thorough analysis of Wesnoth's approach. I have found that the pseudo-random numbers generated by Wesnoth are very close to true random numbers on all the platforms I've tested on.

I have asked people to come up with any real evidence of extreme cases of the generator, and have never seen anything the least bit convincing once.

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

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Re: Contemplating the RNG...

Post by turin » April 25th, 2008, 10:20 pm

CarpeGuitarrem wrote:The actual odds of flipping a coin and getting three heads in a row is 1/8. 10 heads, 1/1024. 20 heads, 1/1,048,576. I call that highly unlikely. It will happen, if you run the thing for thousands, or millions, of iterations. But not a lot of times. And I get the feeling that runs are happening a lot more often than that. I recall that there was a computer version of RISK that I had played, and it suffered from the same weakness. You either got really good or really bad rolls.
Except that measuring it like that, the streak only counts if it's on 3k+1, 3k+2, 3k+3. Your method discounts something like "H,T,H,H,H,T" counting as three heads in a row, because the first set of three flips was "H,T,H" and the second set was "H,H,T". ;)
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

torangan
Retired Developer
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Re: Contemplating the RNG...

Post by torangan » April 26th, 2008, 2:36 am

First rule about random numbers: do NOT trust your feelings. They will be wrong. It's a well known fact. Humans are made to recognize patterns, true random is a concept we can't grasp easily. The mind escapes the problem by noticing some runs or patterns. Truly random sequence will always contain patterns, a sequence without any patterns would actually be the complete opposite of random. (Of course, no pattern will span the whole sequence for random numbers, just parts. *g*)
WesCamp-i18n - Translations for User Campaigns:
http://www.wesnoth.org/wiki/WesCamp

Translators for all languages required: contact me. No geek skills required!

manuelb
Posts: 23
Joined: July 26th, 2007, 1:23 am
Location: Brazil

Re: Contemplating the RNG...

Post by manuelb » May 8th, 2008, 1:53 pm

I think the point is not if the randomization in Wesnoth is wotking or not. The point, for me and a lot of people is that it is too much randomization, it just ruin the game play. Wesnoth has a solid enogth gameplay to not need ramdomization, or at least not that much. It should be reduced by half, half of th terrain and etc.. efect should be constant in the atack result, and the other half could be ramdom based. But to do this Wesnoth would need floating point atack points.

User avatar
Sorrow
Posts: 230
Joined: July 25th, 2006, 12:07 am
Contact:

Re: Contemplating the RNG...

Post by Sorrow » May 8th, 2008, 4:31 pm

manuelb wrote:I think the point is not if the randomization in Wesnoth is wotking or not. The point, for me and a lot of people is that it is too much randomization, it just ruin the game play. Wesnoth has a solid enogth gameplay to not need ramdomization, or at least not that much. It should be reduced by half, half of th terrain and etc.. efect should be constant in the atack result, and the other half could be ramdom based. But to do this Wesnoth would need floating point atack points.
Balance would be completely and utterly destroyed.
Let us all measure in milliyards, that way we can all get along.

Replay Archive: http://www.wesnoth.org/wiki/Replays

manuelb
Posts: 23
Joined: July 26th, 2007, 1:23 am
Location: Brazil

Re: Contemplating the RNG...

Post by manuelb » May 8th, 2008, 4:37 pm

Sorrow wrote:
manuelb wrote:I think the point is not if the randomization in Wesnoth is wotking or not. The point, for me and a lot of people is that it is too much randomization, it just ruin the game play. Wesnoth has a solid enogth gameplay to not need ramdomization, or at least not that much. It should be reduced by half, half of th terrain and etc.. efect should be constant in the atack result, and the other half could be ramdom based. But to do this Wesnoth would need floating point atack points.
Balance would be completely and utterly destroyed.
why?

F50
Posts: 48
Joined: April 22nd, 2008, 9:59 pm

Re: Contemplating the RNG...

Post by F50 » May 8th, 2008, 4:42 pm

manuelb wrote:I think the point is not if the randomization in Wesnoth is wotking or not. The point, for me and a lot of people is that it is too much randomization, it just ruin the game play. Wesnoth has a solid enogth gameplay to not need ramdomization, or at least not that much. It should be reduced by half, half of th terrain and etc.. efect should be constant in the atack result, and the other half could be ramdom based. But to do this Wesnoth would need floating point atack points.
While I personally think that some means of slight luck-diminishing would be good, that is not well thought out. Perhaps doubling the number of strikes and doubling hp would do it, but that could change the "feel" of the game, and there may be more far-reaching effects. If someone comes up with a real neat idea in this vein, then I would go with it, but for now, I'm afraid I will just have to contend with the RNG. I don't find it to be too bad the majority of the time.

User avatar
Sorrow
Posts: 230
Joined: July 25th, 2006, 12:07 am
Contact:

Re: Contemplating the RNG...

Post by Sorrow » May 8th, 2008, 4:59 pm

manuelb wrote:
Sorrow wrote: Balance would be completely and utterly destroyed.
why?
Because everything is balanced for the current percentages, scaling everything down does not keep everything even. One example: outlaws would be useless.
Let us all measure in milliyards, that way we can all get along.

Replay Archive: http://www.wesnoth.org/wiki/Replays

manuelb
Posts: 23
Joined: July 26th, 2007, 1:23 am
Location: Brazil

Re: Contemplating the RNG...

Post by manuelb » May 8th, 2008, 5:36 pm

I am not talking about changing the percentages, but not aply the ramdomization on all percentage, use some of this with fixed effect, for example:
lets supose you have 60% percentage of chance to hit, so the probability, or fuzzy number would be 0.6, and let's supose your atack do a damage of 6 points on each strike. So, with the randomization, when the number of hits go to infinity, the the total damage would be 60% of the max possible damage.
But I would prefer the following:
1) Ensure at list 30% of the damage (2 ponits) at every time it tries to hit, plus a probability of 60% of geting more 50% total damage on each hit (30%+50%=80%) (4.8 points). When the number of hits go to infinity, the total damage would be 60% of possible damage.
I think it changes nothing on balance, just lower the ramdm effect.
Sorry for the not so good english.

User avatar
anakayub
Moderator Emeritus
Posts: 518
Joined: May 3rd, 2007, 12:44 pm
Location: Malaysia
Contact:

Re: Contemplating the RNG...

Post by anakayub » May 8th, 2008, 9:06 pm

You might be interested in tsr's no luck mod.

However, 1 disadvantage of having a deterministic (whether it's complete or partial) mode of damage is that it is difficult to compensate correctly for units with different strike rates but similar total damage, magic and marksman vs other attacks, etc. The RNG is pretty much a big part of the game if you like it or not, and most of the regulars like it just the way it is. But those who don't like it in the way it is now can help out with that mod, there is no problem with that.
Take a breath.

Post Reply