Question on randomness

General feedback and discussion of the game.

Moderator: Forum Moderators

Olm
Posts: 14
Joined: January 24th, 2005, 11:19 am
Location: Germany
Contact:

Question on randomness

Post by Olm »

I really like Wesnoth, but there is one thing that really annoys me, and i am not even sure if rightly so.

I cannot get rid of the impression, that the odds in fights are not what they are shown to be.

Don't get me wrong, I understand how chance works, and that it is perfectly possible to get 4 hits from one unit with only 40 % chance to hit. But I have the impression, this happens far to often for my enemy, and far to seldom for me. I know, that its easy to get such an impression, and I did not do a statistically significant study on this, but I tried it once with a mage, reloading again and again to see how often he would hit and I really did not get the impression that he hits more than two out of three times.

Thus my question: Are the chances tweaked, e.g. for increasing difficulty for the harder difficulty levels?

If you assure me, that this is not done, I will perform an analysis to either ease my mind, or find a bug.
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

Well, it has been assured to us in the past, so consider yourself invited to perform an analysis and find the bug.
Hope springs eternal.
Wesnoth acronym guide.
muxec
Posts: 119
Joined: September 21st, 2004, 5:02 pm

Post by muxec »

UTS! (Use The Source)

Congrats, you are 1000th wesnoth player who posted here about randomness.
Olm
Posts: 14
Joined: January 24th, 2005, 11:19 am
Location: Germany
Contact:

Post by Olm »

Thanks for the congratulations.
I searched the Forum and all I found on the topic was a minor flame war with a barely literate user, I didn't want to post there.

But looking into the sources seems to be a good advice, thanks.
User avatar
Doc Paterson
Drake Cartographer
Posts: 1973
Joined: February 21st, 2005, 9:37 pm
Location: Kazakh
Contact:

Post by Doc Paterson »

Olm wrote:Thanks for the congratulations.
I searched the Forum and all I found on the topic was a minor flame war with a barely literate user, I didn't want to post there.

But looking into the sources seems to be a good advice, thanks.
Well, there's this old one here-

http://www.wesnoth.org/forum/viewtopic. ... highlight=
I will not tell you my corner / where threads don't get locked because of mostly no reason /
because I don't want your hostile disease / to spread all over the world.
I prefer that corner to remain hidden /
without your noses.
-Nosebane, Sorcerer Supreme
User avatar
Thrawn
Moderator Emeritus
Posts: 2047
Joined: June 2nd, 2005, 11:37 am
Location: bridge of SSD Chimera

Post by Thrawn »

I just wait for luck to change, give me all the hits :wink:

As far as I can tell, after playing for long long time, it does eventually appear fair
...please remember that "IT'S" ALWAYS MEANS "IT IS" and "ITS" IS WHAT YOU USE TO INDICATE POSSESSION BY "IT".--scott

this goes for they're/their/there as well
User avatar
Ankka
Posts: 594
Joined: January 2nd, 2005, 2:40 pm
Location: Finland

Post by Ankka »

Thrawn wrote:I just wait for luck to change, give me all the hits :wink:

As far as I can tell, after playing for long long time, it does eventually appear fair
Indeed. In campaigns I usually even end up doing some more damage than the computer when compared to EV. Almost always.
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

Ankka wrote:Indeed. In campaigns I usually even end up doing some more damage than the computer when compared to EV. Almost always.
Are you sure it isn't that you just end up restarting the scenario when you get below EV?
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.
User avatar
Ankka
Posts: 594
Joined: January 2nd, 2005, 2:40 pm
Location: Finland

Post by Ankka »

Elvish Pillager wrote:
Ankka wrote:Indeed. In campaigns I usually even end up doing some more damage than the computer when compared to EV. Almost always.
Are you sure it isn't that you just end up restarting the scenario when you get below EV?
Umm... no, I guess.

Well, perhaps, since I hate losing high-leveled units.
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

There is nothing wrong with the randomness in Wesnoth. It's totally human perception that causes people to think there is.
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
User avatar
drachefly
Posts: 308
Joined: March 23rd, 2005, 6:01 pm
Location: Philadelphia, PA

Post by drachefly »

Does EV take into account the death of units partway through?

(I expect it does)

If it doesn't, then any good tactics will throw off the actual from the EV, in your favor, so it would look like you got lucky.
User avatar
Casual User
Posts: 475
Joined: March 11th, 2005, 5:05 pm

Post by Casual User »

Good afternoon!

Now, I'm willing to take Dave's affirmation there is nothing wrong with the randomness in Wesnoth at face value, but I think the randomness is fair but has too much deviation, i.e. it works out but it creates too many exceptions. Still, if anyone is willing to create a new random numbers generator...
ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

drachefly wrote:Does EV take into account the death of units partway through?
Yes and no. From src/statistics.cpp:

Code: Select all

attacker_stats().expected_damage_inflicted += bat_stats.damage_defender_takes * bat_stats.chance_to_hit_defender;
defender_stats().expected_damage_taken += bat_stats.damage_defender_takes * bat_stats.chance_to_hit_defender;
and this is applied for each swing actually attempted. If a skirmish is cut short because one of the combatants dies, no additional amounts are added to the EV.
If it doesn't, then any good tactics will throw off the actual from the EV, in your favor, so it would look like you got lucky.
Indeed.

The original idea behind the %-to-kill stats was actually that it was the first step in obtaining accurate expected values for the damage inflicted and taken. The latest version of the code in prkill derives the distribution function for damage dealt and received in a given battle, taking into account units dying, from which the expected values can be calculated accurately.

It is still a bit unclear exactly what the EV of damage dealt should be taken to mean, in the presence of attacks that kill.

However, there is an important inaccuracy in the current code. All the stored values are integers, so if an elf doing 5-4 damage at 50% chance to hit attacks and kills an opponent with 10hp after 3 swings, the current code will say it did 10hp while EV was 7.5, but the code will calculate EV as 6. So EV will always be underestimated. I can't think of a quick fix for this right now while we are in feature freeze, so this will likely have to wait for 1.0.
This quote is not attributable to Antoine de Saint-Exupéry.
fmunoz
Founding Artist
Posts: 1469
Joined: August 17th, 2003, 10:04 am
Location: Spain
Contact:

Post by fmunoz »

If you have a non integer value just take the integer part + add 1 with the attack chance
So an attack with 5 damage amd 50% to hit will add 2 half the time and 3 the other half.
Let the convergence work for you...
ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

fmunoz wrote:If you have a non integer value just take the integer part + add 1 with the attack chance
So an attack with 5 damage amd 50% to hit will add 2 half the time and 3 the other half.
Let the convergence work for you...
Exactly, see the patch I posted to the dev mailing list. However, as I said, I can't think of a quick fix right now -- I'm not 100% certain grabbing more random numbers isn't going to resurrect some of the issues with randomness, like suddenly we have subgroup effects, or replays break.
This quote is not attributable to Antoine de Saint-Exupéry.
Post Reply