#6a Movement acceleration and deceleration curves #26

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

Part of #6. Player and NPC movement currently snaps to full speed on key press and stops dead on release. Ramp it instead, game-neutrally.

Scope

  • New [Game] movement acceleration setting (on by default) with acceleration and deceleration times in seconds (start around 0.15 s up, 0.1 s down; separate air control factor while jumping or falling).
  • Applied to the movement vector the character controller sends to physics, for the player and for actors (NPC AI paths shouldn't overshoot: deceleration must not push an actor past its path point).
  • Direction changes blend through the ramp rather than reversing instantly; turning on the spot is unaffected.
  • With the setting off, behavior is identical to upstream.
  • Lua: expose the current smoothed movement factor read-only, or document how self.controls interacts with it.

Acceptance

  • Pure ramp/curve logic in its own file with unit tests in apps/openmw_tests (ramp up, ramp down, direction reversal, frame-rate independence for dt 1/30 to 1/240).
  • A headless scenario or log line shows the player reaching full speed after the acceleration time, not on the first frame.
  • Build and both test suites pass; default boot is clean.
  • Feel needs Eric's playtest; the defaults are a starting point.
Part of #6. Player and NPC movement currently snaps to full speed on key press and stops dead on release. Ramp it instead, game-neutrally. **Scope** - New `[Game] movement acceleration` setting (on by default) with acceleration and deceleration times in seconds (start around 0.15 s up, 0.1 s down; separate air control factor while jumping or falling). - Applied to the movement vector the character controller sends to physics, for the player and for actors (NPC AI paths shouldn't overshoot: deceleration must not push an actor past its path point). - Direction changes blend through the ramp rather than reversing instantly; turning on the spot is unaffected. - With the setting off, behavior is identical to upstream. - Lua: expose the current smoothed movement factor read-only, or document how `self.controls` interacts with it. **Acceptance** - Pure ramp/curve logic in its own file with unit tests in `apps/openmw_tests` (ramp up, ramp down, direction reversal, frame-rate independence for dt 1/30 to 1/240). - A headless scenario or log line shows the player reaching full speed after the acceleration time, not on the first frame. - Build and both test suites pass; default boot is clean. - Feel needs Eric's playtest; the defaults are a starting point.
claude added this to the 2. Feel milestone 2026-11-14 20:44:36 +00:00
Author
Member

Implemented in f3bb0753c7.

What changed

  • New settings: [Game] movement acceleration (on), movement acceleration time (0.15 s), movement deceleration time (0.1 s) and movement air control (0.3, a share of the ground rate while jumping or falling; 0 freezes movement in the air). Documented in game.rst and settings-default.cfg.
  • mwmechanics/movementramp.cpp holds the pure ramp. It works in the actor's own frame (x right, y forward), so mouse turning and AI steering are never delayed, and turning on the spot is unaffected. Movement along the new direction rises at 1/accel and falls at 1/decel. A reversal slows down through zero, then speeds up with the leftover time. Sideways movement left over from a direction change dies away at the deceleration rate.
  • CharacterController::applyMovementAcceleration applies it after upstream's smooth movement step. The ramp resets on teleport, knockdown, recovery and scripted animations. NPCs and creatures ramp up but stop at once, so they can't overshoot a path point. The player decelerates.
  • Lua: self.controls is the requested movement, and types.Actor.getCurrentSpeed returns the speed after the ramp (documented under the setting). I didn't add a new binding.
  • With the setting off, the only change is that the ramp state is cleared, so behavior matches upstream.

Tests

  • docker/ashlar-build.sh: build OK, components-tests 1636 passed, openmw-tests 610 passed (14 new in testmovementramp.cpp: ramp up, ramp down, partial slow-down, reversal, 90° turn, the speed cap, zero and infinite times, and frame-rate independence at dt 1/30, 1/60, 1/120 and 1/240).
  • New SCENARIO=movement BOOT_SECONDS=60 docker/ashlar-run.sh (see docs/ashlar/SCENARIOS.md), software rendering at about 80 fps:
    • forward from standing: full speed after 0.150 s (first frame 0.097 of run speed)
    • release: stopped after 0.101 s
    • forward again: full after 0.160 s
    • forward to backward without stopping: full reverse speed after 0.249 s (0.1 s down plus 0.15 s up)
  • The default boot is clean, with the same Game Template view. The combat scenario still behaves: 12 player blocks, 6 parries, 12 NPC blocks, 65 flinches and no script errors, so NPC chasing and fighting still work.

Needs Eric's playtest: how starting, stopping and strafing feel, in first and third person and on a controller. The defaults are a starting point. If stopping feels floaty, try movement deceleration time = 0.06.

Closing; feel is tracked on #6.

Implemented in `f3bb0753c7`. **What changed** - New settings: `[Game] movement acceleration` (on), `movement acceleration time` (0.15 s), `movement deceleration time` (0.1 s) and `movement air control` (0.3, a share of the ground rate while jumping or falling; 0 freezes movement in the air). Documented in `game.rst` and `settings-default.cfg`. - `mwmechanics/movementramp.cpp` holds the pure ramp. It works in the actor's own frame (x right, y forward), so mouse turning and AI steering are never delayed, and turning on the spot is unaffected. Movement along the new direction rises at 1/accel and falls at 1/decel. A reversal slows down through zero, then speeds up with the leftover time. Sideways movement left over from a direction change dies away at the deceleration rate. - `CharacterController::applyMovementAcceleration` applies it after upstream's `smooth movement` step. The ramp resets on teleport, knockdown, recovery and scripted animations. **NPCs and creatures ramp up but stop at once**, so they can't overshoot a path point. The player decelerates. - Lua: `self.controls` is the requested movement, and `types.Actor.getCurrentSpeed` returns the speed after the ramp (documented under the setting). I didn't add a new binding. - With the setting off, the only change is that the ramp state is cleared, so behavior matches upstream. **Tests** - `docker/ashlar-build.sh`: build OK, components-tests 1636 passed, openmw-tests 610 passed (14 new in `testmovementramp.cpp`: ramp up, ramp down, partial slow-down, reversal, 90° turn, the speed cap, zero and infinite times, and frame-rate independence at dt 1/30, 1/60, 1/120 and 1/240). - New `SCENARIO=movement BOOT_SECONDS=60 docker/ashlar-run.sh` (see `docs/ashlar/SCENARIOS.md`), software rendering at about 80 fps: - forward from standing: full speed after **0.150 s** (first frame 0.097 of run speed) - release: stopped after **0.101 s** - forward again: full after 0.160 s - forward to backward without stopping: full reverse speed after **0.249 s** (0.1 s down plus 0.15 s up) - The default boot is clean, with the same Game Template view. The combat scenario still behaves: 12 player blocks, 6 parries, 12 NPC blocks, 65 flinches and no script errors, so NPC chasing and fighting still work. **Needs Eric's playtest:** how starting, stopping and strafing feel, in first and third person and on a controller. The defaults are a starting point. If stopping feels floaty, try `movement deceleration time = 0.06`. Closing; feel is tracked on #6.
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#26