Luck in Wesnoth: Irrationale

General feedback and discussion of the game.

Moderator: Forum Moderators

Sauron
Posts: 221
Joined: January 11th, 2006, 8:51 am
Location: Barad-Dur, Mordor
Contact:

Luck in Wesnoth: Irrationale

Post by Sauron »

Of course it is yet another luck thread that must be locked immediately, cause it will be undoubtedly turned into flame-war, won't it?

In my years with Wesnoth I never got convinced the official approach towards luck is something else than the matter of taste. To some extent I think the random-fundamentalists are terrorizing he whole community - including other developers and players. This should not take place. Not in the world of opensource.

It is astonishing that despite many/frequent luck rants nothing has changed some developers' fundamentalist approach towards the problem raised way to many times to be turned aside. I am almost sure there are people interested in changing the fight system - even among devs - although they're under peer-pressure and thus their dissatisfaction with the way the game is operating will never turn into fork. If someone from outside is needed to do something about it - or at least give a start to something finally happening - let it be little me for example.

I remade my infamous mod/fork. It might be still buggy - but I would like to invite everyone to test it, report detected bugs and describe if the change is for better. If among people who find the mod a footstep ahead will be a few programmers willing to pick up from where I finished - I will be very glad. Please contact me via pm or at sauron.wesnoth@gmail.com
Sauron
Customize yourself random factor in game:
GET my mod [available as C++ sourcecode and compiled Windows executable] for wesnoth 1.6.4
at http://saurons-mod.zor.org/
Mod thread
http://www.wesnoth.org/forum/viewtopic.php?t=26803
Sangel
Moderator Emeritus
Posts: 2232
Joined: March 26th, 2004, 10:58 pm
Location: New York, New York

Re: Luck in Wesnoth: Irrationale

Post by Sangel »

Sauron, your mod/fork is very welcome; thank you for remaking it. I would strongly encourage those who think that Wesnoth is too random to check it out and see if it suits their tastes better, and to provide feedback on any bugs or other necessary improvements.

In light of your clear willingness to produce a code fork, your comments regarding the Wesnoth developer community strike me as unnecessarily combative. There's no great conspiracy here - the majority of the Wesnoth developer and player community is happy with the luck system the way it is, and thus, there is no momentum for changing such a basic game-play element. That may or may not change in the future.

Thank you again for your work on this patch, and I look forward to seeing how it works out.
"Pure logic is the ruin of the spirit." - Antoine de Saint-Exupéry
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: Luck in Wesnoth: Irrationale

Post by Yogibear »

Ah good, i found this soon enough before things are exploding again :P .

I once gave special attention to a random thread getting out of hand, and i will do it again here. So for everyone who wants to post in here, understand this:

1.
The forum rules already state it but i will repeat again: Be polite :!: .

2.
If you have another opinion than the original poster or anyone else in the thread, that is of course ok. Note that in the same way, those opinions differing from yours are ok as well. Try to clearly mark those as opinions and not as facts unless you got evidence for it. Also note that "the RNG ruins games, because my mage did hit 0/3" is not counted as evidence.

3.
I will take the freedom to delete anything offending. As this is a "special" topic, my definition of offending might be a bit tighter than what you are used to on this forum.
Sauron wrote:Of course it is yet another luck thread that must be locked immediately, cause it will be undoubtedly turned into flame-war, won't it?
No, it won't
Sauron wrote:To some extent I think the random-fundamentalists are terrorizing he whole community - including other developers and players.
Because i followed the discussion in the past, i understand what makes you say that. This is actually the only reason i am not deleting it, as it in my opinion slightly crosses the "offending border". However, please note that this is asking for trouble and try to avoid it in the future.
Sauron wrote:This should not take place. Not in the world of opensource.
Indeed, it should not and i will do my best to prevent it this time. Everyone please contribute your part to that.

Edit: Edited for following my own rules :P .
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
Gaiyamato
Posts: 30
Joined: August 13th, 2009, 10:26 am

Re: Luck in Wesnoth: Irrationale

Post by Gaiyamato »

I personaly do not overly mind the way the system works. I think the main problem lies in how the to hit rolls are generated.

I have noticed a trend for the game to get kind of stuck on the rolls alittle (1.6.4) and for multiple attacks in a row to all hit/miss.
I've seen units with 80% defence on the tile they are located on attacked with multiple units with multiple attacks and for every attack against them to hit.
Then I've watched as a player attacked a unit with 20% defence with several units only for a 100% miss rate.

This does happen sometimes in games that use such a large degree of randomness in the mechanics.
But for it to be so consistent that I see this happen at least 2/5 games I play for at least one turn I would say there is something wrong here.

I'm not sure if this has been addressed in 17.3 or not. I did read that the server generates all random numbers now, not the client. Which is good.
But perhaps there is something in the actual instance the attack roll is made that is allowing numbers or number ranges to be re-used.
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: Luck in Wesnoth: Irrationale

