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

@ -99,7 +99,7 @@ public sealed class LiveEntityPhysicsHostOwnershipTests
watcherGuid,
resolve: Resolve,
position: new Vector3(9f, 0f, 0f));
EntityPhysicsHost rebound = EntityPhysicsHost.InstallOrRebind(
EntityPhysicsHost rebound = EntityPhysicsHostComposition.InstallOrRebind(
runtime,
watcherRecord,
configured);
@ -119,7 +119,7 @@ public sealed class LiveEntityPhysicsHostOwnershipTests
position: new Vector3(12f, 0f, 0f));
Assert.Same(
watcher,
EntityPhysicsHost.InstallOrRebind(runtime, watcherRecord, secondConfiguration));
EntityPhysicsHostComposition.InstallOrRebind(runtime, watcherRecord, secondConfiguration));
Assert.Same(targetManager, watcher.TargetManager);
Assert.Same(positionManager, watcher.PositionManager);
Assert.Equal(12f, watcher.Position.Frame.Origin.X);
@ -139,7 +139,7 @@ public sealed class LiveEntityPhysicsHostOwnershipTests
guid,
position: new Vector3(9f, 0f, 0f));
EntityPhysicsHost stable = EntityPhysicsHost.SelectStableHostWithoutRebind(
EntityPhysicsHost stable = EntityPhysicsHostComposition.SelectStableHostWithoutRebind(
runtime,
record,
configuration);
@ -151,7 +151,7 @@ public sealed class LiveEntityPhysicsHostOwnershipTests
Assert.Same(original, record.PhysicsHost);
Assert.Equal(1f, original.Position.Frame.Origin.X);
EntityPhysicsHost committed = EntityPhysicsHost.InstallOrRebind(
EntityPhysicsHost committed = EntityPhysicsHostComposition.InstallOrRebind(
runtime,
record,
configuration);
@ -209,7 +209,7 @@ public sealed class LiveEntityPhysicsHostOwnershipTests
EntityPhysicsHost configured = Host(guid, position: new Vector3(7f, 0f, 0f));
Assert.Same(
minimal,
EntityPhysicsHost.InstallOrRebind(runtime, record, configured));
EntityPhysicsHostComposition.InstallOrRebind(runtime, record, configured));
Assert.Same(minimal, motion.Host);
Assert.Equal(7f, motion.Host!.Position.Frame.Origin.X);
@ -507,7 +507,7 @@ public sealed class LiveEntityPhysicsHostOwnershipTests
Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, 0.5f),
MeshRefs = Array.Empty<AcDream.Core.World.MeshRef>(),
};
EntityPhysicsHost host = EntityPhysicsHost.CreateMinimal(record, _ => null, () => 0);
EntityPhysicsHost host = EntityPhysicsHostComposition.CreateMinimal(record, _ => null, () => 0);
Assert.Equal(record.FullCellId, host.Position.ObjCellId);
Assert.Equal(record.WorldEntity.Position, host.Position.Frame.Origin);
@ -611,7 +611,7 @@ public sealed class LiveEntityPhysicsHostOwnershipTests
const uint guid = 0x7000004Bu;
var runtime = Runtime();
LiveEntityRecord record = runtime.RegisterAndMaterializeProjection(Spawn(guid, 1));
EntityPhysicsHost host = EntityPhysicsHost.CreateMinimal(record, _ => null, () => 0);
EntityPhysicsHost host = EntityPhysicsHostComposition.CreateMinimal(record, _ => null, () => 0);
runtime.InstallPhysicsHost(record, host);
Assert.Empty(runtime.VisibleRecords);

View file

@ -663,9 +663,9 @@ public sealed class UpdateFrameOrchestratorTests
playerModeSource,
"controller.PreparePositionForCommit(",
"_camera.EnterChaseMode(legacyCamera, retailCamera);",
"EntityPhysicsHost.SelectStableHostWithoutRebind(",
"EntityPhysicsHostComposition.SelectStableHostWithoutRebind(",
"_shadow.SyncPose(",
"EntityPhysicsHost.InstallOrRebind(",
"EntityPhysicsHostComposition.InstallOrRebind(",
"playerEntity.SetPosition(initial.Position);",
"controller.CommitPreparedPosition();",
"_controllerSlot.Controller = controller;",