#6b Sprint action driven by stamina #27

Closed
opened 2026-11-14 20:44:42 +00:00 by claude · 1 comment
Member

Part of #6. Add a sprint above the normal run, paid for with fatigue, consistent with the #21 stamina rules.

Scope

  • New engine action Sprint (next free action id after A_Block), Lua input.ACTION.Sprint and self.controls.sprint. Default binds: Left Alt and left stick press (L3). Hold to sprint.
  • New [Game] sprint settings: enabled (on by default), speed multiplier over run speed (start 1.4), fatigue drain per second (scaled by Athletics like running), and a minimum fatigue ratio to start (reuse the idea of attack fatigue threshold).
  • Sprinting requires moving forward-ish, not sneaking, not in the block stance, not swimming or levitating; it ends when fatigue runs out. No attack starts while sprinting (an attack press ends the sprint).
  • AI doesn't sprint in this step.
  • Setting off: no change from upstream.

Acceptance

  • Rules (can-sprint, speed factor, drain) in a new file with unit tests.
  • A headless scenario phase shows sprint speed above run speed and fatigue draining, and sprint ending at low fatigue.
  • input_v3.xml gets the new default binds; docs in the settings reference.
  • Feel needs Eric's playtest.
Part of #6. Add a sprint above the normal run, paid for with fatigue, consistent with the #21 stamina rules. **Scope** - New engine action `Sprint` (next free action id after `A_Block`), Lua `input.ACTION.Sprint` and `self.controls.sprint`. Default binds: Left Alt and left stick press (L3). Hold to sprint. - New `[Game] sprint` settings: enabled (on by default), speed multiplier over run speed (start 1.4), fatigue drain per second (scaled by Athletics like running), and a minimum fatigue ratio to start (reuse the idea of `attack fatigue threshold`). - Sprinting requires moving forward-ish, not sneaking, not in the block stance, not swimming or levitating; it ends when fatigue runs out. No attack starts while sprinting (an attack press ends the sprint). - AI doesn't sprint in this step. - Setting off: no change from upstream. **Acceptance** - Rules (can-sprint, speed factor, drain) in a new file with unit tests. - A headless scenario phase shows sprint speed above run speed and fatigue draining, and sprint ending at low fatigue. - `input_v3.xml` gets the new default binds; docs in the settings reference. - Feel needs Eric's playtest.
claude added this to the 2. Feel milestone 2026-11-14 20:44:42 +00:00
eric referenced this issue from a commit 2026-11-15 09:13:01 +00:00
eric closed this issue 2026-11-15 09:13:01 +00:00
Author
Member

Implemented in a691315db7.

What changed

  • Engine action A_Sprint = 52, Lua input.ACTION.Sprint, a Sprint Lua action (hold) and self.controls.sprint. The default keyboard bind is Left Alt. On a controller it's D-pad up, not L3, because L3 is already Sneak in OpenMW's defaults; see the note for #8 below. input_v3.xml gets both binds (checked in the headless boot).
  • Settings: [Game] sprint (on), sprint speed multiplier (1.4 times run speed), sprint fatigue drain (10/s on top of the running cost, falling with Athletics to half at 100), and sprint fatigue threshold (0.1 of max fatigue to start). Documented in game.rst, settings-default.cfg and the Lua API docs.
  • The rules are in mwmechanics/sprint.cpp. A sprint needs forward movement within 45°, and isn't possible while sneaking, in the block stance, swimming, levitating, knocked down or paralyzed. It ends when fatigue drops below 1% of max. Regeneration keeps fatigue a hair above 0 while running, so a "positive fatigue" rule never ended the sprint; the scenario caught this. Pressing Use with a weapon or spell ready ends the sprint until Sprint is released, so no attack starts mid-sprint.
  • A sprint counts as running for animations, Athletics training and the vanilla run fatigue. Npc::getSpeed uses run speed × multiplier. AI doesn't sprint, and creatures can't.
  • With the setting off, the control does nothing.

