21 commits porting retail's MoveToManager-equivalent client-side behavior for server-controlled creature locomotion and combat engagement. Shipped as MVP after live visual verification across multiple iteration rounds with the user. Highlights: -186a584— initial Phase L.1c port: extracts Origin / target guid / MovementParameters block from MoveTo packets (movementType 6/7), adds RemoteMoveToDriver per-tick body-orientation steering with ±20° aux-turn-equivalent snap tolerance. -d247aef— corrected arrival predicate semantics + 1.5 s stale-destination timeout for entities leaving the streaming view. -f794832— root-caused "creature won't stop to attack" via two research subagents converging on retail CMotionInterp::move_to_interpreted_state's unconditional forward_command bulk-copy. Lifted ServerMoveToActive flag clearing + InterpretedState bulk-copy out of substate-only branch so Action-class swing UMs (mt=0 ForwardCommand=AttackHigh1) clear stale MoveTo state and zero forward velocity. -ff6d3d0— RemoteMoveToDriver.ClampApproachVelocity caps horizontal velocity at the final-approach tick so body lands EXACTLY at DistanceToObject instead of overshooting through the player. -37de771— bulk-copy ForwardCommand for MoveTo packets too (closed the regression where MoveTo creatures stayed at default ForwardCommand=Ready in InterpretedState and only translated via UpdatePosition snaps). -34d7f4d+e71ed73— AnimationSequencer.HasCycle query + fallback chain (requested → WalkForward → Ready → no-op) at BOTH the OnLiveMotionUpdated path AND the spawn handler. Prevents ClearCyclicTail from wiping the body's cyclic tail when ACE CreateObject carries CurrentMotionState.ForwardCommand pointing to an Action-class motion (e.g. AttackHigh1 from a mid-swing creature) which has no cyclic-table entry — was the "torso on the ground" symptom for monsters seen in combat by a fresh observer. Cross-references: docs/research/named-retail/acclient_2013_pseudo_c.txt (MoveToManager 0x00529680 + 0x0052a240 + 0x00529d80, CMotionInterp::move_to_interpreted_state 0x00528xxx, MovementParameters::UnPackNet 0x0052ac50), references/ACE/Source/ ACE.Server/Physics/Animation/MoveToManager.cs (port aid), references/holtburger/ (cross-check on snapshot-only client behavior), docs/research/2026-04-28-remote-moveto-pseudocode.md (the Phase L.1c pseudocode doc). Tests: 1404 → 1422 (parser type-7 path retention, type-6 target guid retention, driver arrival semantics, retail-faithful chase/flee branches, approach-velocity clamp scenarios, HasCycle present/missing, AttackHigh1 wire layout). Pending follow-ups (filed for future): target-guid live resolution for type 6 packets (residual chase lag), StickToObject sticky-target guid trailing field, full MoveToManager state machine port (CheckProgressMade stall detector, Sticky/StickTo, use_final_heading, pending_actions queue). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
73 lines
2.8 KiB
C#
73 lines
2.8 KiB
C#
using System;
|
|
using AcDream.Core.World;
|
|
using Xunit;
|
|
|
|
namespace AcDream.Core.Tests.World;
|
|
|
|
[Collection(DerethDateTimeCollection.Name)]
|
|
public sealed class WorldTimeDebugTests
|
|
{
|
|
[Fact]
|
|
public void SetDebugTime_OverridesDayFraction()
|
|
{
|
|
var service = new WorldTimeService(SkyStateProvider.Default());
|
|
service.SyncFromServer(0); // server tick 0 (= Morntide-and-Half)
|
|
|
|
service.SetDebugTime(0.5f); // force noon (Midsong-and-Half)
|
|
Assert.InRange(service.DayFraction, 0.499, 0.501);
|
|
}
|
|
|
|
[Fact]
|
|
public void ClearDebugTime_RestoresServerTime()
|
|
{
|
|
// Post tick-0-offset fix: DayFraction(tick) = ((tick + 7/16 * DayTicks) % DayTicks) / DayTicks.
|
|
// Pick a server tick whose real-world meaning is straightforward to verify.
|
|
// Sync to (0.25 - 7/16) * DayTicks negative means "3 slots before midnight
|
|
// past Morntide-and-Half", which in positive terms is 13/16 of the day
|
|
// past Morntide-and-Half, but simpler: sync to "1/16 past midnight" =
|
|
// ticks giving fraction 1/16. Required tick offset from 0 to land at
|
|
// fraction 1/16: solve (t + 7/16*D) mod D = 1/16*D
|
|
// → t = (1/16 - 7/16) * D mod D = -6/16 * D mod D = 10/16 * D.
|
|
double targetFraction = 1.0 / 16.0; // Darktide-and-Half
|
|
double syncTick = targetFraction * DerethDateTime.DayTicks - DerethDateTime.OriginOffsetTicks;
|
|
while (syncTick < 0) syncTick += DerethDateTime.DayTicks;
|
|
|
|
var service = new WorldTimeService(SkyStateProvider.Default());
|
|
service.SyncFromServer(syncTick);
|
|
service.SetDebugTime(0.5f);
|
|
service.ClearDebugTime();
|
|
|
|
Assert.InRange(service.DayFraction, targetFraction - 0.01, targetFraction + 0.01);
|
|
}
|
|
|
|
[Fact]
|
|
public void SyncFromServer_ClearsDebugOverride()
|
|
{
|
|
var service = new WorldTimeService(SkyStateProvider.Default());
|
|
service.SetDebugTime(0.75f);
|
|
service.SyncFromServer(0); // tick 0 = Morntide-and-Half → fraction 7/16
|
|
|
|
Assert.InRange(service.DayFraction, 7.0 / 16.0 - 0.01, 7.0 / 16.0 + 0.01);
|
|
}
|
|
|
|
[Fact]
|
|
public void SetProvider_AcceptsNewKeyframes()
|
|
{
|
|
var service = new WorldTimeService(SkyStateProvider.Default());
|
|
var custom = new SkyStateProvider(new[]
|
|
{
|
|
new SkyKeyframe(
|
|
Begin: 0f,
|
|
SunHeadingDeg: 0f,
|
|
SunPitchDeg: 90f,
|
|
DirColor: System.Numerics.Vector3.One,
|
|
DirBright: 1f,
|
|
AmbColor: System.Numerics.Vector3.One,
|
|
AmbBright: 1f,
|
|
FogColor: System.Numerics.Vector3.Zero,
|
|
FogDensity: 0f),
|
|
});
|
|
service.SetProvider(custom);
|
|
Assert.Equal(1, custom.KeyframeCount);
|
|
}
|
|
}
|