refactor(runtime): own per-session physics simulation

Move the sole PhysicsEngine, production cache, collision admissions, canonical bodies and hosts, remote components, ordinary/remote worksets, simulation, cell commits, and shadow synchronization under RuntimeEntityObjectLifetime. Keep App as the prepared-asset, animation-input, and render-projection adapter while preserving the named-retail update and collision order.

Add exact-incarnation, object-clock, callback-reentrancy, GUID-reuse, two-runtime isolation, source ownership, collision publication, and graphical projection coverage. Release build and the complete 8,588-test solution pass.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-26 13:39:57 +02:00
parent 0dc3bfdeff
commit 7e6033d0ad
39 changed files with 3685 additions and 1722 deletions

View file

@ -504,8 +504,11 @@ public sealed class LandblockConcretePresentationPipelineTests
var state = new GpuWorldState(
new LandblockSpawnAdapter(new RecordingMeshAdapter(calls)),
entityScriptActivator: activator);
var cache = new PhysicsDataCache();
var engine = new PhysicsEngine { DataCache = cache };
var entityObjects =
new AcDream.Runtime.Entities.RuntimeEntityObjectLifetime(
new PhysicsDataCache());
PhysicsDataCache cache = entityObjects.Physics.DataCache;
PhysicsEngine engine = entityObjects.Physics.Engine;
var render = new LandblockRenderPublisher(
(_, _, _) => calls.Add("terrain"),
removeTerrain ?? (_ => calls.Add("terrain-remove")),
@ -513,7 +516,9 @@ public sealed class LandblockConcretePresentationPipelineTests
state,
commitEnvCells: commitEnvCells,
removeEnvCells: removeEnvCells ?? (_ => calls.Add("envcell-remove")));
var physics = new LandblockPhysicsPublisher(engine, new float[256]);
var physics = new LandblockPhysicsPublisher(
entityObjects.Physics,
new float[256]);
var lights = new LightManager();
var lighting = new LightingHookSink(
lights,

View file

@ -4,6 +4,7 @@ using System.Reflection;
using AcDream.App.Streaming;
using AcDream.Core.Physics;
using AcDream.Core.World;
using AcDream.Runtime.Entities;
using DatReaderWriter.DBObjs;
using DatReaderWriter.Types;
@ -22,17 +23,16 @@ public sealed class LandblockPhysicsPublisherTests
public void Constructor_ClonesHeightTableAndRejectsIncompleteInput()
{
Assert.Throws<ArgumentException>(() => new LandblockPhysicsPublisher(
new PhysicsEngine(),
new RuntimeEntityObjectLifetime().Physics,
new float[255]));
Assert.Throws<ArgumentException>(() => new LandblockPhysicsPublisher(
new PhysicsEngine(),
HeightTable));
float[] mutable = HeightTable.ToArray();
var engine = new PhysicsEngine();
var cache = new PhysicsDataCache();
engine.DataCache = cache;
var publisher = new LandblockPhysicsPublisher(engine, mutable);
var lifetime = new RuntimeEntityObjectLifetime(
new PhysicsDataCache());
PhysicsEngine engine = lifetime.Physics.Engine;
var publisher = new LandblockPhysicsPublisher(
lifetime.Physics,
mutable);
mutable[0] = 999f;
LandblockPhysicsPublication receipt = Begin(
@ -794,11 +794,12 @@ public sealed class LandblockPhysicsPublisherTests
PhysicsEngine Engine,
PhysicsDataCache Cache) Fixture()
{
var engine = new PhysicsEngine();
var cache = new PhysicsDataCache();
engine.DataCache = cache;
var lifetime = new RuntimeEntityObjectLifetime(
new PhysicsDataCache());
PhysicsEngine engine = lifetime.Physics.Engine;
PhysicsDataCache cache = lifetime.Physics.DataCache;
return (
new LandblockPhysicsPublisher(engine, HeightTable),
new LandblockPhysicsPublisher(lifetime.Physics, HeightTable),
engine,
cache);
}

View file

@ -191,15 +191,20 @@ public sealed class LandblockStaticPresentationPublisherTests
private static FixtureState Fixture()
{
var cache = new PhysicsDataCache();
var engine = new PhysicsEngine { DataCache = cache };
var entityObjects =
new AcDream.Runtime.Entities.RuntimeEntityObjectLifetime(
new PhysicsDataCache());
PhysicsDataCache cache = entityObjects.Physics.DataCache;
PhysicsEngine engine = entityObjects.Physics.Engine;
var gpuState = new GpuWorldState();
var render = new LandblockRenderPublisher(
static (_, _, _) => { },
static _ => { },
new CellVisibility(),
gpuState);
var physics = new LandblockPhysicsPublisher(engine, HeightTable);
var physics = new LandblockPhysicsPublisher(
entityObjects.Physics,
HeightTable);
var lights = new LightManager();
var lighting = new LightingHookSink(lights, new NullPoseSource());
var translucency = new TranslucencyFadeManager();