perf(physics): cut production traversal to flat assets
Make prepared flat BSP data authoritative for gameplay while retaining the parsed graph only as an exact sampled referee. Fail production publication when collision package data is genuinely absent, keep idempotent already-cached publication valid, and move cell membership, floor lookup, camera diagnostics, and live/static shape bounds onto the flat representation. Validated by 8,402 Release tests, a strict dense-Arwic connected gate with 46,309/46,309 exact referee matches, and graceful shutdown. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
d9446030e6
commit
068a06518d
13 changed files with 743 additions and 43 deletions
|
|
@ -92,6 +92,36 @@ public sealed class CollisionShadowVerifierTests
|
|||
Assert.Equal("False", root.GetProperty("Flat").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FlatAuthority_MismatchKeepsFlatResultAndUsesGraphOnlyAsReferee()
|
||||
{
|
||||
string directory = NewArtifactDirectory();
|
||||
PhysicsDataCache cache = CacheWithShadow(directory);
|
||||
cache.CollisionTraversalMode = CollisionTraversalMode.Flat;
|
||||
CellPhysics matching = MatchingCell(0xA9B4_0100u);
|
||||
CellPhysics mismatched = WithFlatPhysics(
|
||||
matching,
|
||||
new FlatPhysicsBsp(
|
||||
-1,
|
||||
ImmutableArray<FlatPhysicsBspNode>.Empty,
|
||||
ImmutableArray<int>.Empty,
|
||||
FlatPolygonTable.Empty));
|
||||
|
||||
bool flatResult = CollisionTraversal.HasPhysics(cache, mismatched);
|
||||
|
||||
Assert.False(flatResult);
|
||||
CollisionShadowStats stats = cache.CollisionShadowStats;
|
||||
Assert.Equal(1, stats.Queries);
|
||||
Assert.Equal(1, stats.Samples);
|
||||
Assert.Equal(1, stats.Mismatches);
|
||||
Assert.Equal(0, stats.Faults);
|
||||
string artifact = Assert.Single(Directory.EnumerateFiles(directory));
|
||||
using JsonDocument json = JsonDocument.Parse(File.ReadAllText(artifact));
|
||||
JsonElement root = json.RootElement;
|
||||
Assert.Equal("True", root.GetProperty("Graph").GetString());
|
||||
Assert.Equal("False", root.GetProperty("Flat").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MissingFlat_IsRecordedAsFaultAndGraphRemainsAuthoritative()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue