ho-dev / HattrickOrganizer

Assistant for Hattrick online football manager
https://ho-dev.github.io/HattrickOrganizer/
GNU Lesser General Public License v3.0
195 stars 79 forks source link

[eFEAT] auto adjustment of stamina subskill #383

Closed akasolace closed 7 months ago

akasolace commented 4 years ago

we could offer to adjust stamina subskill of player based on game results. if player had a game in the week, similar to what Foxtrick is doing, we deduct stamina decimal from RatingEndOfGame vs Rating, and we adjust stamina decimal accordingly.

akasolace commented 2 years ago

@sophiastr for example this one ....

sophiastr commented 2 years ago

Indeed, this is easier. Thank you very much. Can you assign me this issue?

sophiastr commented 2 years ago

Good Evening, Sorry, I have no solution to the problem yet. I estimate that within 1 or 2 weeks I will have solved it. Sorry again. However, I have some questions. I do not understand how stamina is being calculated so far. Can you tell me in which class the player's stamina is calculated? I found this class related to the player's stamina. Στιγμιότυπο οθόνης (533)

wsbrenk commented 2 years ago

@sophiastr I don't think there is already a calculation of the stamina subskill in HO

other skills are calculated in HOModel.calcSubskills

sophiastr commented 2 years ago

Hello again, I am working on the method for calculating stamina. Now, I understand better the project and the various variables. Can you give me more information on how to adjust stamina? What exactly do you want me to do? Also, if you want my opinion it would be useful to put more parameters in stamina calculation. For example, the minutes a player has played, training, and injuries affect the stamina. Do you want me to go ahead with my idea or yours? Finally, because I work in the class "Player", I have noticed some errors in the comments. Wrong names, many German words that confuse me, and other mistakes. Would you mind correcting these?

Thank you, Sophia

wsbrenk commented 2 years ago

@sophiastr i do not really know how @akasolace planned to calculate the stamina subskill. what i find concerning stamina numbers is this: https://www88.hattrick.org/Forum/Read.aspx?t=17445814&n=6&v=0

maybe we could conclude from player's rating at end of match to his stamina?!

sophiastr commented 2 years ago

Okay, then I will start calculating the stamina by taking into account only the RatingEndOfGame. I'm waiting for some feedback @akasolace. Tell me if you want to make the calculation of stamina more complicated and realistic by adding other variables.

Thank you, Sophia

wsbrenk commented 2 years ago

added three columns to player table:

image

commit is coming soon!

masterpatje commented 2 years ago

Don't know if this helps, but I know Sophia was working on stamina subskill.

I noticed that in hattrick when you are analysing a match and use the clock symbol you can see the stamina at different stages of the match by hoovering over the player.

In this case (example) in the 65th minute my player Celasun had 93% stamina at that point in time. I am not sure if this information is helpfull, but wanted to make you aware of it. Maybe also for testing purposes.

image

wsbrenk commented 8 months ago

http://iht.smdesign.es/en/Studies/Stamina-table

https://www89.hattrick.org/Forum/Read.aspx?t=16855682&v=0&a=1&n=5

wsbrenk commented 8 months ago

Again from Schum's thread:

As we move on to the XT formulas, it is necessary to remember that all calculations in Hettrick use a calculation scale, where skills correspond to the generally accepted scale minus 1.

Therefore, in the following, in all posts with stamina formulas, a scale of calculations will be used, where "catastrophic" is (0; 1), and "excellent" is [7.0; 8.0]

The Effect of Age on Endurance Training.

Everything turned out to be quite simple, although it was far from obvious. And it was the understanding of this principle that made it possible to come close to solving the problem as a whole.

So, the maximum endurance of players will be at the age of 20-24. Another age range within which the parameters of change in endurance are constant is 17-19 years. But under the same conditions, endurance will be 0.7 less than at the age of 20-24.

In other words, endurance training at 6.0 at 17-19 years old will be exactly the same as at 6.7 at 20-24 years old.

