Edit detail for StaminaModel revision 3 of 36

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
Editor: DonovanBaarda
Time: 2012/10/19 16:46:36 GMT-4
Note:

changed:
-  E - encumbrance. The fraction of a maximum lift worth of equipment currently carried.
  E - encumbrance. The fraction of max lift worth of equipment currently carried.

added:

Many of the formulas use the total mass of the player in body-weights which is calculated as::

  M = 1 + Km*E

Where::

  Km = 1, for a max lift of 1x your own body weight.

A real max lift is about 2x your own body weight, but anything over 1x is totally impractical. I suggest Km=1 so that the top-half of the encumbrance bar doesn't go unused and give players an unrealistic impression of how much they can carry. Note the largest professional rugby league player is 133Kg, though 100~125Kg is probably more realistic for a big hero.

changed:
-  Smin = E^Ke
  Smin = (Km/2 * E)^Ke

changed:
-If S < Smin you are too tired to lift that much weight and collapse. A realistic max lift (for a hero) is 2x your own body weight, or ~250Kg.
If S < Smin you are too tired to lift that much weight and collapse.

changed:
-  climbScale = 1/(1 + Kc*abs(climbRate))
  climbScale = 1/(1 + Kc*max(0,climbRate))

changed:
-  Kc = 5, but can be turned down to reduce the effects of climbing.
  Kc = 4, so climbing vertical is Kc+1 = 5x the cost of running horizontally.

changed:
-Record 15m speed climbing top speed is about 2m/sec, compared to 100m record top speeds of about 12m/sec, suggest climbing uses as much energy as going 6x the distance horizontally, but some documentation suggests it is 10x. It often surprises players how much affect climbing really has, and Kc=5 might feel too excessive for playability.
Record 15m speed climbing top speed is 6.26sec, or about 2m/sec, compared to 100m record top speeds of about 12m/sec. This suggest climbing uses as much energy as going 6x the distance horizontally, but some documentation suggests it is 10x. It often surprises players how much affect climbing really has, so we use Kc=4 for playability.

changed:
-  dS = -F * 16*Ks^3 * (S - Smin) * dt
-  walkSpeed = climbScale^(2/3) * Ks * ((S - Smin)/(1 + Kw*E))^(1/3)
  dS = -F * 16 * walkSpeed^3 = -F * 16*Ks^3 * (S - Smin) * dt
  walkSpeed = climbScale^(2/3) * Ks * ((S - Smin)/M)^(1/3)

removed:
-  Kw = 2*0.7 = 1.4, but can be tuned down to reduce encumbrance effects on running/walking speed.

changed:
-  dS = -F * (S - Smin) * dt
-  runSpeed = climbScale * (S - Smin)/(1 + Kr*E)
  dS = -F * runSpeed/climbScale = -F * (S - Smin) * dt
  runSpeed = climbScale * (S - Smin)/M

removed:
-  Kr = 2*0.85 = 1.7,  but can be tuned down to reduce encumbrance effects on running speed.

changed:
-
Attacking/Blocking
==================

The speed and effectiveness of attacks and blocks depends on available stamina, and also burns stamina::

  dS = -F * W * (S - Smin)

The RealisticFatigue? document was a bit too messy and Oblivion specific. This is an attempt to tidy and simplify it into something that can be used for other games. In particular, "stamina" is a better name than "fatigue".

Basic Attributes

The following attributes are in the range 0.0 (empty) to 1.0 (full). Note that there can be underlying health/strength/endurance/etc attributes that translate these into different numbers, but from the fatigue models point of view, the only thing that matters is the fraction of full health/stamina/encumbrance:

H - health. The fraction of life remaining after taking damage.
S - stamina. The fraction of un-damaged, un-fatigued muscles available for lifting/moving/fighting/etc.
E - encumbrance. The fraction of max lift worth of equipment currently carried.

The following constants adjust how quickly you get tired and recover. They are normally constants but could be tweaked per-character based on some endurance attribute:

F - stamina burn rate, stamina/second
R - stamina recovery rate, stamina/second

Note that R/(F+R) is the "steady state" or minimum S value reached for constant activity, so the the R/F ratio is important. Studies show F is 0.008~0.033, R is 0.0026~0.013, and F/R is 0.3~0.5, so F=0.03, R=0.01, for F/R = 1/3 is realistic, and gives an average fatigue recovery rate of 0.5%/sec. However for gameplay reasons speeding it up to F=0.9, R=0.03 might be better.

Many of the formulas use the total mass of the player in body-weights which is calculated as:

M = 1 + Km*E

Where:

Km = 1, for a max lift of 1x your own body weight.

A real max lift is about 2x your own body weight, but anything over 1x is totally impractical. I suggest Km=1 so that the top-half of the encumbrance bar doesn't go unused and give players an unrealistic impression of how much they can carry. Note the largest professional rugby league player is 133Kg, though 100~125Kg is probably more realistic for a big hero.

Wounds

