project-navigation
Personal tools

Author Topic: Formula for TU penalty  (Read 8573 times)

Offline DexCisco

  • Rookie
  • ***
  • Posts: 41
    • View Profile
Formula for TU penalty
« on: December 04, 2012, 06:22:37 am »
I mentioned here an alternative method of calculating the TU penalty.  Currently it adds 0 penalty if you are under 20% weight, 30% penalty if under 50% weight, and 60% penalty if over 50% weight.  This is simple, but it doesn't allow changes in inventory to matter unless it puts you over the threshold.

I found the code and figured out the formulas to use linear scales between 0%, the light weight penalty point, the heavy penalty point, and 100%.  Using this formula, every change in weight will likely change your total TUs by a little bit. 

from src\game\q_shared.h
Code: [Select]
#define GET_ENCUMBRANCE_PENALTY(weight, max) (1.0f - ((weight) > (max) * WEIGHT_HEAVY ? (((weight / (2.0f * max)) - WEIGHT_HEAVY) / (1.0f - WEIGHT_HEAVY) * (1.0f - WEIGHT_HEAVY_PENALTY)) + WEIGHT_HEAVY_PENALTY : (weight) > (max) * WEIGHT_LIGHT ? (((weight / (2.0f * max)) - WEIGHT_LIGHT) / (WEIGHT_HEAVY - WEIGHT_LIGHT) * (WEIGHT_HEAVY_PENALTY - WEIGHT_NORMAL_PENALTY)) + WEIGHT_NORMAL_PENALTY : (weight * WEIGHT_LIGHT) / (2.0f * max * WEIGHT_LIGHT)))
I also modified the penalties a bit because as they were they gave basically a straight line graph.  I changed it from 30% @ 20% to 20% @ 30%, and from 60% @ 50% to 70& @ 60%.  That puts a little bend in the graph, giving more bonus at light weights and more penalty at higher weights.  The linear method also carries the penalty right up to 100% @ 100%, so you can't do much if you are power lifting.  The numbers can be adjusted, obviously.

Attached is an ODS spreadsheet with the linear and threshold numbers if you want to play with it.

Offline Anarch Cassius

  • Squad Leader
  • ****
  • Posts: 176
    • View Profile
Re: Formula for TU penalty
« Reply #1 on: December 04, 2012, 09:36:09 am »
This beats my idea of adding a middle weight and reducing penalties slightly.

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: Formula for TU penalty
« Reply #2 on: December 04, 2012, 10:42:42 am »
The reasoning for setting thresholds rather than gradual changes is explained in the wiki here, under the Penalty Suggestion section. Note that this page contains in-progress discussions at the time and may not accurately describe what was finally implemented.

Offline Anarch Cassius

  • Squad Leader
  • ****
  • Posts: 176
    • View Profile
Re: Formula for TU penalty
« Reply #3 on: December 05, 2012, 09:45:05 pm »
Hmm, I see. If the low weight state is to really feel like a bonus and if Speed is ever going to feel as important or varied as it did before it would be good to calculate the Speed bonus so that when "normally" encumbered we get our full old TUs from Speed and they are increased like regular TUs when the load is light. Alternatively since things don't seem to internally calculate this as a bonus you could just increase TUs from Speed by 33%.

Offline homunculus

  • Sergeant
  • *****
  • Posts: 387
    • View Profile
Re: Formula for TU penalty
« Reply #4 on: January 10, 2013, 09:44:46 am »
with a smooth (continuous) encumbrance % the GUI could just show the encumbrance %, and the formula could even be nonlinear (say, TU starts to drop noticeably at 50% something).
clearly it would be more simple in the GUI, and (i am not sure) it could also be more intuitive.

with discrete encumbrance levels you force the player to not go as light as makes sense, but to fill some artificial threshold.
and there would be funny situations like picking up an ammo clip in the battlefield caused TU to drop 20%.

on a side note,
Quote
Exponentiation: initialSkill + (experience / 100)0.6
makes me think why exponent when there are nice formulas of type
Quote
x / (x + const)
that have a better curve and also make at least as much sense theoretically.

Offline kurja

  • Captain
  • *****
  • Posts: 504
    • View Profile
Re: Formula for TU penalty
« Reply #5 on: January 10, 2013, 10:04:18 am »
with discrete encumbrance levels you force the player to not go as light as makes sense, but to fill some artificial threshold.
and there would be funny situations like picking up an ammo clip in the battlefield caused TU to drop 20%.


or picking up a medkit - and not be able to use it in the next turn :(

Offline homunculus

  • Sergeant
  • *****
  • Posts: 387
    • View Profile
Re: Formula for TU penalty
« Reply #6 on: January 10, 2013, 11:36:39 am »
or picking up a medkit - and not be able to use it in the next turn :(
at this i thought: you would need to drop something then, to use the medkit.
but if TU is calculated from weight at the beginning of turn only, then you are out of luck next turn.
unless you knew that you would not have enough TU to use the medkit the next turn and knew you needed to drop something this turn.

and then, if you dropped your heavy weapon at the end of each turn and picked it up at the start of turn, would it give you more usable TU (i mean more than needed for dropping and picking up)?
for example, if you needed to dash from one cover to the next cover.

i see, instant TU effects could be fragile.

would be nice if the GUI also displayed max TU at the current weight.
or listed max TU at all encumbrance levels in the case of those hard caps like they are now.

Offline kurja

  • Captain
  • *****
  • Posts: 504
    • View Profile
Re: Formula for TU penalty
« Reply #7 on: January 10, 2013, 12:43:21 pm »
if TU is calculated from weight at the beginning of turn only, then you are out of luck next turn.
that's how it is, if I pick up a medikit and use it but need to use it next turn also, I need to drop it and pick it up again the next turn or I might not have enough TU to use it due to encumberance penalty...

exploiting the system is certainly possible.

Offline Wolls

  • Rookie
  • ***
  • Posts: 93
    • View Profile
Re: Formula for TU penalty
« Reply #8 on: January 10, 2013, 06:54:07 pm »
exploiting the system is certainly possible.

I tried this, dropping 2 items to get light status, next turn picking up and I went from originally having 31 TU to having 36 TU. (43 as light, cost me 7 to pick up gun and ammo, would have done better if I only had to drop/pick up gun).

If you have to drop many and pick it all up you would eventually drop below original TU, depending where they go maybe a max of 3??.  Of course depending what armour you wear, this could be hard.  I mean nano at 9kg, req at least a strength value of um.. 45? (In order to get to 20% weight, seeing as you can't drop armour).. I was wearing Combat so a base of 35 (doable)..

Offline homunculus

  • Sergeant
  • *****
  • Posts: 387
    • View Profile
Re: Formula for TU penalty
« Reply #9 on: January 19, 2013, 01:56:08 pm »
interesting, i equipped nanocomposite and my soldier's TU dropped just a little, something like, from 32 to 30 (i may check if needed), and that certainly does not look like a 20 % or 30 % drop.
or am i playing a different version?
downloaded 2.5 last week, to see how the soldiers now remember their equipment even when they are not assigned to firebird, but i also don't seem to notice that feature.

Offline Wolls

  • Rookie
  • ***
  • Posts: 93
    • View Profile
Re: Formula for TU penalty
« Reply #10 on: January 24, 2013, 05:13:35 am »
interesting, i equipped nanocomposite and my soldier's TU dropped just a little, something like, from 32 to 30 (i may check if needed), and that certainly does not look like a 20 % or 30 % drop.

I think the base value for a light unit is 42... so you went from 42 to 30??