Tests

  • Build OK, components-tests 1636 passed, openmw-tests 619 passed (9 new in testsprint.cpp: the forward cone, start and carry-on conditions, each blocker, the threshold, exhaustion below 1%, zero max fatigue, and the Athletics drain scaling).
  • SCENARIO=movement BOOT_SECONDS=90 docker/ashlar-run.sh (software rendering). The sprint phases restart from the spawn point and circle, so the player stays on land. In the first attempt the player ran into the sea, and swimming correctly ended the sprint.
    • sprint (starts at 11% fatigue): speed 1.400× run speed, fatigue fell from 110 to 9.9 of 1000 over 10.5 s, then the sprint ended and speed went back to 1.0×.
    • tiredsprint (5% fatigue, Sprint held): highest speed 1.000×, so no sprint started.
    • sprintuse: sprinted at 1.4×, and Use at 1.5 s gave ends ... cancelled by Use, then 1.0×.
  • The default boot is clean; its screenshot matches previous runs.

Needs Eric's playtest: speed and drain feel. At 1000 max fatigue (the template's), a full-fatigue sprint lasts well over a minute. Real content with ~200–300 fatigue gives roughly 15–25 s. Tune sprint fatigue drain after playing.

Implemented in `a691315db7`. **What changed** - Engine action `A_Sprint = 52`, Lua `input.ACTION.Sprint`, a `Sprint` Lua action (hold) and `self.controls.sprint`. The default keyboard bind is **Left Alt**. On a controller it's **D-pad up**, not L3, because L3 is already Sneak in OpenMW's defaults; see the note for #8 below. `input_v3.xml` gets both binds (checked in the headless boot). - Settings: `[Game] sprint` (on), `sprint speed multiplier` (1.4 times run speed), `sprint fatigue drain` (10/s on top of the running cost, falling with Athletics to half at 100), and `sprint fatigue threshold` (0.1 of max fatigue to start). Documented in `game.rst`, `settings-default.cfg` and the Lua API docs. - The rules are in `mwmechanics/sprint.cpp`. A sprint needs forward movement within 45°, and isn't possible while sneaking, in the block stance, swimming, levitating, knocked down or paralyzed. **It ends when fatigue drops below 1% of max.** Regeneration keeps fatigue a hair above 0 while running, so a "positive fatigue" rule never ended the sprint; the scenario caught this. Pressing Use with a weapon or spell ready ends the sprint until Sprint is released, so no attack starts mid-sprint. - A sprint counts as running for animations, Athletics training and the vanilla run fatigue. `Npc::getSpeed` uses run speed × multiplier. AI doesn't sprint, and creatures can't. - With the setting off, the control does nothing. **Tests** - Build OK, components-tests 1636 passed, openmw-tests 619 passed (9 new in `testsprint.cpp`: the forward cone, start and carry-on conditions, each blocker, the threshold, exhaustion below 1%, zero max fatigue, and the Athletics drain scaling). - `SCENARIO=movement BOOT_SECONDS=90 docker/ashlar-run.sh` (software rendering). The sprint phases restart from the spawn point and circle, so the player stays on land. In the first attempt the player ran into the sea, and swimming correctly ended the sprint. - `sprint` (starts at 11% fatigue): speed **1.400×** run speed, fatigue fell from 110 to 9.9 of 1000 over 10.5 s, then the sprint ended and speed went back to 1.0×. - `tiredsprint` (5% fatigue, Sprint held): highest speed **1.000×**, so no sprint started. - `sprintuse`: sprinted at 1.4×, and Use at 1.5 s gave `ends ... cancelled by Use`, then 1.0×. - The default boot is clean; its screenshot matches previous runs. **Needs Eric's playtest:** speed and drain feel. At 1000 max fatigue (the template's), a full-fatigue sprint lasts well over a minute. Real content with ~200–300 fatigue gives roughly 15–25 s. Tune `sprint fatigue drain` after playing.
eric referenced this issue from a commit 2026-11-15 09:13:35 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gaming/ashlar#27