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

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

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
EarthCake
Posts: 372
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

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

sergey wrote: June 11th, 2019, 7:27 pm
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.
That is one case. I remember one game in which I played with the Rebels against the Drakes. In that game, I attacked one Clasher with an archer, which hit all 4 times the drake on 30% defense. Then a Shaman only needed to finish it by one hit, and the Shaman had 90+ chances to kill, but he missed. In that case I considered myself very unlucky.
josteph
Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

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

To everyone who asked what the percentages mean:

The way to think of the percentages is as quantiles. For example, in this screenshot:
2019-06-11-175739_333x155_scrot.png (41.27 KiB) Viewed 1816 times
The player's outcome is at the 20% quantile. There was 20% that there would be fewer hits and 80% that there would be more hits.
Mawmoocn wrote: June 11th, 2019, 7:13 pm 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 .
I was simplifying. There are separate statistics for inflicted/taken and for each side. What I was saying is that for each side, inflicted is colored using green-to-red and taken using red-to-green.
Mawmoocn wrote: June 11th, 2019, 7:13 pm Technically, aren’t they nearly similar? So probably no problems at the second option.
The actual number of hits is (pretty much by definition) close to the expected number of hits, but in all suggestions, the whole point of the coloring is to give a sense of the relation between the actual and expected numbers of hits, to give a sense of what effect the RNG had - the same reasons for having the damage table.
sergey wrote: June 11th, 2019, 7:27 pm 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.
I agree that it's not possible to measure statistics of "important hits only", but at this point, since #4070 has been merged, I'm interested in what changes should be made before the next release to the statistics dialog. I created https://github.com/wesnoth/wesnoth/issues/4113 to keep track of all the suggestions.
Mawmoocn
Posts: 138
Joined: March 16th, 2019, 3:54 pm

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

@josteph
I thought it was comparing enemy to your luck, my mistake then .

sergey wrote: June 11th, 2019, 7:27 pm I don't think it is possible to measure importance of a hit in a general case.
It’s possible, but that’s a new idea and needs other supporting mechanisms to detect things.

If you consider killing a unit important, that can be defined.
If leveling a unit is important, that could probably be defined.
If missing a killing hit is important, that could probably be defined.
If we need identities of units from things mentioned above, that could probably be defined.
If you want to see the general map outcome of battles, that’s another separate issue...

Though you’ll face certain issues, like what’s the important thing to measure and features needed to detect things.

For group attacks, it needs to detect concentration of attacks on a single unit, before it could detect the "weight" of importance. I assume you need unique unit "id", that would allow you to see if within the turn, there’re other matching units that fought this unit.

If you can suggest what are the important things, I’ll try to help elaborate your idea.
sergey
Posts: 473
Joined: January 9th, 2015, 9:25 pm

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

Mawmoocn wrote: May 6th, 2019, 6:05 pm Damage calculations doesn’t tell you if you made a mistake or did well on using terrain advantage to win.
If damage doesn't tell you that, how the hits tells that?
Mawmoocn wrote: June 11th, 2019, 8:13 pm
sergey wrote: June 11th, 2019, 7:27 pm I don't think it is possible to measure importance of a hit in a general case.
It’s possible, but that’s a new idea and needs other supporting mechanisms to detect things.
If you consider killing a unit important, that can be defined.
If leveling a unit is important, that could probably be defined.
If missing a killing hit is important, that could probably be defined.
The question for all the examples - How the mechanism will understand importance of each of the attacks?

Example 1.
Player P1 ended his turn. There is only one hex where P2 can move her units to attack the P1's leader. P2 starts her turn. She attacks the enemy leader with a walking corpse, the walking corpse is dead. P2 has many walking corpses, so eventually she is lucky to kill the enemy leader.

Example 2.
Enemy unit is about to level up. You are attacking the unit with goblin spearmans to not give him XP.

Example 3.
Player must kill unit U1 with the exact unit U2 (the first scenario of "A New Order").

Example 4.
Your plan is to weaken the enemy unit U1 with your unit U2, but kill him with unit U3.

Example 5.
You have a shaman and it is essential to slow particular enemy unit.