Post by Yogibear »

Gaiyamato wrote:I have noticed a trend for the game to get kind of stuck on the rolls alittle (1.6.4) and for multiple attacks in a row to all hit/miss.
I've seen units with 80% defence on the tile they are located on attacked with multiple units with multiple attacks and for every attack against them to hit.
Then I've watched as a player attacked a unit with 20% defence with several units only for a 100% miss rate.
I have heard this countless times, but i have never (!) seen any evidence for it, not a single replay (not to talk about statistical evidence). Please show us a couple of replays, that behave statistically abnormal. If it happens as often as you state, it should not be a problem to find them.

From my personal experience, i can tell you that considering luck, i often have a biased view of my own games. There have been many times (and not only in the beginning, it still happens), where i look at the stats and they tell me the exact opposite of what i was perceiving. That's not a flaw in the code, it's a flaw in my mind :) .


Edit:
Gaiyamato wrote:But perhaps there is something in the actual instance the attack roll is made that is allowing numbers or number ranges to be re-used.
I can assure you this is not the case.
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
User avatar
JW
Posts: 5047
Joined: November 10th, 2005, 7:06 am
Location: Chicago-ish, Illinois

Re: Luck in Wesnoth: Irrationale

Post by JW »

I wholeheartedly support the effort put into this mod. Everyone dissatisfied with the current luck system in Wesnoth please try this mod once or twice and give feedback on it to help Sauron in his efforts.
Gaiyamato
Posts: 30
Joined: August 13th, 2009, 10:26 am

Re: Luck in Wesnoth: Irrationale

Post by Gaiyamato »

