diag(motion): instrumentation for remote walk↔run leg-cycle bug (Commit A)
Adds five diagnostics, no behavior changes. All gated on existing
ACDREAM_REMOTE_VEL_DIAG=1 env var. Plan at
~/.claude/plans/yes-make-a-plan-parsed-axolotl.md.
Five hypotheses surviving from the four-agent investigation
(docs/research/2026-05-03-remote-anim-cycle/investigation-prompt.md):
H1 SEQSTATE silently swallowed by OMEGA_DIAG sharing throttle clock
H2 ApplyServerControlledVelocityCycle races UM-driven SetCycle per UP
H3 SetCycle fast-path returns without updating _currNode
H4 GetLink/GetCycle null → defensive fallback lands on stale head
H5 PartTemplate.Count diverges from anim PartFrames.Count → silent
identity-quat freeze
Diagnostics added (all log lines are grep-prefixed):
D1 Split LastSeqStateLogTime field for SEQSTATE — own throttle.
Foundational: every other diag depends on SEQSTATE telling truth.
D2 [UPCYCLE] inside ApplyServerControlledVelocityCycle, +
[UPCYCLE_SRC] at the call site (wire vs synth velocity).
D3 [SCFAST] in fast-path return, [SCFULL] at full-rebuild end.
D4 [SCNULLFALLBACK] in the null-data defensive fallback.
D5 [PARTSDIAG] with pt.Count / seqFrames.Count / setup.Parts.Count /
anim.PartFrames[0].Frames.Count + sum-of-components hash.
Repro recipe:
$env:ACDREAM_INTERP_MANAGER = "1"
$env:ACDREAM_REMOTE_VEL_DIAG = "1"
dotnet run … 2>&1 | Tee-Object tools/diag-logs/walkrun-<ts>.log
Then watch a retail-driven character through acdream and exercise:
idle → W run → release → shift+W walk → release → demote → promote →
run+turn (this last one is the H1 trap).
Decision matrix in the plan file maps each [TAG] signature to a
specific Commit B fix.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
7f1bd1809a
commit
23004a4791
3 changed files with 161 additions and 2 deletions
|
|
@ -377,6 +377,23 @@ public sealed class GameWindow : IDisposable
|
|||
public double PrevServerPosTime;
|
||||
public double LastOmegaDiagLogTime;
|
||||
/// <summary>
|
||||
/// Diagnostic-only (gated on <c>ACDREAM_REMOTE_VEL_DIAG=1</c>): own
|
||||
/// throttle clock for the SEQSTATE log line in TickAnimations.
|
||||
/// Previously SEQSTATE shared <see cref="LastOmegaDiagLogTime"/> with
|
||||
/// the OMEGA_DIAG block, which fires at 0.5s and resets the clock —
|
||||
/// any remote that turned during a transition silently swallowed
|
||||
/// SEQSTATE for 0.5–1.5s, masking the bug we're trying to diagnose
|
||||
/// (walk↔run leg-cycle sticking on observed retail chars). Split
|
||||
/// 2026-05-03 (Commit A).
|
||||
/// </summary>
|
||||
public double LastSeqStateLogTime;
|
||||
/// <summary>
|
||||
/// Diagnostic-only (gated on <c>ACDREAM_REMOTE_VEL_DIAG=1</c>): own
|
||||
/// throttle clock for the PARTSDIAG log line in TickAnimations
|
||||
/// (D5). One log per remote per ~1s.
|
||||
/// </summary>
|
||||
public double LastPartsDiagLogTime;
|
||||
/// <summary>
|
||||
/// Diagnostic-only: max |sequencer.CurrentVelocity| observed across
|
||||
/// all per-tick samples since the last UpdatePosition arrival. The
|
||||
/// next UP compares this against (LastServerPos - PrevServerPos) /
|
||||
|
|
@ -3295,6 +3312,23 @@ public sealed class GameWindow : IDisposable
|
|||
uint style = ae.Sequencer.CurrentStyle != 0
|
||||
? ae.Sequencer.CurrentStyle
|
||||
: 0x8000003Du;
|
||||
|
||||
// D2 (Commit A 2026-05-03): UPCYCLE diag — proves whether
|
||||
// ApplyServerControlledVelocityCycle is racing UpdateMotion-driven
|
||||
// SetCycle for player-driven remotes. If this fires every ~100-200ms
|
||||
// during a Walk→Run press with `motion` flipping between buckets,
|
||||
// H2 (UP-vs-UM race) is confirmed. UPs (5-10 Hz) would then
|
||||
// perpetually overwrite the cycle the UM just set.
|
||||
if (System.Environment.GetEnvironmentVariable("ACDREAM_REMOTE_VEL_DIAG") == "1")
|
||||
{
|
||||
System.Console.WriteLine(
|
||||
$"[UPCYCLE] guid={serverGuid:X8} "
|
||||
+ $"vel=({velocity.X:F2},{velocity.Y:F2},{velocity.Z:F2}) "
|
||||
+ $"|v|={velocity.Length():F2} "
|
||||
+ $"-> motion=0x{plan.Motion:X8} speedMod={plan.SpeedMod:F2} "
|
||||
+ $"prev=0x{currentMotion:X8} "
|
||||
+ $"airborne={rm.Airborne} moveTo={rm.ServerMoveToActive}");
|
||||
}
|
||||
ae.Sequencer.SetCycle(style, plan.Motion, plan.SpeedMod);
|
||||
}
|
||||
|
||||
|
|
@ -3607,6 +3641,17 @@ public sealed class GameWindow : IDisposable
|
|||
&& rmState.HasServerVelocity
|
||||
&& _animatedEntities.TryGetValue(entity.Id, out var aeForVelocity))
|
||||
{
|
||||
// D2 (Commit A 2026-05-03): tag whether the velocity feeding
|
||||
// ApplyServerControlledVelocityCycle is wire-explicit (rare for
|
||||
// player remotes — ACE almost never sets HasVelocity on player
|
||||
// UPs) or synthesized from position deltas (the common case).
|
||||
// Pairs with the [UPCYCLE] line printed inside the call.
|
||||
if (System.Environment.GetEnvironmentVariable("ACDREAM_REMOTE_VEL_DIAG") == "1")
|
||||
{
|
||||
string velSrc = update.Velocity is null ? "synth" : "wire";
|
||||
System.Console.WriteLine(
|
||||
$"[UPCYCLE_SRC] guid={update.Guid:X8} src={velSrc}");
|
||||
}
|
||||
ApplyServerControlledVelocityCycle(
|
||||
update.Guid,
|
||||
aeForVelocity,
|
||||
|
|
@ -6522,12 +6567,16 @@ public sealed class GameWindow : IDisposable
|
|||
{
|
||||
double nowSec = (System.DateTime.UtcNow - System.DateTime.UnixEpoch).TotalSeconds;
|
||||
if (_remoteDeadReckon.TryGetValue(serverGuid, out var rmDiag)
|
||||
&& nowSec - rmDiag.LastOmegaDiagLogTime > 1.0)
|
||||
&& nowSec - rmDiag.LastSeqStateLogTime > 1.0)
|
||||
{
|
||||
// D1 (2026-05-03): SEQSTATE has its own throttle clock
|
||||
// (LastSeqStateLogTime) so it isn't silently swallowed by
|
||||
// OMEGA_DIAG resetting LastOmegaDiagLogTime when the
|
||||
// observed remote happens to be turning.
|
||||
System.Console.WriteLine(
|
||||
$"[SEQSTATE] guid={serverGuid:X8} CurrentMotion=0x{ae.Sequencer.CurrentMotion:X8} "
|
||||
+ $"CurrentSpeedMod={ae.Sequencer.CurrentSpeedMod:F3}");
|
||||
rmDiag.LastOmegaDiagLogTime = nowSec;
|
||||
rmDiag.LastSeqStateLogTime = nowSec;
|
||||
}
|
||||
}
|
||||
seqFrames = ae.Sequencer.Advance(dt);
|
||||
|
|
@ -6564,6 +6613,51 @@ public sealed class GameWindow : IDisposable
|
|||
}
|
||||
|
||||
int partCount = ae.PartTemplate.Count;
|
||||
|
||||
// D5 (Commit A 2026-05-03): PARTSDIAG — proves whether
|
||||
// PartTemplate.Count diverges from seqFrames.Count (silent
|
||||
// identity-quat fallback freezes parts → H5) and whether the
|
||||
// per-part frames returned by Advance actually change between
|
||||
// Walk and Run cycles. The seqFrames hash is a sum-of-components
|
||||
// proxy: cheap, unitless, monotonically distinct between cycles
|
||||
// for any non-degenerate animation. If [PARTSDIAG] shows the
|
||||
// hash unchanged across a Walk→Run transition while [SEQSTATE]
|
||||
// shows CurrentMotion flipping, the sequencer is serving stale
|
||||
// frames despite the cycle being correct.
|
||||
if (System.Environment.GetEnvironmentVariable("ACDREAM_REMOTE_VEL_DIAG") == "1"
|
||||
&& serverGuid != 0
|
||||
&& serverGuid != _playerServerGuid
|
||||
&& _remoteDeadReckon.TryGetValue(serverGuid, out var rmParts))
|
||||
{
|
||||
double nowSecParts = (System.DateTime.UtcNow - System.DateTime.UnixEpoch).TotalSeconds;
|
||||
if (nowSecParts - rmParts.LastPartsDiagLogTime > 1.0)
|
||||
{
|
||||
int seqCount = seqFrames?.Count ?? -1;
|
||||
int setupParts = ae.Setup.Parts.Count;
|
||||
int animFrame0Parts = ae.Animation.PartFrames.Count > 0
|
||||
? ae.Animation.PartFrames[0].Frames.Count
|
||||
: -1;
|
||||
double seqHash = 0.0;
|
||||
if (seqFrames is not null)
|
||||
{
|
||||
for (int hi = 0; hi < seqFrames.Count; hi++)
|
||||
{
|
||||
var f = seqFrames[hi];
|
||||
seqHash += f.Origin.X + f.Origin.Y + f.Origin.Z
|
||||
+ f.Orientation.X + f.Orientation.Y
|
||||
+ f.Orientation.Z + f.Orientation.W;
|
||||
}
|
||||
}
|
||||
System.Console.WriteLine(
|
||||
$"[PARTSDIAG] guid={serverGuid:X8} "
|
||||
+ $"pt.Count={partCount} seqFrames.Count={seqCount} "
|
||||
+ $"setup.Parts.Count={setupParts} "
|
||||
+ $"anim.PartFrames[0].Frames.Count={animFrame0Parts} "
|
||||
+ $"seqHash={seqHash:F4}");
|
||||
rmParts.LastPartsDiagLogTime = nowSecParts;
|
||||
}
|
||||
}
|
||||
|
||||
var newMeshRefs = new List<AcDream.Core.World.MeshRef>(partCount);
|
||||
var scaleMat = ae.Scale == 1.0f
|
||||
? System.Numerics.Matrix4x4.Identity
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue