Currently Online

Latest Posts

Topic: Reducing soldier strength parameter space (for easier comparison).

dreieck
Avatar
Topic Opener
Joined: 2018-08-25, 11:48
Posts: 72
OS: Artix GNU/Linux
Version: -git
Ranking
Likes to be here
Location: Germany
Posted at: 2018-09-14, 15:26

Reducing soldier strength parameter space (for easier comparison).

Let's define the strength parameters of a soldier in the following way:

  • Attack: Let AT be the number of health points a sucessful attack will substract from the number of health points of the victim if he has no defense.
  • Health: Let HP be the number of health points the soldier has if he is fully healthy.
  • Defense: Let DE be the fraction by which a succesful attack on this soldier get's reduced, i.e. HP -> HP - (AT'-DE*AT') = HP - (1-DE)*AT', where AT' is the AT of the attacking soldier,
  • Evade: Let EV be the proportion of attacks on this soldier which are unsuccesful, i.e. deal no damage.

Effective health.

First, it is clear that effectively DE and HP describe the same thing and an effective health eHP can be defined:

eHP = HP/(1-DE)

leaving with three parameters describing a soldier:

  • AT,
  • eHP and
  • EV.

Statistical effective health.

Viewing it statistically, i.e. averaged over many fights, evade has the same effect as defense, so DE and EV can be subsumed in an statistical defense sDE and a statistical effective health seHP can be defined:

seHP = eHP/(1-EV) = HP/((1-DE)*(1-EV)) = HP/(1-sDE)
sDE  = DE + EV - DE*EV

In a statistical view, only two parameters are needed to describe a soldier:

  • AT and
  • seHP.

Normalisation.

When two soldiers, called s1 and s2, meet and fight, health and attack can be normalised with respect to each other. But only statistically because AT varies randomly from attack to attack (see Wiki-page about soldier levels).

Let's call aAT the average AT value of a soldier. Let's denote with the indices _1 and _2 the values of the soldiers s1 and s2, respectively. Then a normalised health nHP and a normalised average attack naAT can be defined:

nHP_1  = 1
nHP_2  = 1
naAT_1 = aAT_1/HP_2
naAT_2 = aAT_2/HP_1

Similar things can be done incorporating the effective ealth and statistical effective health defined above, defining an effective normalised average attack enaAT:

enaAT_1  = aAT_1/eHP_2
enaAT_2  = aAT_2/eHP_1

and a statistical effective normalised average attack senaAT:

senaAT_1 = aAT_1/seHP_2
senaAT_2 = aAT_2/seHP_1

It looks a bit cumbersome, but the comparison of two soldiers is now reduced to one parameter (senaAT) for each soldier, which tells who wins in a statistical sense.

(Of course, one could also do normalisation by setting a normalised attack to 1 and scale the health points accordingly)

TODO: Full statistical elaboration.

Interesting TODO: Do a full statistical elaboration taking into account the real distribution of AT-values and the real distribution of evade successes and evade failures, reduce to as few parameters as possible (DE can always be eliminated since it essentially adds up to HP) and try to come up with a closed equation giving the chance that one soldier wins over the other.

Edited: 2018-09-14, 15:32

(empty signature.)

Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 2128
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-09-14, 15:44

I disagree. There is no equivalence between any of the soldier attributes:

  1. health is not equivalent to defence because of different healing speed
  2. defence/health is not equivalent to evade. Why? Let's assume that soldier A fights soldier B and soldier A needs just one hit to kill soldier B, but soldier B has 90% chance to evade. Soldier B needs ten hits to kill soldier A and soldier A cannot evade. Are they equally strong? No. Soldier A is stronger. I would be interested in a mathematical explanation of that.

  3. Defensive attributes are not equivalent to attack, because soldiers with high attack are more useful at attacking because the enemy has gotten less time to heal.


Wanted to save the world, then I got widetracked

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2018-09-14, 15:46

Do not forget that hits are discrete. Increasing healt does not increase chances of victory as long as it still takes the same number of hits to kill, but when enough healt is gained that the soldier can survive one more hit, then the chances go up by a large amount. So if you want a general number to indicate soldier strenght, you can just multiply attack and statistical effective healt, but if you want to compare two soldiers, you need to figure out how many hits they take to kill each other. Specifically, how many attack each of them need statistically to kill the other

Edited: 2018-09-14, 15:46

