Optimize arena rendering and simulation loop to 60 FPS

This commit is contained in:
Meta Vens 2026-12-04 22:42:21 +01:00
commit 0f36eed3a0
12 changed files with 1810 additions and 231 deletions

View file

@ -710,7 +710,7 @@ public partial class Smoke : Node
debris.QueueFree();
}
// 4. Full Paladin hull + gear strip retains >160 pieces without mid-air eviction (MaxActiveDebris = 256)
// 4. Full Paladin hull + gear strip detaches every merged cell armor chunk + mounted gear under 256 cap
{
var debris = new DebrisSystem { Name = "SmokePaladinDebrisTest" };
AddChild(debris);
@ -718,17 +718,26 @@ public partial class Smoke : Node
var palVis = VehicleVisualInstance.Create(cache, "paladin", VehicleVisualRole.Player);
AddChild(palVis.Root);
palVis.SyncMountedGear(palGrid);
int activeCellCount = 0;
int expectedCellChunks = 0;
for (int cy = 0; cy < palGrid.Spec.Height; cy++)
{
for (int cx = 0; cx < palGrid.Spec.Width; cx++)
{
if (palGrid.Spec.IsActive(cx, cy))
{
activeCellCount++;
expectedCellChunks += palVis.CountDetachablePartsForCell(cx, cy);
}
palGrid.Armor[cx, cy] = 0f;
}
}
int expectedTotal = expectedCellChunks + palGrid.Mounted.Count;
palVis.SyncDamageAndHeat(palGrid, debris, new Vector3(1f, 0f, 3f));
GD.Print($"SMOKE INFO: Full Paladin strip debris.ActiveCount={debris.ActiveCount}");
Check(debris.ActiveCount > 160 && debris.ActiveCount <= 256,
$"Expected full Paladin strip to retain >160 debris pieces under 256 cap, got {debris.ActiveCount}");
GD.Print($"SMOKE INFO: Full Paladin strip debris.ActiveCount={debris.ActiveCount} (activeCells={activeCellCount}, cellChunks={expectedCellChunks}, mounted={palGrid.Mounted.Count})");
Check(debris.ActiveCount >= activeCellCount && debris.ActiveCount == expectedTotal && debris.ActiveCount <= 256,
$"Expected full Paladin strip to detach {expectedTotal} (>= {activeCellCount} active cells) pieces under 256 cap, got {debris.ActiveCount}");
palVis.Root.QueueFree();
debris.QueueFree();
}