Wounds are modeled as damaged muscles, reducing your available muscles for running/fighting/etc. It applies a constant "drain" or cap on your stamina. This could be indicated as a red max stamina marker on the top end of the stamina bar:

Smax = H^(1/Kh)

Where:

Kh=2, but can be tuned up to delay the onset of wound effects.

Note RF uses Smax=1-(1-H)^Kh instead, which compared to the above makes drains less for small injuries, but more for big ones, making it harder to "turn the tables" in combat. The above formula is probably better for gameplay.

When you are damaged/healed and your health changes, it damages/restores some of both fatigued and unfatigued muscles. There should be a change in S that reflects this. For a change in health of dH:

H = H + dH
dSmax = H^(1/Kh) - Smax
dS = dSmax * S/Smax
Smax = Smax + dSmax
S = S + dS

Where:

dH is the change in health.
dSmax is the change in Smax
dS is the change in S

Note this ensures that at low stamina a hit winds you a bit, but not too much.

Encumbrance

Encumbrance preoccupies muscles, leaving less available for running/attacking/etc, and there is a minimum stamina required to lift everything you are carrying. It can be shown using a black min stamina marker on the bottom end of the stamina bar. These preoccupied muscles also should be subtracted from S when considering how fast you can run, hard you can hit etc:

Smin = (Km/2 * E)^Ke

Where:

Ke=2, but can be tuned up to delay the onset of encumbrance effects.

Note RF implements this as an additional "drain" on S, but that is slightly miss-leading as it is not really damaged/fatigued muscles and thus should not affect fatigue indicators like panting etc.

Lifting stuff not only pre-occupies muscles, but also fatigues them. This is how stamina is constantly burned by encumbrance when standing:

dS = -F * Smin * dt

If S < Smin you are too tired to lift that much weight and collapse.

Recovery

Fatigued muscles (that are not wounded) continuously recover at a constant rate. This is how stamina recovers:

dS = R * (Smax - S) * dt

Note that stamina S cannot increase past Smax.

Climbing

Going uphill doesn't affect stamina burn rates, but it does modify movement speed. Going downhill doesn't have much effect at all:

climbRate = dz/dd = sin(climbAngle)
climbScale = 1/(1 + Kc*max(0,climbRate))

Where:

dz is vertical travel distance.
dd is total travel distance.
climbAngle is the elevation angle of the direction traveled.
climbRate is vertical displacement per total distance moved.
climbScale is the speed scaling factor for climbing.
Kc = 4, so climbing vertical is Kc+1 = 5x the cost of running horizontally.

climbRate should probably be low-pass filtered so jitter/bob doesn't burn fatigue like crazy. This is done by actually calculating it with:

climbRate = (dt*ds/dd + RC*climbRate)/(dt + RC)

Where:

RC = 0.5, but can be tweaked to adjust smoothing.

Record 15m speed climbing top speed is 6.26sec, or about 2m/sec, compared to 100m record top speeds of about 12m/sec. This suggest climbing uses as much energy as going 6x the distance horizontally, but some documentation suggests it is 10x. It often surprises players how much affect climbing really has, so we use Kc=4 for playability.

Walking

This is how stamina is burned when walking, and how walking speed varies with stamina and encumbrance:

dS = -F * 16 * walkSpeed^3 = -F * 16*Ks^3 * (S - Smin) * dt
walkSpeed = climbScale^(2/3) * Ks * ((S - Smin)/M)^(1/3)

Where:

Ks = 0.25 is max walking speed as a fraction of max run speed. Can be tuned down to reduce walking speed and stamina burn.
walkSpeed is walking speed as a fraction of max run speed.

Note Kw=0.25 represents a realistic maximum fast walking speed of around 2.5m/sec. Using Kw=0.2 would be like a more casual walking speed of 2m/sec, and significantly reduces the stamina burn.

Running

This is is how stamina is burned when running, and running speed varies with stamina and encumbrance:

dS = -F * runSpeed/climbScale = -F * (S - Smin) * dt
runSpeed = climbScale * (S - Smin)/M

where:

runSpeed is the running speed as a fraction of max running speed.

Record 100m top speeds average about 10m/sec and peak at 12m/sec. A realistic maximum running speed (for a hero) would be about 10m/sec.

Jumping

This is how stamina is burned by jumping, and how jump height varies with stamina and encumbrance:

dS = -F * (S - Smin)
jumpScale = (S - Smin)/(1 + Kj*E)
jumpVelocity = sqrt(2*g*jumpHeight)

Where:

Kj = 2, but can be tuned down to reduce encumbrance effects on jumping.
jumpScale is the jump height as a fraction of max jump height.
jumpVelocity is take-off velocity (for physics models).
g = 9.81m/s^2 is the gravitational constant.

A jump burns as much fatigue as running for 1 second. A realistic max vertical jump height (for a hero) would be 1m.

Attacking/Blocking

The speed and effectiveness of attacks and blocks depends on available stamina, and also burns stamina:

dS = -F * W * (S - Smin)