feat(vfx): decode retail hooks and typed tables

Replace the incomplete package path with one DatCollection-backed compatibility seam for PhysicsScripts and Animations. Preserve CreateBlockingParticle's inherited payload and following cursor, route every production and audit consumer through the corrected loaders, and apply retail's post-UnPack StartTime ordering.

Add exact stored-order PhysicsScriptTable upper-threshold resolution, high-byte DID and embedded-ID validation, plus live effect profiles with Setup-to-PhysicsDesc precedence across top-level and attached entity lifetimes. Keep blocking execution deferred and narrow TS-11 accordingly.

Pin synthetic malformed/cursor/order fixtures, installed-DAT blocking and recall audits, high-index IDs, IEEE boundaries, profile teardown, and ordinary decoder parity; synchronize architecture, inventory, milestones, roadmap, research, and memory.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-14 08:17:44 +02:00
parent 8dd996053d
commit 363e046112
31 changed files with 1102 additions and 73 deletions

View file

@ -313,7 +313,7 @@ public sealed class GameWindow : IDisposable
AcDream.Core.World.WorldEntity Entity,
AnimatedEntity? Animation);
private AcDream.Core.Physics.DatCollectionLoader? _animLoader;
private AcDream.Core.Physics.IAnimationLoader? _animLoader;
// Phase E.1: central fan-out for animation hooks. Audio (E.2),
// particles (E.3), combat (E.4), and renderer state mutators all
@ -336,6 +336,7 @@ public sealed class GameWindow : IDisposable
// from the server and schedules the dat-defined hooks (particle spawns,
// sounds, light toggles) at their StartTime offsets.
private AcDream.Core.Vfx.PhysicsScriptRunner? _scriptRunner;
private AcDream.Content.Vfx.RetailPhysicsScriptLoader? _physicsScriptLoader;
private AcDream.App.Rendering.ParticleRenderer? _particleRenderer;
// Retail GameSky copies SkyObject.PesObjectId into CelestialPosition but
// never consumes it in CreateDeletePhysicsObjects/MakeObject/UseTime.
@ -1432,7 +1433,7 @@ public sealed class GameWindow : IDisposable
_cameraController.ModeChanged += OnCameraModeChanged;
_dats = new DatCollection(_datDir, DatAccessType.Read);
_animLoader = new AcDream.Core.Physics.DatCollectionLoader(_dats);
_animLoader = new AcDream.Content.Vfx.RetailAnimationLoader(_dats);
_emitterRegistry = new AcDream.Core.Vfx.EmitterDescRegistry(_dats);
// Phase E.3 particles: always-on, no driver dependency. Registered
@ -1447,7 +1448,10 @@ public sealed class GameWindow : IDisposable
// resolve PlayScript ids, and the same ParticleHookSink the
// animation system uses, so CreateParticleHook fired from a
// script spawns through the normal particle pipeline.
_scriptRunner = new AcDream.Core.Vfx.PhysicsScriptRunner(_dats, _particleSink);
_physicsScriptLoader = new AcDream.Content.Vfx.RetailPhysicsScriptLoader(_dats);
_scriptRunner = new AcDream.Core.Vfx.PhysicsScriptRunner(
_physicsScriptLoader.LoadPhysicsScript,
_particleSink);
// Phase G.2 lighting hooks: SetLightHook flips IsLit on
// owner-tagged lights so ignite-torch animations light up,
@ -3319,7 +3323,7 @@ public sealed class GameWindow : IDisposable
// animated entry registered) — this happens for entities the
// resolver short-circuits on.
var idleCycle = AcDream.Core.Meshing.MotionResolver.GetIdleCycle(
setup, _dats,
setup, _dats, _animLoader!,
motionTableIdOverride: spawn.MotionTableId,
stanceOverride: stanceOverride,
commandOverride: commandOverride);
@ -3688,6 +3692,14 @@ public sealed class GameWindow : IDisposable
return;
}
if (!_liveEntities!.TryGetEffectProfile(spawn.Guid, out _))
{
var effectProfile = spawn.Physics is { } physics
? AcDream.App.Rendering.Vfx.EntityEffectProfile.CreateLive(setup, physics)
: AcDream.App.Rendering.Vfx.EntityEffectProfile.CreateDatStatic(setup);
_liveEntities.SetEffectProfile(spawn.Guid, effectProfile);
}
bool createdProjection = false;
var entity = _liveEntities!.MaterializeLiveEntity(
spawn.Guid,
@ -4169,7 +4181,7 @@ public sealed class GameWindow : IDisposable
// garbage frame count → OOM).
uint poseDid = ResolvePaperdollPoseDid();
if ((poseDid >> 24) != 0x03u) return;
var anim = dats.Get<DatReaderWriter.DBObjs.Animation>(poseDid);
var anim = _animLoader?.LoadAnimation(poseDid);
var setup = dats.Get<DatReaderWriter.DBObjs.Setup>(setupId);
if (anim is null || setup is null || anim.PartFrames.Count == 0) return;
@ -4361,6 +4373,14 @@ public sealed class GameWindow : IDisposable
private void RouteSameGenerationCreateObject(
AcDream.App.World.SameGenerationCreateObjectEvents refresh)
{
if (_liveEntities!.TryGetEffectProfile(
refresh.Appearance.Guid,
out var effectProfile)
&& effectProfile is AcDream.App.Rendering.Vfx.EntityEffectProfile liveProfile)
{
liveProfile.ApplyNetworkDescription(refresh.Description);
}
OnLiveAppearanceUpdated(refresh.Appearance);
if (refresh.Parent is { } parent
@ -4481,7 +4501,7 @@ public sealed class GameWindow : IDisposable
if (mt is null) return null;
var pose = AcDream.Core.Physics.Motion.MotionTablePose.DefaultStatePartFrames(
mt, id => _dats.Get<DatReaderWriter.DBObjs.Animation>(id));
mt, id => _animLoader?.LoadAnimation(id));
if (Environment.GetEnvironmentVariable("ACDREAM_DUMP_MOTION") == "1")
{
@ -5464,7 +5484,7 @@ public sealed class GameWindow : IDisposable
// a concrete Animation + frame range. Only swap when the resolver
// returns a clearly-better cycle.
var newCycle = AcDream.Core.Meshing.MotionResolver.GetIdleCycle(
ae.Setup, _dats,
ae.Setup, _dats, _animLoader!,
motionTableIdOverride: null,
stanceOverride: stance,
commandOverride: command);