## [interface/engine] Advanced damage inflicted/taken hit count statistics

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderators: Forum Moderators, Developers

Forum rules
Before posting a new idea, you must read the following:
Mawmoocn
Posts: 120
Joined: March 16th, 2019, 3:54 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

josteph wrote:
May 24th, 2019, 12:02 pm
What do all these numbers mean? I'm guessing it means that there were 15 strikes at 60% cth, of which 10 hit and 15-10=5 missed, so the actual hit rate was 10/15=67% and the ratio between actual and expected number of hits was 111% (10/9). Is that right?
Yes.
josteph wrote:
May 24th, 2019, 12:02 pm
Please try to explain more clearly next time.
I’ll try, though explaining uncertainty, isn’t my forte...
josteph wrote:
May 24th, 2019, 12:02 pm
How did you get at the number 628%? I guess you added the "111%" values for every cth value
It’s from the sum of adding these percentages
Mawmoocn wrote:
May 19th, 2019, 1:58 pm
Inflicted (number of strikes)
...
(60% Stats) (1.11111111111111) 101% 67% 10 = (9 / 15)
...

josteph wrote:
May 24th, 2019, 12:02 pm
but the sum doesn't have any meaningful interpretation.
I thought you wanted to calculate true luck, based from numbers that a player did.

There’s no easy way to determine luck, when its calculated by overall CTH values.

So I tried to make independent adjustments, before merging their values.
30% CTH and 80% CTH, as an example, have very different values, their luck probability will interfere wit each others average.

Maybe I’m overthinking this.
josteph wrote:
May 24th, 2019, 12:02 pm
Mawmoocn wrote:
May 23rd, 2019, 2:08 pm
josteph wrote:
May 19th, 2019, 9:43 pm
What do you think should be shown for each of the three possible results of a single battle between an Orcish Grunt and a Dark Adept, both on flat terrain?
So we’re trying to list the probability of each hit strike?
I'm sorry but I still don't understand what you're trying to say. Please explain yourself clearly and concisely.
Orcish Grunt and Dark Adept have different ways to be calculated due to their own different hit rate and they both can’t retaliate with each other.

I assumed "each of the three possible results" meant, explaining probability for every hit chance.

Basically, I didn’t understand how to explain it. Sorry for the trouble cause.

josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

Mawmoocn wrote:
May 24th, 2019, 1:34 pm
I thought you wanted to calculate true luck, based from numbers that a player did.

There’s no easy way to determine luck, when its calculated by overall CTH values.

So I tried to make independent adjustments, before merging their values.
30% CTH and 80% CTH, as an example, have very different values, their luck probability will interfere wit each others average.

Maybe I’m overthinking this.
You're right that the cth has to be taken into account, so a miss of a 30% strike would weigh less than a miss of an 80% strike, but that's what already happens. The number of hits at 70% is multiplied by 0.7, the number of hits at 30% is multiplied by 0.3.
Mawmoocn wrote:
May 24th, 2019, 1:34 pm
Orcish Grunt and Dark Adept have different ways to be calculated due to their own different hit rate and they both can’t retaliate with each other.

I assumed "each of the three possible results" meant, explaining probability for every hit chance.

Basically, I didn’t understand how to explain it. Sorry for the trouble cause.

I meant: suppose a Grunt attacks an Adept. There are three possible results: two misses, two hits, one hit and one miss. What would the UI show in each case? I asked this to try and get you to explain your proposal on a well-defined simple example. At this point, however, I'd like to ask a different question: do you have any comments on the implemented algorithm?

Mawmoocn
Posts: 120
Joined: March 16th, 2019, 3:54 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

josteph wrote:
May 24th, 2019, 2:13 pm
There are three possible results: two misses, two hits, one hit and one miss.
That's actually 4 results.
josteph wrote:
May 24th, 2019, 2:13 pm
do you have any comments on the implemented algorithm?
Disclaimer: My comment is heavily based on assumption that something could go wrong.

Average result would mess up with luck or percentage shown.

I think most of my comments doesn't relate to implemented algorithm...

I think percentage colors are confusing?

12% can be green but why is it considered positive?
Some percentages show red at higher percentages?