Then, from the age of 25 to the age of 33, each year there is a step-by-step decrease in stamina by 7/30 of the level, i.e. 0.2(3) in decimal terms.

And from the age of 34 onwards, each year there is a decrease in stamina by 14/30 of the level, or 0.4(6) in decimal terms.

Age k Kage decrease
17 3 21 / 30 0.7
18 3 21 / 30 0.7
19 3 21 / 30 0.7
20 0 0 0
21 0 0 0
22 0 0 0
23 0 0 0
24 0 0 0
25 1 7 / 30 0.233
26 2 14 / 30 0.467
27 3 21 / 30 0.7
28 4 28 / 30 0.933
29 5 35 / 30 1.167
30 6 42 / 30 1.4
31 7 49 / 30 1.633
32 8 56 / 30 1.867
33 9 63 / 30 2.1
34 11 77 / 30 2.567
35 13 91 / 30 3.033
36 15 105 / 30 3.5
37 17 119 / 30 3.967
38 19 133 / 30 4.433
39 21 147 / 30 4.9

Age - player's age k is a coefficient that is easy to remember by understanding the principle. Kage is the coefficient used in the calculations Kage = k * 7 / 30 Ten. - Kage in decimal format

Stamina Level of youth pulls from the Academy is always equal to 3.99 (weak - very high).

The stamina level of old-school youth pulls can vary.

Limits and limitations.

In both level and endurance training, there are limits, or limitations.

The minimum level of the Stamina skill is 0.7 (catastrophic-high), And it doesn't depend on age.

The maximum level of the Stendurance skill depends on age. For the entire range from 17 to 27 inclusive, it's 8.4 (Excellent-Medium)

Then, from 28 to 33 years of age, the maximum possible level of endurance decreases by 7/30 or 0.2(3) in decimal terms.

Age Max level Десят.
17-27 252 / 30 8.4
28 245 / 30 8.167
29 238 / 30 7.933
30 231 / 30 7.7
31 224 / 30 7.467
32 217 / 30 7.233
33 210 / 30 7.0
34 196 / 30 6.533
35 182 / 30 6.067
36 168 / 30 5.6
37 154 / 30 5.133
38 140 / 30 4.667
39 126 / 30 4.2

Age - player's age Max S - the highest possible skill level Stamina Ten. - Max S in decimal format.

Maximum level of endurance training (changes). This level depends on the percentage of endurance in training, and does not depend on age. But at the same time, at different ages of the player, the maximum level of training is achieved at different levels of the Stamina skill.

Please note that with 5% endurance in training, stamina will decrease at any age. The minimum reduction will be 0.00525 whole stamina skill. At the age of 20-24 years, such a decrease will be at Stamina levels of 2.888 and below (bad - very high).

Tmax = -2.1S^2 + 4.2S - 0.21

Tmax is the maximum level of endurance training S is the proportion of endurance in training (10% is 0.1)

S Tmax
5% -0.005
6% 0.034
7% 0.074
8% 0.113
9% 0.151
10% 0.189
11% 0.227
12% 0.264
13% 0.301
14% 0.337
15% 0.373
16% 0.408
17% 0.443
18% 0.478
19% 0.512
20% 0.546
21% 0.579
22% 0.612
23% 0.645
24% 0.677
25% 0.709
26% 0.740
27% 0.771
28% 0.801
29% 0.831
30% 0.861
31% 0.890
32% 0.919
33% 0.947
34% 0.975
35% 1.003
36% 1.030
37% 1.057
38% 1.083
39% 1.109
40% 1.134
41% 1.159
42% 1.184
43% 1.208
44% 1.231
45% 1.255
46% 1.278
47% 1.300
48% 1.322
49% 1.344
50% 1.365

The level of the Stamina skill at which the maximum height value is reached (from the table above).

Age Level
17 2.188
18 2.188
19 2.188
20 2.888
21 2.888
22 2.888
23 2.888
24 2.888
25 2.655
26 2.421
27 2.188
28 1.955
29 1.721
30 1.488
31 1.255
32 1.021
33 0.788

