## how does luck work in wesnoth?

Share and discuss strategies for playing the game, and get help and tips from other players.

Moderators: Forum Moderators, Developers

quarague
Posts: 2
Joined: September 19th, 2011, 7:35 pm

### how does luck work in wesnoth?

I would like to know how exactly the math in the random works, or more accurately confirm or deny my guess of how it works. I looked through the forums and found articles explaining why there is luck in Wesnoth and why people like or dislike it but not how it works.
Let me explain what I mean by an example. If this is not out here and my assumptions are correct I hope this is useful as an example of how to do the computations.
Suppose your unit gets 50% terrain defense and has 3 hits for 6 damage, enemy unit has 40% terrain defense and 2 hits with 8 damage each.
I thought this means you have 3 independent tries to hit each succeeding with 100-40=60% probability and the enemy has 2 with 50% chance of succeeding. We will assume both units have enough hitpoints so that neither of them can die from the attacks. Using some basic finite probability math this would lead to the following:
Enemy suffers 3 hits = 18 damage with 0.6^3=21.6% probability, enemy suffers 2 hits = 12 damage with 3*0.6^2*0.4=43.2% probability, enemy suffers
1 hit=6 damage with 3*0.6*0.4^2=28.8% probability and enemy suffers 0 hits=0 damage with 0.4^3=6.4% probability.
Completely independent of how much damage you dealt your unit will suffer 2 hits=16 damage with 0.5^2=25%, 1 hit=8 damage with 2*0.5*0.5=50% and 0 hits=0 damage with 0.5^2=25% probability.

The reason I wrote this post is that I subjectively feel when I play campaigns against the AI I do not get these probabilities, ie I think the dice are loaded to my disadvantage and I actually do less damage than this example would suggest and suffer more from the enemy.

averyimaginativename
Posts: 245
Joined: August 21st, 2010, 12:40 pm
Location: /dev/null

### Re: how does luck work in wesnoth?

quarague wrote:The reason I wrote this post is that I subjectively feel when I play campaigns against the AI I do not get these probabilities.
Seeing as this is your first post, I'm going to guess you're fairly new to Wesnoth. Are you aware of the statistics screen?

If you press S, you'll get a table showing your damage inflicted and received and their variation from mathematically expected amounts both for the full campaign and the turn you're playing. Using this, you'll find that (generally) it is just a subjective feeling.

[ETA - there was a bug in the stats screen around (I think) 1.9.2. If you get wildly odd %ages it's a bug).
UMC Story Images web gallery

On an indefinite Wesbreak for health reasons - please only try to get my attention for UMC story images website issues.

quarague
Posts: 2
Joined: September 19th, 2011, 7:35 pm

### Re: how does luck work in wesnoth?

I wasn't aware of that, thanks. Checking the last two maps I played: damage inflicted -6%, damage taken +2% for the first and -10% and +1% for the second. So it looks like I'm somewhat right I will observe further .

Caphriel
Posts: 994
Joined: April 21st, 2008, 4:10 pm

### Re: how does luck work in wesnoth?

I thought this means you have 3 independent tries to hit each succeeding with 100-40=60% probability and the enemy has 2 with 50% chance of succeeding.
This is indeed how it works. In your current campaign you've experienced negative inflicted damage overall and slightly positive taken damage overall, but the AI does not "cheat" and mess with the probabilities. Your current results are just a random fluctuation. The last time I played a campaign, I finished with about +25% inflicted and +5% taken

Velensk
Multiplayer Contributor
Posts: 3984
Joined: January 24th, 2007, 12:56 am

### Re: how does luck work in wesnoth?

I will note that the stats screen has some inaccuracies, and these inaccuracies will become obvious in any longer campaign.
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."

WanderingHero
Posts: 168
Joined: May 30th, 2011, 2:03 pm
Location: Uk, London

### Re: how does luck work in wesnoth?

As far as I can tell, the rng is fair BUT the game uses it so much you will invariably see all attacks hitting or missing and if a mission goes on long enough, theirs always the chance luck will be a ***** and screw you over with an all hit/all miss.

Did you just play HTT? Because the first mission there is HORRIBLE for newbies (weee run away from the horde of enemies while watch your ai allies slowly take their turns) and quite easy to loss due to luck if you try to fight. Start with Orcish Incursion.

Oh and while your starting out, or if you get RNG screwed in an especially ridiculous fashion you could take advantage of the auto save feature... just don't become dependent on it.

MRDNRA
Posts: 212
Joined: September 11th, 2009, 5:06 pm

### Re: how does luck work in wesnoth?

I've had some very lucky turns and some very unlucky turns during campaigns, but over time I find they tend to even themselves out. I was actually playing a campaign the other day, got 4/4 hits with one of my units when it was defending with only a 30% chance to hit! On the other hand I've also had 4/4 misses using a red mage (with 70% chance to hit!)

Felix_Nephthys
Posts: 2
Joined: September 5th, 2011, 5:26 am
Location: Southern California, USA

### Re: how does luck work in wesnoth?

averyimaginativename wrote:Seeing as this is your first post, I'm going to guess you're fairly new to Wesnoth. Are you aware of the statistics screen?

If you press S, you'll get a table showing your damage inflicted and received and their variation from mathematically expected amounts both for the full campaign and the turn you're playing. Using this, you'll find that (generally) it is just a subjective feeling.

[ETA - there was a bug in the stats screen around (I think) 1.9.2. If you get wildly odd %ages it's a bug).
This actually clarified that part of the statistics screen for me. I tried searching the manual and couldn't find anything there and just by luck I happened to come across this thread so thanks.

ayearhasgone
Posts: 56
Joined: October 28th, 2010, 5:36 pm

### Re: how does luck work in wesnoth?

The way luck works is pretty simple-- it simply means your powerful arch mage misses all his shots and a weak enemy unit kills your leader on a castle tile.

Kidding, kidding...

Aelaris
Posts: 77
Joined: January 21st, 2010, 3:22 am

### Re: how does luck work in wesnoth?

Luck is what makes this very different from, say, Chess. In chess, you move a piece, and that will be what happens. In Wesnoth, your units may or may not succeed, and you should plan for both cases.

Perhaps what you perceive as constant bad luck is you taking big chances when you have, say, an overall 70% chance to succeed.

If you have a 70% chance to succeed normally, and a 30% chance to lose horribly, then you're going to remember how one in three times you lost some very valuable unit, while ignoring all the times it didn't happen.

I've seen some people get very whiney, because they feel betrayed when an urfserker with an 80% chance to kill something dies. They feel entitled to victory there, but 80% chance does not make you automatically win. You need a 100% chance (with maniacal laughter) for that. If it's an 80% chance, expect 1 urfserker in 5 to bite it.

Campaigns train this badly, in my opinion, especially if people use savegames to ignore that 1-in-5 chance.
"Let's all agree that Konrad simply represents 'Konrad and his female ninja bodyguards'." - Gambit, explaining how a character could also be a battalion.