Their basis for these are luck?

I guess it needs consistency on coloring percentages?

josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

This has been merged to 1.15. Screenshot: https://github.com/wesnoth/wesnoth/pull ... -500751546

Question. The percentages are colored on a red-to-green scale. Currently, they're colored so green means the RNG favored the opponent's, that is, if you win and the stats are green that means you won in spite of the RNG, you won due to skill, not luck. Two alternatives have been proposed: to color it so RNG means the RNG favored the player (the reverse of the current coloring, green means you were lucky, red means the opponent was lucky), or to color it so green means the actual result was close to the expected value and red means it was far. Any preferences or other ideas?

CrossBreed
Posts: 18
Joined: October 21st, 2010, 5:04 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

First of all: I haven't read through the entire topic, but maybe that is a plus!
I think the statistics are very confusing. Would it perhaps be possible to add in-game explanations? Maybe when hovering the mouse over, or through a "Details" button that pops up another, larger window?
The same goes for the coloring. Without an explanation, it's very hard to understand.

From this image, I still don't understand the numbers. You attacked with a Silver Mage's magical attack, which means 70% hit rate. You hit 3/4 (expected value 2.8 ). Then what is 34.8%? And what 24.0%?

josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

Hi!

The hits table already has tooltips: https://github.com/wesnoth/wesnoth/blob ... #L567-L568

In English, 34.8% is the probability of the Silver Mage hitting 0, 1, or 2 times. 24% is the probability of the Silver Mage hitting 4 times.

CrossBreed
Posts: 18
Joined: October 21st, 2010, 5:04 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

Okay, got it. And the colors just scale from 0% (green) to 100% (red) for the first statistic, and the other way around for the second percentage, right?