If the skill levels are lower than those shown in the table, the stamina training value will be equal to the maximum.

At the age of 34 years and older, the maximum training value will be at the lowest possible Endurance level of 0.7, and will be lower than the value from the posting table above.

The maximum possible drop in stamina skill per training.

S 20-24 25 26 17-19, 27-
5% -0.385 -0.414 -0.445 -0.476
6% -0.365 -0.394 -0.425 -0.456
7% -0.345 -0.375 -0.405 -0.437
8% -0.326 -0.355 -0.386 -0.417
9% -0.307 -0.336 -0.367 -0.398
10% -0.288 -0.317 -0.348 -0.379
11% -0.269 -0.298 -0.329 -0.360
12% -0.250 -0.280 -0.310 -0.342
13% -0.232 -0.261 -0.292 -0.323
14% -0.214 -0.243 -0.274 -0.305
15% -0.196 -0.225 -0.256 -0.287
16% -0.178 -0.207 -0.238 -0.270
17% -0.160 -0.190 -0.220 -0.252
18% -0.143 -0.173 -0.203 -0.235
19% -0.126 -0.155 -0.186 -0.218
20% -0.109 -0.139 -0.169 -0.201
21% -0.092 -0.122 -0.152 -0.184
22% -0.076 -0.105 -0.136 -0.168
23% -0.060 -0.089 -0.120 -0.151
24% -0.043 -0.073 -0.104 -0.135
25% -0.028 -0.057 -0.088 -0.119
26% -0.012 -0.041 -0.072 -0.104
27% 0 -0.026 -0.057 -0.088
28% 0 -0.011 -0.041 -0.073
29% 0 0 -0.026 -0.058
30% 0 0 -0.012 -0.043
31% 0 0 0 -0.029
32% 0 0 0 -0.014
33% 0 0 0 0

The values from the table are reached when the level of the Stamina skill is equal to the maximum possible level (1st table (17404127.29)).

For all ages 27 and up, the maximum drop will be the same.

Endurance training formulas.

The function of endurance training depends on 3 arguments:

  1. Age Player Age
  2. Skill Level Stamina level
  3. Proportion of endurance in training S There is also a fourth argument - the intensity of the training Int. But firstly, it is in the vast majority of cases equal to 100% or 1, and secondly, it is paired with the percentage of endurance in the training. That is, for cases when the intensity of the training is different from 1, you need to take not S, but S*Int

Given that stamina depends on age, as shown in the table (17404127.28), in the formulas we will use the argument L, which is equal to the sum of the Stendurance skill level and the age coefficient. L = level + Kage

The endurance training function T consists of three different equations for the segments of the argument L. In this case, the value of the function flows seamlessly from one equation to another at values L equal to 7.0 (excellent without sublevel) and 7.56 (excellent-average).

At L=7.56 and above: T = -1.05S^2 + 2.1S + aL^3 + bL^2 + c*L + d T is the value of endurance training S is the proportion of endurance in training (10% is 0.1) L is the sum of the player's stamina level and age coefficient.

a = -0.00016 b = -0.00544 c = 0.0013 d = -0.0185

At L between 7.0 and 7.56: T = -1.05S^2 + 2.1S + eL^3 + fL^2 + g*L + h The function is the same, but with different parameters.

e = -0.00772 f = 0.0636 g = -0.0178 h = -0.554

At L=7.0 and below

T = (-1.05S^2 + 2.1S) (mL^3 + nL^2 + oL + p) - 0.21

m = 0.00013 n = 0.0048 o = -0.301 p = 2.826

Endurance training. 20-24 years old.