Yogi I have a whole bunch of replays I'm intending to upload and share at some point.
Several of them demonstrate this occurance, one in an almost humorous circumstance (5 players in a row missed 100% and then the ai in it's turn missed 100% with every attack also).

One thing though, it could also be an issue with OSs.
Windows does some strange things to random number generators in some languages.

In 1.6.4 the numbers are generated by the client, so therefore could be effected by the OS in this manner.
Mac and linux users wouldn't notice a difference between them, but some people on windows might.

Generate a number (will need to be a float) using a set seed in python (2.x) in mac or nix and then use the same seed to generate numbers on windows (any NT variant including XP).
You will notice that the decimals on a random number differ slightly after a certain point (this should not happen with seeded numbers, they should always be the same given the same seed).
If you are using 0-1 random number range (the default) and then simply multiplying it or applying rounding at certain points, then this would allow for the problem.

Not fixable in 1.6.4. But the method used in 1.7.3 just might well fix it depending on what exactly is going on.

All that said I am really surprised that you have never witnessed this Yogi.
I've only been playing for a few weeks and I am very used to luck going awry all the time in multiplayer games, and constant game restarts because of it.

One thing though. I have not yet seen this in single player games to the extremes I mentioned before.
I've seen it when the chances are 50/50 or 60/50, but that is to be expected.
But in single player games you can rely far more on the random aspects so long as you manage it.
Maybe this is because I havent played that many single player games yet.
Maybe it is a clue as to what is going on.
*shrugs*
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: Luck in Wesnoth: Irrationale

Post by Yogibear »

First of all: Generating random numbers is not a matter of the operating system, it rather depends on the code and maybe on the compiler used.

I have witnessed a lot of strange things, but the question is: Are they statistically relevant?

I give you a simple example: A unit has 4 strikes with a probability of 50%. So the probability to hit all 4 in a row is 6.25%. The same for missing all 4. This means, that there is a probability of more than 10% for a single unit and all hit or all miss to happen. If you got 10 of these units, and they all attack with the aforementioned conditions, you are indeed likely to experience this each and every turn.
But that's not flawed, it's statistics and it is to be expected.
Let's say the attacker has a chance to hit of 20%, how does that change things? There is a probability of 0.16% to do 0/4, the same goes for 4/4. So a probability of 0.32% for one or the other to happen. With 10 units around, i can expect this to happen every 30 turns, which for an average game length of 10 turns would be every third game.

Yes, i have seen this before. But i have never seen, that it happens every second turn (or whatever would be the statistical relevant number, i am not a mathematician). If you can show me a replay, that proves this, i will start to investigate and look for flaws in the code. But so far, nobody did.
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
Caphriel
Posts: 994
Joined: April 21st, 2008, 4:10 pm

Re: Luck in Wesnoth: Irrationale

Post by Caphriel »

Yogibear wrote:Let's say the attacker has a chance to hit of 20%, how does that change things? There is a probability of 0.16% to do 0/4, the same goes for 4/4. So a probability of 0.32% for one or the other to happen. With 10 units around, i can expect this to happen every 30 turns, which for an average game length of 10 turns would be every third game.
Actually, with a 20% cth, the chance of missing all 4 is 0.8^4, or 40.96% But that doesn't really affect your main point, which is that things that are perceived to be anomalous ought to be expected to occur more often than most people subjectively feel that they should. For instance 1 in 37 mages (2.7% of them) should be expected to miss all 3 attacks. Does this happen every game? Probably not. Does it totally ruin your day when it does? Probably. On the flip side, there's exactly the same chance for a spearman to hit your shaman in forest 3/3 and kill it. But there's also an 18.9% chance for it to hit twice. So there's an 18.9+2.7=21.6% chance for the spearman to hit at least 2 times (or the mage to miss at least two times), much higher than most people estimate it to be. 1 out of 5 mages will hit less than 2 times. Something to keep in mind when you attack a skeleton with a mage with 1 hp left :wink:
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: Luck in Wesnoth: Irrationale

Post by Yogibear »

Caphriel wrote:Actually, with a 20% cth, the chance of missing all 4 is 0.8^4, or 40.96%
Oops :oops: . Indeed, thanks for clarifying this.
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
Gaiyamato
Posts: 30
Joined: August 13th, 2009, 10:26 am

Re: Luck in Wesnoth: Irrationale

Post by Gaiyamato »

Yeah I get all that. It's cool.

I said 2 out of every 5 games for only one turn here and there each of those games.
If it happened every second turn I would have given up playing a long time ago. lol.

What is happeneing that for an entire turn almost every attack either hits or misses seemingly regardless of the odds.
I've watched a unit be hit dozens of times and die with 70%/80% defence because every single attack against it hit.
Even with 10 attacks against a unit with 80% defence only 2 should hit in probability.
But to see 15 or 20 hits in a row is a bit suspicious.
To see it happen once every few games is a little more suspicious.

And OS can affect random number generation. But all unix/Linux (mac) dont interfere.
Somewhere windows does. Once your past 8 decimal places usually.
So if your not careful with random number generation it can go a little funny.
Use doubles or limit the length of a float to 8. It is what most other game engines do.

The guys who work on the Unity 3D engine had an article they wrote on it somewhere.
Last edited by Gaiyamato on August 26th, 2009, 2:19 pm, edited 1 time in total.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Luck in Wesnoth: Irrationale

Post by Ken_Oh »

As much as I don't want to get into this conversation, I'd like to point out that what the RNG can do is pretty intuitive. The real mystery is how it affects the chances of a player winning or losing.

How can we figure that out? If I had infinite playing resources of 2 good players, I would give them the same scenario 1000 times, find the win/loss results from that, then inject 1 roll of bad luck into one side for each of another 1000 matches, find the win/loss results from that, then insert 2 rolls of bad luck, etc., etc.

I can't do this, so maybe there is an easier way?
Gaiyamato
Posts: 30
Joined: August 13th, 2009, 10:26 am

Re: Luck in Wesnoth: Irrationale

Post by Gaiyamato »

Could script it and run games with ai vs ai.

Remove all the terrain to nothing but flat and only give them units with 50% on flat.
Then have a script that asks for a random "luck" effect for ai player 1 when the game starts.
Just have it pop up a text box that you enter a number into (number of bad luck rolls).
Yogibear
Retired Developer
Posts: 1086
Joined: September 16th, 2005, 5:44 am
Location: Hamburg, Germany

Re: Luck in Wesnoth: Irrationale

Post by Yogibear »

Gaiyamato wrote:What is happeneing that for an entire turn almost every attack either hits or misses seemingly regardless of the odds.
I've watched a unit be hit dozens of times and die with 70%/80% defence because every single attack against it hit.
Even with 10 attacks against a unit with 80% defence only 2 should hit in probability.
But to see 15 or 20 hits in a row is a bit suspicious.
I am sure i have never seen this myself. I am very eager to have a look at that replay *hint*, *hint* :wink: .
Smart persons learn out of their mistakes, wise persons learn out of others mistakes!
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Luck in Wesnoth: Irrationale

Post by Dave »

Sauron wrote:Of course it is yet another luck thread that must be locked immediately, cause it will be undoubtedly turned into flame-war, won't it?
Actually I think to be fair, we rarely lock "luck threads" unless they clearly offer nothing new or are just openly flaming, etc. We've had a very large amount of discussion about luck on the forums. To make a comment like this is being unnecessarily combative.
Sauron wrote: In my years with Wesnoth I never got convinced the official approach towards luck is something else than the matter of taste. To some extent I think the random-fundamentalists are terrorizing he whole community - including other developers and players. This should not take place. Not in the world of opensource.
We've been very open to anyone experimenting with different ideas based on Wesnoth. I think the only real problem is none of these alternative luck ideas have ever caught on.

Heck, I implemented my own alternative: an "accuracy system" and put it in the main engine and invited people to try to make their own new eras around it and then try them out....but there was hardly any interest!

Anyone is welcome to try out their own luck systems, and we've had several attempts. None of these have really broadly caught on, in my view because of a combination of people behind the ideas not being passionate and resourceful enough to push them far enough, and the current system actually being good compared to alternatives.

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