How would i interpret the numbers?
If the first percentage is high, it means i got lucky, if it's low, it means i got unlucky.
For the second one the other way around: high -> unlucky, low -> lucky.
Or is there more it can tell me? Sorry if this was previously explained (i can't seem to find it)

sergey
Posts: 439
Joined: January 9th, 2015, 9:25 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

@josteph
This numbers are another measure of luck. However, damage statistics is more precise measure of luck, isn't it? Because luck is not only hit or miss, but how much damage was dealt/not dealt by the hit. Even more precise measure of luck would be statistics of important hits (kill, advancement).

But the idea here is actually opposite, isn't it? RNG doesn't know what hits were important or not, so showing hit stats would be less frustrating comparing to damage stats. (UPD. On the long run we can expect hits stats to be more "fair" comparing to damage stats. But that's not guaranteed.)

That was just observations. I think having both hit stats and damage stats are better than only damage stats.

What concerns me is complexity of the table. I don't think that it is user friendly. Damage stats shows how greater or lesser the actual damage is comparing to the expected damage measured in percents of the expected damage. But the hits stats shows two values (instead of one), which are probability of hitting less or more comparing to the expected number of hits. First of all, those values are harder to understand, they are not so intuitive. Secondly, they provide inconsistent user experience.

I can imagine thoughts of the users:
Why only one % value is used for damage and two % values for hits? Why damage % is white and hits % are green / red? Why damage % means ratio of damages and hits % means probability?

Perhaps it would be better to use the same approah as for damage stats, don't you think?

Update
This topic made me think more about RNG and luck. My conclusion is that luck is not only the RNG "fairness", but also importance of the RNG outcome in a particular situation. Hits stats is more about RNG "fairness", while damage stats is more about luck. At least how we, as a human beings, recognizing luck.

Example
Let's say I can make two attacks 40-1 and 8-5 all with 50% chance to hit.
Case #1
40-1 hits, 8-5 all misses. damage (actual / expected) = 40 / 40 , hits (actual / expected) = 1 / 3
I feel that I had an average luck.
Case #2
40-1 misses, 8-5 all hits. damage (actual / expected) = 40 / 40 , hits (actual / expected) = 5 / 3
I feel that my luck was exactly the same.
Last edited by sergey on June 11th, 2019, 5:12 pm, edited 2 times in total.
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.

josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

CrossBreed wrote:
June 11th, 2019, 3:48 pm
Okay, got it. And the colors just scale from 0% (green) to 100% (red) for the first statistic, and the other way around for the second percentage, right?

How would i interpret the numbers?
If the first percentage is high, it means i got lucky, if it's low, it means i got unlucky.
For the second one the other way around: high -> unlucky, low -> lucky.
Or is there more it can tell me? Sorry if this was previously explained (i can't seem to find it)
Don't apologize

Yes, you understood correctly. In inflicted, the first number is green-to-red (0% would be green, 100% would be red) and the second red-to-green. In taken, the first number is red-to-green and the second green-to-red. This way, green means the player was unlucky and red means the player was lucky. The commit message explains this in different words: https://github.com/wesnoth/wesnoth/comm ... c9c3f93e39

josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

sergey wrote:
June 11th, 2019, 4:32 pm
@josteph
This numbers are another measure of luck. However, damage statistics is more precise measure of luck, isn't it? Because luck is not only hit or miss, but how much damage was dealt/not dealt by the hit. Even more precise measure of luck would be statistics of important hits (kill, advancement).

But the idea here is actually opposite, isn't it? RNG doesn't know what hits were important or not, so showing hit stats would be less frustrating comparing to damage stats.

That was just observations. I think having both hit stats and damage stats are better than only damage stats.
The RNG is rolled once per strike. The hits table shows the statistics in terms of strikes, that is, the "raw" statistics, not weighted by the number of hitpoints of the attack. The statistics of only "important" strikes would indeed be interesting, but it's not easy to come up with a workable definition of "important". With units like the Dwarvish Dragonguard basically every time they play it's an important attack, isn't it, in terms of the effect on play?
sergey wrote:
June 11th, 2019, 4:32 pm
What concerns me is complexity of the table. I don't think that it is user friendly. Damage stats shows how greater or lesser the actual damage is comparing to the expected damage measured in percents of the expected damage. But the hits stats shows two values (instead of one), which are probability of hitting less or more comparing to the expected number of hits. First of all, those values are harder to understand, they are not so intuitive. Secondly, they provide inconsistent user experience.

I can imagine thoughts of the users:
Why only one % value is used for damage and two % values for hits? Why damage % is white and hits % are green / red? Why damage % means ratio of damages and hits % means probability?

Perhaps it would be better to use the same approah as for damage stats, don't you think?
I don't think showing the result of dividing actual number of hits by expected number of hits (like 3 by 2.8 ) is very interesting, really. It will always be a number close to 1.0 because of regression to the mean. (This is also true for the damage table. When you view the "All Scenarios" stats of a campaign the damage stats are always around +1%/-1%. From a UI point of view, there's no reason to show the damage percentage if it's almost always the same value.)

Yes, I don't expect users to guess what the percentages mean (although Konrad2 did, correctly). That's why there's a tooltip explaining what they are.

I wonder if we should make the damage table look like the hits table, that is, have it show two percentages like the hits table does. Maybe that makes sense, but something tells me this idea will be a hard sell

sergey
Posts: 439
Joined: January 9th, 2015, 9:25 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

josteph wrote:
June 11th, 2019, 4:56 pm
The statistics of only "important" strikes would indeed be interesting, but it's not easy to come up with a workable definition of "important".
I don't even sure it is possible. E.g. if a unit dies where chance to kill was 1% for that particular attack, but there were 2 other units ready to finish him anyway. That kill was very unlikely, but not so important.
Another example. Mage missed 3 times in a row and didn't kill a unit, but that was not critical. Or mage missed 3 times and because of that the whole plan was ruined.
josteph wrote:
June 11th, 2019, 4:56 pm
I don't think showing the result of dividing actual number of hits by expected number of hits (like 3 by 2.8 ) is very interesting, really. It will always be a number close to 1.0 because of regression to the mean. (This is also true for the damage table. When you view the "All Scenarios" stats of a campaign the damage stats are always around +1%/-1%. From a UI point of view, there's no reason to show the damage percentage if it's almost always the same value.)
I proposed to show 0%, not 1. (actual / expected - 1) * 100%. Also I updated my previous post with an example that shows why it may make sense.
josteph wrote:
June 11th, 2019, 4:56 pm
Yes, I don't expect users to guess what the percentages mean (although Konrad2 did, correctly). That's why there's a tooltip explaining what they are.

I wonder if we should make the damage table look like the hits table, that is, have it show two percentages like the hits table does. Maybe that makes sense, but something tells me this idea will be a hard sell
Please don't do that. Majority of the players are not mathematician professors.
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.

josteph
Developer
Posts: 740
Joined: August 19th, 2017, 6:58 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

sergey wrote:
June 11th, 2019, 4:32 pm
Example
Let's say I can make two attacks 40-1 and 8-5 all with 50% chance to hit.
Case #1
40-1 hits, 8-5 all misses. damage (actual / expected) = 40 / 40 , hits (actual / expected) = 1 / 3
I feel that I had an average luck.
Case #2
40-1 misses, 8-5 all hits. damage (actual / expected) = 40 / 40 , hits (actual / expected) = 5 / 3
I feel that my luck was exactly the same.
In general, if you make six attacks with 50% cth and get one hit and five misses, then you've been very unlucky. The probability of this outcome is 1/64. That's also the probability of one miss and five hits, but in that case you'll have been very lucky.

It's true that if you consider just the damage dealt then you'd view this as neutrally lucky, but so what? Examples cut both ways. Imagine that a Thunderer and a Dragonguard both attack a unit on 50% defense. The Thunderer misses and the Dragonguard hits. How lucky was that, neutrally lucky (if we count by hits) or lucky (if we count by damage)?

Mawmoocn
Posts: 120
Joined: March 16th, 2019, 3:54 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

josteph wrote:
June 11th, 2019, 2:20 pm
Currently, they're colored so green means the RNG favored the opponent's, that is, if you win and the stats are green that means you won in spite of the RNG, you won due to skill, not luck.
We can’t actually compare your luck against your enemy. As your luck is independent from their luck. Skill can’t be realised with these stats alone.

Hypothetically if we do want to compare it, we need to get an average hit percentage for the enemy and compare it to the player’s average. Colors would be coloured based on who was the highest percentage of hitting. It could pose some problems if the enemy never gets lucky .
josteph wrote:
June 11th, 2019, 2:20 pm
to color it so RNG means the RNG favored the player (the reverse of the current coloring, green means you were lucky, red means the opponent was lucky)
I think this is much easier to understand but poses the same problems mentioned earlier.
josteph wrote:
June 11th, 2019, 2:20 pm
or to color it so green means the actual result was close to the expected value and red means it was far.
I think both have problems, but since we didn’t consider enemy comparison, I think it could add another layer of complexity.

Technically, aren’t they nearly similar? So probably no problems at the second option.

Well you can probably change hits taken colors, to fit with the enemies luck, based on expected result.

So the result is, Inflicted and Taken have different colors, and should be dependent based on showing that, Taken is for how well did you protect your units and Inflicted to show how well you killed your enemies troops.

sergey
Posts: 439
Joined: January 9th, 2015, 9:25 pm

### Re: [interface/engine] Advanced damage inflicted/taken hit count statistics

josteph wrote:
June 11th, 2019, 5:55 pm
In general, if you make six attacks with 50% cth and get one hit and five misses, then you've been very unlucky.
I would say that I got RNG results below expectations. I will still consider myself lucky if all five misses were unimportant (like saurian throwing a spear at a skeleton during a day) and the hit was important (like the last chance of killing a high level unit, which in turn levels up my nearly dead unit). As I said earlier, I don't think it is possible to measure importance of a hit in a general case.
josteph wrote:
June 11th, 2019, 5:55 pm
It's true that if you consider just the damage dealt then you'd view this as neutrally lucky, but so what? Examples cut both ways. Imagine that a Thunderer and a Dragonguard both attack a unit on 50% defense. The Thunderer misses and the Dragonguard hits. How lucky was that, neutrally lucky (if we count by hits) or lucky (if we count by damage)?
I will get rid of the term "luck" in my answer. It is a more preferable outcome (damage stats) of an average RNG result (hit stats).
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.