20-24 2.888 3.0 3.5 4.0 4.5 5.0 5.5
5% -0.005 -0.008 -0.022 -0.035 -0.048 -0.061 -0.073
6% 0.034 0.031 0.015 -0.001 -0.017 -0.032 -0.046
7% 0.074 0.069 0.051 0.032 0.014 -0.003 -0.020
8% 0.113 0.108 0.086 0.065 0.045 0.025 0.006
9% 0.151 0.146 0.122 0.098 0.075 0.053 0.032
10% 0.189 0.183 0.157 0.131 0.105 0.081 0.057
11% 0.227 0.220 0.191 0.163 0.135 0.108 0.082
12% 0.264 0.257 0.225 0.194 0.165 0.135 0.107
13% 0.301 0.293 0.259 0.226 0.194 0.162 0.132
14% 0.337 0.329 0.292 0.257 0.222 0.189 0.156
15% 0.373 0.364 0.325 0.288 0.251 0.215 0.180
16% 0.408 0.399 0.358 0.318 0.279 0.241 0.204
17% 0.443 0.433 0.390 0.348 0.306 0.266 0.227
18% 0.478 0.468 0.422 0.377 0.334 0.291 0.250
19% 0.512 0.501 0.453 0.407 0.361 0.316 0.273
20% 0.546 0.535 0.484 0.435 0.388 0.341 0.296
21% 0.579 0.567 0.515 0.464 0.414 0.365 0.318
22% 0.612 0.600 0.545 0.492 0.440 0.389 0.340
23% 0.645 0.632 0.575 0.520 0.466 0.413 0.362
24% 0.677 0.664 0.605 0.547 0.491 0.437 0.383
25% 0.709 0.695 0.634 0.574 0.516 0.460 0.405
26% 0.740 0.726 0.663 0.601 0.541 0.483 0.426
27% 0.771 0.756 0.691 0.627 0.565 0.505 0.446
28% 0.801 0.786 0.719 0.653 0.589 0.527 0.467
29% 0.831 0.816 0.747 0.679 0.613 0.549 0.487
30% 0.861 0.845 0.774 0.704 0.637 0.571 0.507
31% 0.890 0.874 0.801 0.729 0.660 0.592 0.526
32% 0.919 0.902 0.827 0.754 0.682 0.613 0.545
33% 0.947 0.930 0.853 0.778 0.705 0.634 0.564

In the first line is the level of endurance at 20-24 years old on the scale of calculations. For other ages, you need to subtract Kage from the values of the first line.

20-24 6.0 6.5 7.0 7.5 8.0 8.4 9.1*
5% -0.085 -0.096 -0.108 -0.264 -0.336 -0.385 -0.476
6% -0.061 -0.074 -0.088 -0.245 -0.317 -0.365 -0.456
7% -0.037 -0.053 -0.068 -0.225 -0.297 -0.345 -0.437
8% -0.013 -0.031 -0.049 -0.206 -0.278 -0.326 -0.417
9% 0.011 -0.010 -0.030 -0.186 -0.258 -0.307 -0.398
10% 0.034 0.011 -0.011 -0.167 -0.239 -0.288 -0.379
11% 0.057 0.032 0.008 -0.149 -0.221 -0.269 -0.360
12% 0.079 0.053 0.027 -0.130 -0.202 -0.250 -0.342
13% 0.102 0.073 0.045 -0.112 -0.184 -0.232 -0.323
14% 0.124 0.093 0.063 -0.093 -0.165 -0.214 -0.305
15% 0.146 0.113 0.081 -0.075 -0.147 -0.196 -0.287
16% 0.168 0.133 0.099 -0.058 -0.130 -0.178 -0.270
17% 0.189 0.152 0.117 -0.040 -0.112 -0.160 -0.252
18% 0.210 0.171 0.134 -0.023 -0.095 -0.143 -0.235
19% 0.231 0.190 0.151 -0.006 -0.078 -0.126 -0.218
20% 0.252 0.209 0.168 0.011 -0.061 -0.109 -0.201
21% 0.272 0.228 0.185 0.028 -0.044 -0.092 -0.184
22% 0.292 0.246 0.201 0.044 -0.028 -0.076 -0.168
23% 0.312 0.264 0.217 0.061 -0.011 -0.060 -0.151
24% 0.332 0.282 0.234 0.077 0.005 -0.043 -0.135
25% 0.351 0.299 0.249 0.093 0.021 -0.028 -0.119
26% 0.370 0.317 0.265 0.108 0.036 -0.012 -0.104
27% 0.389 0.334 0.280 0.124 0.052 0.003 -0.088
28% 0.408 0.351 0.296 0.139 0.067 0.019 -0.073
29% 0.426 0.367 0.311 0.154 0.082 0.034 -0.058
30% 0.444 0.384 0.325 0.169 0.097 0.048 -0.043
31% 0.462 0.400 0.340 0.183 0.111 0.063 -0.029
32% 0.480 0.416 0.354 0.198 0.126 0.077 -0.014
33% 0.497 0.432 0.369 0.212 0.140 0.092 0.000

