Research:Movement: Difference between revisions
Jump to navigation
Jump to search
(→Movement: Added comment sent by Hrnchamd via a PM) |
|||
Line 4: | Line 4: | ||
|Describes movement speed. | |Describes movement speed. | ||
| | | | ||
|{{StatusCol|orange|Feeds into animation system; werewolf mechanics not verified; requires testing in combination with physics system}}}} | |{{StatusCol|orange|Feeds into animation system; werewolf mechanics not verified; requires testing in combination with physics system | ||
Seems bugged - fEncumberedMoveEffect is only considered when flying}}}} | |||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
if actor is a npc: | if actor is a npc: |
Revision as of 15:40, 15 January 2014
Movement
Actions affected | Movement |
Description | Describes movement speed. |
Implementation status | |
Analysis status | Feeds into animation system; werewolf mechanics not verified; requires testing in combination with physics system
Seems bugged - fEncumberedMoveEffect is only considered when flying |
if actor is a npc:
walkSpeed = fMinWalkSpeed + 0.01 * speedAttribute * (fMaxWalkSpeed - fMinWalkSpeed)
walkSpeed *= 1 - fEncumberedMoveEffect * normalizedEncumbrance
walkSpeed = max(0, walkSpeed)
if sneaking: walkSpeed *= fSneakSpeedMultiplier
elif actor is a creature:
walkSpeed = fMinWalkSpeedCreature + 0.01 * speedAttribute * (fMaxWalkSpeedCreature - fMinWalkSpeedCreature)
runSpeed = walkSpeed * (0.01 * athleticsSkill * fAthleticsRunBonus + fBaseRunMultiplier)
if encumbrance > maxEncumbrance:
moveSpeed = 0
elif flying or levitating:
flySpeed = 0.01 * (speedAttribute + levitationBonus)
flySpeed = fMinFlySpeed + flySpeed * (fMaxFlySpeed - fMinFlySpeed)
flySpeed *= 1 - fEncumberedMoveEffect * normalizedEncumbrance
flySpeed = max(0, flySpeed)
moveSpeed = flySpeed
elif swimming:
if running:
swimSpeed = runSpeed
elif walking:
swimSpeed = walkSpeed
swimSpeed *= 1 + 0.01 * swiftSwimBonus
swimSpeed *= 0.01 * athleticsSkill * fSwimRunAthleticsMult + fSwimRunBase
moveSpeed = swimSpeed
elif running:
moveSpeed = runSpeed
elif walking or sneaking:
moveSpeed = walkSpeed
else:
moveSpeed = 0
if strafing (not including diagonally): moveSpeed *= 0.75
if actor is a werewolf and running: moveSpeed *= fWereWolfRunMult
moveSpeed is passed to animation system.
Creatures have generalized combat, magic and stealth stats which substitute for the specific skills (in the same way as specializations).
Acrobatics
Actions affected | On jumping and landing |
Description | Uses common term fatigueTerm. |
Implementation status | implemented |
Analysis status | Initial velocity verified; requires testing in combination with physics system |
On jumping
encumbranceTerm = fJumpEncumbranceBase + fJumpEncumbranceMultiplier * (1 - normalizedEncumbrance)
where normalizedEncumbrance is a function of encumbrance. empty bar -> 0.0, full bar -> 1.0
if acrobaticsSkill <= 50:
a = acrobaticsSkill, b = 0
else:
a = 50, b = acrobaticsSkill - 50
x = fJumpAcrobaticsBase + pow(a / 15.0, fJumpAcroMultiplier)
x += 3 * b * fJumpAcroMultiplier
x += jumpSpellBonus * 64
x *= encumbranceTerm
if actor is running: x *= fJumpRunMultiplier
x *= fatigueTerm
x -= gravityAcceleration [constant; -627.2 exactly]
x /= 3
if actor is standing still:
set kinematic velocity to {0, 0, x}
if actor is moving:
groundVelocity = normalize({actorVelocity.x, actorVelocity.y})
set kinematic velocity to 0.707 * x * {groundVelocity.x, groundVelocity.y, 1.0}
decrease fatigue by fFatigueJumpBase + (1 - normalizedEncumbrance) * fFatigueJumpMult
On landing
fallingDist = distance from peak height
if fallingDist <= fFallDamageDistanceMin: soft landing; skip the rest of the function
x = fallingDist - fFallDamageDistanceMin
x -= 1.5 * acrobaticsSkill + jumpSpellBonus
x = max(0, x)
a = fFallAcroBase + fFallAcroMult * (100 - acrobaticsSkill)
x = fFallDistanceBase + fFallDistanceMult * x
x *= a
if x > 0: damage health by x * (1 - 0.25 * fatigueTerm)
if acrobaticsSkill * fatigueTerm < x: actor falls over
if actor is not incapacitated: acrobatics skill exercised (skill gain from fall damage)
Comments
Note that initial actor velocity is taken into account. Animation-driven kinematics mean the jump direction can be offset from the player facing if there is root bone movement. Agility does not appear to be involved in this calculation.