Example 6.
You have a shaman. It is not desirable for her to attack any enemy unit in her reach.

Example 7.
You have a healer and it heals several of your units. Enemy attacks the healer.

Example 8.
You have a healer and it heals only one unit. Enemy attacks the healer.

Example 9.
You have a healer. It is covered by guardians. Enemy attacks the guardians in order to break through and kill the healer.

Example 10.
You have a healer. It is covered by guardians. Enemy attacks the guardians in order to break through and kill the healer. You are happy, because it is a trap.

Example 11.
If your unit U1 dies this turn, then it could not enable backstab ability of your unit U2 on the next turn.

Example 12.
If your unit U1 dies this turn, then it could not enable backstab ability of your unit U2 on the next turn. But it doesn't matter since you must retreat.

Example 13.
Your bat died and can't show you the enemy under the fog.

Example 14.

Example 15.
Your bat died and can't show you the enemy under the fog. That doesn't matter, let's say you are pretty sure there is no enemies at all. Which you calculated based on the starting gold, villages on the map and number of killed enemies.

Example 16.
Your Dwarvish Steelclad died. However, he severely damaged a lvl 2 enemy. And now you can level up another your unit by killing that damaged enemy.

Example 17.
I am player A. Particular attack is essential for my plan. Mainly because I don't have any other good plans.

Example 18.
Exactly the same battle situation as in example 17. But I am player B, and that particular attack is not very important for me.

I am tired
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: 741
Joined: August 19th, 2017, 6:58 pm

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

josteph wrote: June 11th, 2019, 7:51 pm at this point, since #4070 has been merged, I'm interested in what changes should be made before the next release to the statistics dialog. I created https://github.com/wesnoth/wesnoth/issues/4113 to keep track of all the suggestions.
I've changed the two percents back to one, so it looks like this (Option A):
2019-06-14-134737_264x179_scrot.png (41.12 KiB) Viewed 1746 times
I can also make it look like this (Option B):
2019-06-14-134818_251x171_scrot.png (37.98 KiB) Viewed 1746 times
Or this (Option C):
2019-06-14-134938_297x174_scrot.png (44.86 KiB) Viewed 1746 times
sergey
Posts: 473
Joined: January 9th, 2015, 9:25 pm

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

It shows probability of hitting less than actual number of hits?
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: 741
Joined: August 19th, 2017, 6:58 pm

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

The value 78.9 is the median between "probability of hitting less than actual" and "probability of hitting more than actual". Practically speaking it's equal to the probability of hitting less than actual when the number of hits is large enough. It is a percentage under the hood but in the UI it's just shown as a number between 0 and 100 with no % symbol.
sergey
Posts: 473
Joined: January 9th, 2015, 9:25 pm

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

josteph wrote: June 14th, 2019, 2:21 pm The value 78.9 is the median between "probability of hitting less than actual" and "probability of hitting more than actual".
What does the median between two probabilities mean? I though that median applies to a set of values.
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: 741
Joined: August 19th, 2017, 6:58 pm

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

Forget that I said median. The value there is calculated as `(probability_lt + (1.0 - probability_gt)) / 2.0`, where probability_lt and probability_gt are the probabilities of hitting less than / more than the actual number of hits.
sergey
Posts: 473
Joined: January 9th, 2015, 9:25 pm

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

I see. And what about the tooltip / header of that column?
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: 741
Joined: August 19th, 2017, 6:58 pm

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

There will be a tooltip, of course, but let's divide and conquer. We should first decide what the interface shall be, and only then write documentation for it.
sergey
Posts: 473
Joined: January 9th, 2015, 9:25 pm

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

I am asking because I am not sure if that it is possible to provide a simple and clear documentation for that value. Taking into account that we are talking about a video game, not a mathematical dissertation.
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.
Mawmoocn
Posts: 138
Joined: March 16th, 2019, 3:54 pm

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

I apologise for taking a long time, I hope you understand.