*There is no stamine 9.1, but for ages other than 20-26 with L-Kage, there is a maximum drop in the table.

17 18 19 20 21 22 23 24
10% 7.06 7.06 7.06 7.76 7.76 7.76 7.76 7.76
11% 7.33 7.33 7.33 8.03 8.03 8.03 8.03 8.03
12% 7.40 7.40 7.40 8.10 8.10 8.10 8.10 8.10
13% 7.46 7.46 7.46 8.16 8.16 8.16 8.16 8.16
14% 7.52 7.52 7.52 8.22 8.22 8.22 8.22 8.22
15% 7.58 7.58 7.58 8.28 8.28 8.28 8.28 8.28
16% 7.63 7.63 7.63 8.33 8.33 8.33 8.33 8.33
17% 7.69 7.69 7.69 8.39 8.39 8.39 8.39 8.39
18% 7.74 7.74 7.74 8.44 8.44 8.44 8.44 8.44
19% 7.78 7.78 7.78 8.48 8.48 8.48 8.48 8.48
20% 7.83 7.83 7.83 8.53 8.53 8.53 8.53 8.53
21% 7.91 7.91 7.91 8.61 8.61 8.61 8.61 8.61
22% 8.06 8.06 8.06 8.76 8.76 8.76 8.76 8.76
23% 8.20 8.20 8.20 8.90 8.90 8.90 8.90 8.90
24% 8.34 8.34 8.34 9.04 9.04 9.04 9.04 9.04
25% 8.47 8.47 8.47 9.17 9.17 9.17 9.17 9.17
26% 8.60 8.60 8.60 9.30 9.30 9.30 9.30 9.30
27% 8.73 8.73 8.73 9.40 9.40 9.40 9.40 9.40
28% 8.85 8.85 8.85 9.40 9.40 9.40 9.40 9.40
29% 8.97 8.97 8.97 9.40 9.40 9.40 9.40 9.40
30% 9.08 9.08 9.08 9.40 9.40 9.40 9.40 9.40
31% 9.19 9.19 9.19 9.40 9.40 9.40 9.40 9.40
32% 9.30 9.30 9.30 9.40 9.40 9.40 9.40 9.40
33% 9.40 9.40 9.40 9.40 9.40 9.40 9.40 9.40
34% 9.40 9.40 9.40 9.40 9.40 9.40 9.40 9.40
25 26 27 28 29 30 31 32
10% 7.52 7.29 7.06 6.82 6.59 6.36 6.12 5.89
11% 7.80 7.56 7.33 7.10 6.86 6.63 6.40 6.16
12% 7.87 7.63 7.40 7.17 6.93 6.70 6.47 6.23
13% 7.93 7.70 7.46 7.23 7.00 6.76 6.53 6.30
14% 7.99 7.76 7.52 7.29 7.06 6.82 6.59 6.36
15% 8.05 7.81 7.58 7.35 7.11 6.88 6.65 6.41
16% 8.10 7.87 7.63 7.40 7.17 6.93 6.70 6.47
17% 8.15 7.92 7.69 7.45 7.22 6.99 6.75 6.52
18% 8.20 7.97 7.74 7.50 7.27 7.04 6.80 6.57
19% 8.25 8.02 7.78 7.55 7.32 7.08 6.85 6.62
20% 8.30 8.06 7.83 7.60 7.36 7.13 6.90 6.66
21% 8.38 8.14 7.91 7.68 7.44 7.21 6.98 6.74
22% 8.53 8.29 8.06 7.83 7.59 7.36 7.13 6.89
23% 8.67 8.44 8.20 7.97 7.74 7.50 7.27 7.04
24% 8.81 8.57 8.34 8.11 7.87 7.64 7.41 7.17
25% 8.94 8.71 8.47 8.24 8.01 7.77 7.54 7.31
26% 9.07 8.84 8.60 8.37 8.14 7.90 7.67 7.44
27% 9.19 8.96 8.73 8.49 8.26 8.03 7.79 7.56
28% 9.32 9.08 8.85 8.62 8.38 8.15 7.92 7.68
29% 9.40 9.20 8.97 8.73 8.50 8.27 8.03 7.80
30% 9.40 9.31 9.08 8.85 8.61 8.38 8.15 7.91
31% 9.40 9.40 9.19 8.96 8.72 8.49 8.26 8.02
32% 9.40 9.40 9.30 9.06 8.83 8.60 8.36 8.13
33% 9.40 9.40 9.40 9.17 8.93 8.70 8.47 8.23
34% 9.40 9.40 9.40 9.17 8.93 8.70 8.47 8.23