Top Quote
dreieck
Avatar
Topic Opener
Joined: 2018-08-25, 11:48
Posts: 72
OS: Artix GNU/Linux
Version: -git
Ranking
Likes to be here
Location: Germany
Posted at: 2018-09-14, 16:08

I forgot to take into account the inter-fight-time, i.e. the healing when the soldier is back in it's building. I was jus thinking one-shot, or "much time between two attacks". Shame on me (-:.


(empty signature.)

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2745
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-09-14, 18:17

I think that is not exactly what King_of_nowhere wanted to say. I understood that he pointed out that because of the discrete nature of each attack - defend cycle in a battle normalisation is more difficult.
e.g. if an attacker kills 1000 HP with a successful hit. it doesn't matter whether the defnder has 2001 or 2999 HP the attacker will always need 3 successful hits to kill him.
For the same reason (each single attack handled discrete) I think that defense is not equal to evade, because defense is applied always and evade is a random effect.


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2057
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2018-09-15, 12:41

Also, the attack strength varies from blow to blow in a certain interval. If your soldier has 2100 HP left and the enemy attacks with 1000-1100 strength points, it will take him 2 lucky or 3 unlucky hits to kill.


Top Quote
Arty
Avatar
Joined: 2018-08-03, 12:14
Posts: 20
Ranking
Pry about Widelands
Posted at: 2018-09-16, 14:51

WorldSavior wrote:

  1. defence/health is not equivalent to evade. Why? Let's assume that soldier A fights soldier B and soldier A needs just one hit to kill soldier B, but soldier B has 90% chance to evade. Soldier B needs ten hits to kill soldier A and soldier A cannot evade. Are they equally strong? No. Soldier A is stronger. I would be interested in a mathematical explanation of that.

Soldier A should be considered stronger overall, but by how much that depends on what you are really looking at:

If you only look at a single fight between two soldiers at full health and only consider win chance, then Soldier A is significantly stronger. Soldier A loses if he always misses before he gets hit 10 times (i.e. 9 or 10 misses depending on who starts), otherwise he wins. So the chance of soldier A losing is 0.9^9 ~ 38.7% or 0.9^10 ~ 34.9%, depending who starts. Way below 50%, so soldier A seems stronger by a lot.

It looks a little different though if soldier A has to fight multiple fights without healing, because then the health loss becomes a factor. Soldier A still has a high chance (over 60%) to win the first fight, but his further win chances go way down due to the health loss. If soldier A has to keep on soldiers B without any chance to heal inbetween, and assuming that each fight has a 50:50 chance who starts hitting (don't actually remember what the rules are for that in Widelands), then soldier A would on average kill one soldier B before he dies. (The math isn't that complicated but it's not done in two lines, so I am omitting it here, but I can provide it later if you want.) So in that sense soldier A and soldier B are equally strong. The advantage that soldier A seemed to have in a single fight scenario is gone completely when you account for health loss.

This last view unsurprisingly fits with the general idea where your numbers likely came from. If you consider many fights, then on average each blow of soldier A removes the same amount of health as a blow of soldier B.

The "only" real advantage that soldier A has over soldier B is that he can potentially heal. Realistically, healing opportunities arise in most scenarios, making that advantage significant, so overall soldier A should be considered stronger than soldier B. Not as much stronger as the single fight scenario suggests but somewhere inbetween.

Edited: 2018-09-16, 14:52

Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1116
Ranking
One Elder of Players
Location: Poland
Posted at: 2018-09-18, 09:47

@dreieck: I suggest you to look into some old topicks:

The topic you mentioned is old, but solutions are already available:

The second one needs some (math) proofs to be sure that it is working well.


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
dreieck
Avatar
Topic Opener
Joined: 2018-08-25, 11:48
Posts: 72
OS: Artix GNU/Linux
Version: -git
Ranking
Likes to be here
Location: Germany
Posted at: 2018-09-19, 19:15

einstein13 wrote:

@dreieck: I suggest you to look into some old topicks:

The topic you mentioned is old, but solutions are already available:

The second one needs some (math) proofs to be sure that it is working well.

Thanks.


(empty signature.)

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2745
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-09-20, 07:46

einstein13 wrote:

@dreieck: I suggest you to look into some old topicks:

The topic you mentioned is old, but solutions are already available:

The second one needs some (math) proofs to be sure that it is working well.

I just ran the wl_soldiers with the current values of soldier strength in trunk and it showed a potential balancing problem even of the legacy tribes will report tonight when the run is finished.


Top Quote