sergey wrote: June 11th, 2019, 9:19 pm
Mawmoocn wrote: May 6th, 2019, 6:05 pm Damage calculations doesn’t tell you if you made a mistake or did well on using terrain advantage to win.
If damage doesn't tell you that, how the hits tells that?
Unfortunately they both have the same problem. All statistics does show is a summary of the whole battle data located in replay files.
You won’t see the stats recorded by the game without digging inside replays and understanding how it works....
sergey wrote: June 11th, 2019, 9:19 pm The question for all the examples - How the mechanism will understand importance of each of the attacks?
That depends if it’s possible to explain within the current model and parameters that we consider important. It needs to be specific to be able to measure it. Actually I think very specific actions are .... another problem.

I’ve decided to divide hits and actions, due to complexity of hits having more variables required to be part of the equation, that it probably doesn’t work with hits alone. I’ve labeled hits with added parameters to action count and more complex situations to conditional action/hits.

I guess actions and conditional action/hits are a quite complex to implement.

Direct suggestions based on your examples
Spoiler:

I found some several problems to the initial idea, and I think it probably needs time to discover most issues that may cause further problems. They’re probably incomplete but I’ll list the main factors.

The main factors that will create hypothetical problems, are as follows:
1. Important hits can’t be evaluated without context of situation and other relative information.
2. There’re many points of references or categories to choose from, and most of them don’t apply to the category of "hits made". Some categories don’t use "hits/strike" as the sole factor for the final result of information.
The use of parameters other than hits/strike, will be temporarily labeled as "actions".
This is to simplify and form a measurement that may summarise information.
Important hits and actions, will potentially have different interpretations and conditions.
3. Damage calculations consider active healing attacks such as Drain, as a negative number.
Any other parameters used in counting or calculating damage, may need deeper inspection due to UMC and mainline specific abilities.
4. Verbosity of results to include or exclude certain information, that may include the following; chance of death, chance to hit, damage to hit point ratio, damage to number of strikes ratio, special attacks(slow and etc...) of retaliation that may change the final result of combat, due to specific abilities(Drain, First Strike, Berserk, etc...) or other specific conditions(Triggered Events/Others).
Some of these things mentioned above, may cause unpredictable problems and some categories will possibly have a lower overall expected count, and might be insufficient to categorize alone. Limiting based on quality and quantity of information, may solve this issue.

Creating a design on showing this information can introduce unexpected challenges and may need further clarification, or another brand new idea.

Please suggest anything you think that may solve some of these issues.

The following spoiler will contain heavy information. These extrapolations is based on sergey’s main(???) idea.
sergey wrote: June 11th, 2019, 4:32 pm Even more precise measure of luck would be statistics of important hits (kill, advancement).
Visual example of the idea
Spoiler:
Explanation of the idea
Spoiler:

Consequence/Potential Challenges
Spoiler:

Final thoughts

It could probably measure precise or situational importance with accordance to luck.

A new thread might be required, if you wish to pursue this idea.

Didn’t think it’ll be this long........ and probably missed some few points.

I welcome questions related to this post. I’ll try to answer when I have time.
josteph
Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

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

@Mawmoocn If you want to do statistics of "interesting" strikes only (i.e., not tallying all strikes but only some of them, according to some criterion), I think you might find that they're only meaningful if you do them on an entire campaign, in the "All Scenarios" view. A single SP scenario or MP match might not have enough strikes with charge/leadership/etc to do statistics on. For example, halfway through Eastern Invasion (I'm in the middle of the ninth scenario), I have 632 hits, 165 kills, 22 losses. That's enough to do statistics of "strikes that would kill an enemy unit" over the entire campaign, but 20 kills per scenario on average might be too few to attempt the same analysis on individual scenarios.
Mawmoocn
Posts: 138
Joined: March 16th, 2019, 3:54 pm

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

@josteph It depends if a stat affects the game early, e.g. adding unnecessary risk for units that will immediately conclude the game.

I saw what you mean but I didn’t elaborate due to the premature stage of the idea and it needs a new thread.

Back on topic

I prefer option B but I like option C of placing things.

Option B is nice because you can see the excess of how much you did well. Though I guess it may confuse others as it uses addition to show the results you made.
Option C has percentages that can summarize what your excess percentage is and sort the real numbers inside parentheses.

Can we merge them by using calculation of option B and using positions with additional percentage of option C?