Table of equilibrium values of the skill Stendurance 33-39 years old

33 34 35 36 37 38 39
10% 5.66 5.19 4.72 4.26
11% 5.93 5.46 5.00 4.53 4.06
12% 6.00 5.53 5.07 4.60 4.13
13% 6.06 5.60 5.13 4.66 4.20
14% 6.12 5.66 5.19 4.72 4.26
15% 6.18 5.71 5.25 4.78 4.31
16% 6.23 5.77 5.30 4.83 4.37 3.90
17% 6.29 5.82 5.35 4.89 4.42 3.95
18% 6.34 5.87 5.40 4.94 4.47 4.00
19% 6.38 5.92 5.45 4.98 4.52 4.05
20% 6.43 5.96 5.50 5.03 4.56 4.10
21% 6.51 6.04 5.58 5.11 4.64 4.18
22% 6.66 6.19 5.73 5.26 4.79 4.33
23% 6.80 6.34 5.87 5.40 4.94 4.47 4.00
24% 6.94 6.47 6.01 5.54 5.07 4.61 4.14
25% 7.07 6.61 6.14 5.67 5.21 4.74 4.27
26% 7.20 6.74 6.27 5.80 5.34 4.87 4.40
27% 7.33 6.86 6.39 5.93 5.46 4.99 4.53
28% 7.45 6.98 6.52 6.05 5.58 5.12 4.65
29% 7.57 7.10 6.63 6.17 5.70 5.23 4.77
30% 7.68 7.21 6.75 6.28 5.81 5.35 4.88
31% 7.79 7.32 6.86 6.39 5.92 5.46 4.99
32% 7.90 7.43 6.96 6.50 6.03 5.56 5.10
33% 8.00* 7.53 7.07 6.60 6.13 5.67 5.20
34% 8.00 7.53 7.07 6.60 6.13 5.67 5.20
wsbrenk commented 8 months ago

image

light color: Schum values dark color: Stamina without sub

recalcution done since end of 2022. When the skill drops below 6 at the beginning of 2023, i would expect a continously decrease of the Schum values.

The player plays very seldom: image

wsbrenk commented 8 months ago

image

now there is a constant decrease of 0.025 if more than 2 weeks no match minute is played!

wsbrenk commented 8 months ago

Handle stamina decrease if player does not play

        if (minutes == 0) {
            if (decrease) {
                ret = min(ret, pow(L, 5) * -0.00000661);    // decrease if no played minutes since more than 2 weeks
            } else {
                ret = min(ret, -0.0016 * stamina * stamina + 0.5037 * stamina);
            }
        }
        if (injury > 1) {
            ret = min(ret, 0);
        }

image