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 01:05:02 GMT-4 |
||

Note: |

changed:-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. 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".changed:-The following attributes are in the range 0.0 (empty) to 1.0 (full). Note that there can be underlying health,strength,endurance 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, fraction of full health. - S - stamina, fraction of full stamina. - E - encumbrance, fraction of max lift. - -The following constants adjust how quickly you get tired and recover. They a nominally constants but could be tweaked per-character based on some endurance attribute:: 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 a maximum 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::changed:-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 F=0.1, R=0. 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. 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 = 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. A realistic max lift (for a hero) is 2x your own body weight, or ~250Kg.changed:-This is how stamina recovers constantly in the background:: - - dS = R * (1.0 - S) * dt - -Wounds -====== - -Wounds are modelled as damaged muscles, thus reducing your available un-fatigued muscles, or S. It applies a constant "drain" or cap on your stamina:: - - 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, 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. - -When you are attacked or healed and your health changes, it damages/restores some of both fatigued and unfatigued muscles, so you should get a drop/raise in S proportional to S:: - - dS = dSmax * S - -Note this ensures that at low stamina a hit doesn't always knock you down to negative S. - -Encumbrance -=========== - -Encumbrance also preoccupies muscles, leaving less available for running/attacking/etc. This could be modelled using an additional "drain" on S (as done by RF). However, a drain would be slightly miss-leading as it is not really damaged/fatigued muscles and thus should not affect fatigue indicators like panting or your fatigue bar. Instead it could be shown using an encumbrance marker on the bottom part of your fatigue bar, and if ever your fatigue drops below this marker you collapse under the weight. These preoccupied muscles also should be subtracted from S when considering how fast you can run, hard you can hit etc:: - - Se = E^Ke 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*abs(climbRate))changed:- Ke=2 but can be tuned up to delay the onset of encumbrance effects. - -This is how stamina is constantly burned by encumbrance:: - - dS = -F * E^Ke * dt - -Note if S < E^Ke you are too tired to lift that much weight and collapse. 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 = 5, but can be turned down to reduce the effects of climbing. 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 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.changed:-This is how stamina is burned when walking, and walking speed varies with stamina and encumbrance:: - - dS = -F * 16*Kw^3 * (S - Senc) * dt - - walkSpeed = Kw * ((S - Senc)/(1 + Km*E))^(1/3) This is how stamina is burned when walking, and how walking speed varies with stamina and encumbrance:: dS = -F * 16*Ks^3 * (S - Smin) * dt walkSpeed = climbScale^(2/3) * Ks * ((S - Smin)/(1 + Kw*E))^(1/3)changed:- Kw = 0.25 but can be tuned down to reduce walking speed and stamina burn. - Km = 2 but can be tuned down to reduce encumbrance effects on running/walking speed. - walkSpeed = fraction of max run speed. 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. Kw = 2*0.7 = 1.4, but can be tuned down to reduce encumbrance effects on running/walking speed. 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.changed:- dS = -F * (S - Senc) * dt - - runSpeed = (S - Senc)/(1 + Km*E) dS = -F * (S - Smin) * dt runSpeed = climbScale * (S - Smin)/(1 + Kr*E)changed:- Km = 2 but can be tuned down to reduce encumbrance effects on running speed. Kr = 2*0.85 = 1.7, but can be tuned down to reduce encumbrance effects on running speed. 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.changed:- dS = - -Climbing -======== - -This is how stamina is burned by going uphill:: - - dS = dz dS = -F * (S - Smin) jumpScale = (S - Smin)/(1 + Kj*E) jumpVelocity = sqrt(2*g*jumpHeight)changed:- dz is vertical displacement, probably low-pass filtered so jitter/bob doesn't burn fatigue like crazy. 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.

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".

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 a maximum 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.

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 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 = 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. A realistic max lift (for a hero) is 2x your own body weight, or ~250Kg.

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.

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*abs(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 = 5, but can be turned down to reduce the effects of climbing.

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 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.

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

dS = -F * 16*Ks^3 * (S - Smin) * dt walkSpeed = climbScale^(2/3) * Ks * ((S - Smin)/(1 + Kw*E))^(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. Kw = 2*0.7 = 1.4, but can be tuned down to reduce encumbrance effects on running/walking speed. 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.

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

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

where:

Kr = 2*0.85 = 1.7, but can be tuned down to reduce encumbrance effects on running speed. 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.

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.