diff --git a/src/AcDream.App/Input/PlayerMovementController.cs b/src/AcDream.App/Input/PlayerMovementController.cs
index f533b4c..38dcb58 100644
--- a/src/AcDream.App/Input/PlayerMovementController.cs
+++ b/src/AcDream.App/Input/PlayerMovementController.cs
@@ -117,6 +117,9 @@ public sealed class PlayerMovementController
///
public float VerticalVelocity => _body.Velocity.Z;
+ /// Full 3D world-space velocity of the physics body. Exposed for diagnostic logging.
+ public Vector3 BodyVelocity => _body.Velocity;
+
// Jump charge state.
private bool _jumpCharging;
private float _jumpExtent;
diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs
index c5453fd..0e50e1a 100644
--- a/src/AcDream.App/Rendering/GameWindow.cs
+++ b/src/AcDream.App/Rendering/GameWindow.cs
@@ -1661,7 +1661,32 @@ public sealed class GameWindow : IDisposable
// No-op if same; the sequencer's fast path guards against that.
uint priorMotion = ae.Sequencer.CurrentMotion;
- ae.Sequencer.SetCycle(fullStyle, fullMotion, speedMod);
+
+ // CRITICAL: for the local player, UpdatePlayerAnimation is the
+ // authoritative driver of the sequencer. ACE's BroadcastMovement
+ // echoes the player's own motion back, but:
+ // (a) ACE's own ForwardSpeed is `creature.GetRunRate()`, which
+ // may differ from our locally-computed runRate (ACDREAM_RUN_SKILL
+ // vs real server-side skills).
+ // (b) ACE omits the ForwardSpeed flag when speed == 1.0 (per
+ // InterpretedMotionState.BuildMovementFlags). When omitted,
+ // our wire parser returns null and we'd default to 1.0 —
+ // clobbering our locally-authoritative 2.375 × animScale
+ // and leaving the legs at 30 fps cadence regardless of
+ // actual run rate.
+ // So: for the player's own guid, skip the wire-echo SetCycle.
+ // UpdatePlayerAnimation has already set the correct cycle with
+ // our locally-chosen speedMod, and that value should persist
+ // until the next local motion change.
+ if (update.Guid == _playerServerGuid)
+ {
+ // Still update the stance echo (_playerMotionTableId, etc) via
+ // the paths above, but don't stomp the animation sequencer.
+ }
+ else
+ {
+ ae.Sequencer.SetCycle(fullStyle, fullMotion, speedMod);
+ }
// CRITICAL: when we enter a locomotion cycle (Walk/Run/etc),
// stamp the _remoteLastMove timestamp to "now". Without this,
@@ -4063,7 +4088,20 @@ public sealed class GameWindow : IDisposable
{
animSpeed = fs;
}
- ae.Sequencer.SetCycle(fullStyle, animCommand, animSpeed);
+ // ACDREAM_ANIM_SPEED_SCALE: optional visual-pacing knob. Retail's
+ // animation framerate scales linearly with speedMod (r03 §8.3),
+ // and our speedMod = runRate. If the visual feel doesn't match
+ // retail, override via env var (default 1.0 = no change).
+ float animScale = 1.0f;
+ if (float.TryParse(
+ Environment.GetEnvironmentVariable("ACDREAM_ANIM_SPEED_SCALE"),
+ System.Globalization.NumberStyles.Float,
+ System.Globalization.CultureInfo.InvariantCulture,
+ out var s) && s > 0f)
+ {
+ animScale = s;
+ }
+ ae.Sequencer.SetCycle(fullStyle, animCommand, animSpeed * animScale);
}
// Legacy path: update the manual slerp fields (for entities without sequencer)
diff --git a/src/AcDream.Core/Physics/AnimationSequencer.cs b/src/AcDream.Core/Physics/AnimationSequencer.cs
index 4d77ef2..0a8249f 100644
--- a/src/AcDream.Core/Physics/AnimationSequencer.cs
+++ b/src/AcDream.Core/Physics/AnimationSequencer.cs
@@ -426,8 +426,75 @@ public sealed class AnimationSequencer
CurrentStyle = style;
CurrentMotion = motion;
CurrentSpeedMod = speedMod;
+
+ // ── Synthesize CurrentVelocity for locomotion cycles ──────────────
+ // The Humanoid motion table ships every locomotion MotionData with
+ // Flags=0x00 (no HasVelocity), so EnqueueMotionData leaves
+ // CurrentVelocity at Vector3.Zero. That matches the literal retail
+ // dat, but retail's body physics uses CMotionInterp::get_state_velocity
+ // (FUN_00528960) which returns RunAnimSpeed × ForwardSpeed for
+ // RunForward, independent of the dat's HasVelocity flag. The dat
+ // velocity is a separate additive source (kick-off velocity, flying
+ // creatures, etc) not the primary locomotion drive.
+ //
+ // For our sequencer's to be usable by
+ // consumers (local-player get_state_velocity via Option B, remote
+ // dead-reckoning in GameWindow) it must carry the retail-constant
+ // locomotion value when the dat is silent. Synthesize it here,
+ // post-EnqueueMotionData, only when the cycle is a locomotion cycle
+ // AND the dat didn't populate it.
+ //
+ // Constants match etc —
+ // decompiled from _DAT_007c96e0/e4/e8. The velocity is body-local
+ // (+Y = forward, +X = right); consumers rotate into world space via
+ // the owning entity's orientation.
+ if (CurrentVelocity.LengthSquared() < 1e-9f)
+ {
+ float yvel = 0f;
+ float xvel = 0f;
+ // Low byte of the ORIGINAL (non-adjusted) motion tells us which
+ // intent the caller signalled. adjust_motion may have remapped
+ // TurnLeft → TurnRight / SideStepLeft → SideStepRight /
+ // WalkBackward → WalkForward, encoding the sign into adjustedSpeed.
+ // The speed sign is preserved in adjustedSpeed so we multiply by
+ // it rather than re-deriving per-case.
+ uint low = motion & 0xFFu;
+ switch (low)
+ {
+ case 0x05: // WalkForward
+ yvel = WalkAnimSpeed * adjustedSpeed;
+ break;
+ case 0x06: // WalkBackward — adjust_motion remapped to WalkForward
+ // with speedMod *= -0.65f, so adjustedSpeed already
+ // carries the factor. But the motion arg we see
+ // here is the original (pre-adjust) 0x06, so we
+ // still use WalkAnimSpeed — the negative sign of
+ // adjustedSpeed flips the direction correctly.
+ yvel = WalkAnimSpeed * adjustedSpeed;
+ break;
+ case 0x07: // RunForward
+ yvel = RunAnimSpeed * adjustedSpeed;
+ break;
+ case 0x0F: // SideStepRight
+ xvel = SidestepAnimSpeed * adjustedSpeed;
+ break;
+ case 0x10: // SideStepLeft — remapped to SideStepRight with
+ // negated speed; same handling as backward walk.
+ xvel = SidestepAnimSpeed * adjustedSpeed;
+ break;
+ }
+ if (yvel != 0f || xvel != 0f)
+ CurrentVelocity = new Vector3(xvel, yvel, 0f);
+ }
}
+ // Retail locomotion constants — mirror of MotionInterpreter.RunAnimSpeed
+ // etc. Kept here to keep AnimationSequencer self-contained for the
+ // synthesize-velocity path above. Values decompiled from _DAT_007c96e0/e4/e8.
+ private const float WalkAnimSpeed = 3.12f;
+ private const float RunAnimSpeed = 4.0f;
+ private const float SidestepAnimSpeed = 1.25f;
+
///
/// Scale every cyclic node's framerate by , mirroring
/// ACE's Sequence.multiply_cyclic_animation_framerate