#5c Stamina-driven attacks #21

Closed
opened 2026-11-12 18:31:41 +00:00 by claude · 1 comment
Member

Part of #5.

Acceptance

  • With real-time combat on, the fatigue cost of an attack is paid when the swing is released, and it scales with wind-up strength and weapon weight. Today's GMSTs (fFatigueAttackBase, fFatigueAttackMult, fWeaponFatigueMult) set the base values.
  • An attack can't start below a configurable fatigue threshold. The player gets clear feedback, and the attack never silently fails.
  • Low fatigue caps the maximum attack strength instead of only lowering hit chance.
  • Applies to the player, NPCs and creatures. The AI doesn't spam attacks at zero fatigue.
  • Unit tests cover cost, threshold and cap. Settings are documented.
Part of #5. **Acceptance** - With real-time combat on, the fatigue cost of an attack is paid when the swing is released, and it scales with wind-up strength and weapon weight. Today's GMSTs (`fFatigueAttackBase`, `fFatigueAttackMult`, `fWeaponFatigueMult`) set the base values. - An attack can't start below a configurable fatigue threshold. The player gets clear feedback, and the attack never silently fails. - Low fatigue caps the maximum attack strength instead of only lowering hit chance. - Applies to the player, NPCs and creatures. The AI doesn't spam attacks at zero fatigue. - Unit tests cover cost, threshold and cap. Settings are documented.
claude added this to the 2. Feel milestone 2026-11-12 18:31:41 +00:00
eric closed this issue 2026-11-13 21:09:08 +00:00
Author
Member

Done in 28d5d076a0 (ashlar-build scheduled run).

What changed (only with [Game] real time combat on; classic behavior is unchanged with it off)

  • Cost on release. CharacterController::prepareHit pays the cost when the swing is released, for melee, ranged and thrown attacks. applyFatigueLoss no longer charges at the hit, so an interrupted swing or a miss still costs fatigue. The cost is (fFatigueAttackBase + fFatigueAttackMult * encumbrance) * (0.5 + 0.5 * strength) + weight * strength * fWeaponFatigueMult. A full wind-up costs the same as a classic full-strength attack, and a quick tap costs half the base cost.
  • Threshold. New [Game] attack fatigue threshold (default 0.1 of max fatigue). Weapon attacks can't start below it, or at zero fatigue or less. The player gets "You are too tired to attack." once per press. AiCombatStorage::startAttackIfReady won't wind up a weapon attack while the actor is too tired, so the AI waits for fatigue to recover instead of spamming attacks. Spells and lockpicks aren't affected, and god mode skips all of this.
  • Strength cap. New [Game] attack fatigue cap (default 0.5). Below that share of max fatigue, the strongest possible attack falls linearly to a quarter of full strength at zero fatigue. 0 disables the cap. Applies to the player, NPCs and creatures, including creatures' random-strength attacks.
  • The rules are in mwmechanics/stamina.{hpp,cpp}, and both settings are documented in settings/game.rst and settings-default.cfg.

Tests

  • Build OK. components-tests: 1636 passed. openmw-tests: 589 passed, 11 of them new in teststamina.cpp (cost, threshold and cap).
  • The headless Game Template boot is clean.
  • No attack was exercised end to end headlessly, because the template has no hostile melee actor (#24).

Still to check

  • The "too tired" message is hard-coded English. There's no GMST for it, so localization can come later with the Lua UI work.
  • How it feels, including the default threshold and cap values, needs Eric's playtest.
Done in `28d5d076a0` (ashlar-build scheduled run). **What changed** (only with `[Game] real time combat` on; classic behavior is unchanged with it off) - **Cost on release.** `CharacterController::prepareHit` pays the cost when the swing is released, for melee, ranged and thrown attacks. `applyFatigueLoss` no longer charges at the hit, so an interrupted swing or a miss still costs fatigue. The cost is `(fFatigueAttackBase + fFatigueAttackMult * encumbrance) * (0.5 + 0.5 * strength) + weight * strength * fWeaponFatigueMult`. A full wind-up costs the same as a classic full-strength attack, and a quick tap costs half the base cost. - **Threshold.** New `[Game] attack fatigue threshold` (default 0.1 of max fatigue). Weapon attacks can't start below it, or at zero fatigue or less. The player gets "You are too tired to attack." once per press. `AiCombatStorage::startAttackIfReady` won't wind up a weapon attack while the actor is too tired, so the AI waits for fatigue to recover instead of spamming attacks. Spells and lockpicks aren't affected, and god mode skips all of this. - **Strength cap.** New `[Game] attack fatigue cap` (default 0.5). Below that share of max fatigue, the strongest possible attack falls linearly to a quarter of full strength at zero fatigue. 0 disables the cap. Applies to the player, NPCs and creatures, including creatures' random-strength attacks. - The rules are in `mwmechanics/stamina.{hpp,cpp}`, and both settings are documented in `settings/game.rst` and `settings-default.cfg`. **Tests** - Build OK. components-tests: 1636 passed. openmw-tests: 589 passed, 11 of them new in `teststamina.cpp` (cost, threshold and cap). - The headless Game Template boot is clean. - No attack was exercised end to end headlessly, because the template has no hostile melee actor (#24). **Still to check** - The "too tired" message is hard-coded English. There's no GMST for it, so localization can come later with the Lua UI work. - How it feels, including the default threshold and cap values, needs Eric's playtest.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gaming/ashlar#21