Make initial login and portal arrival consume one WorldRevealReadinessBarrier that joins near-tier mesh publication, destination composite uploads, and collision residency before normal world geometry becomes visible. This ports retail SmartBox's blocking-cell completion edge into the asynchronous client instead of exposing a ground-only login. Add focused outdoor, indoor, texture, and invalid-claim tests; update the retail pseudocode, architecture, divergence record, issue ledger, roadmap baseline, and synchronized agent guidance. Co-authored-by: OpenAI Codex <codex@openai.com>
124 lines
3.7 KiB
C#
124 lines
3.7 KiB
C#
using AcDream.App.Streaming;
|
|
|
|
namespace AcDream.App.Tests.Streaming;
|
|
|
|
public sealed class WorldRevealReadinessBarrierTests
|
|
{
|
|
private sealed class State
|
|
{
|
|
public bool RenderReady;
|
|
public bool SpawnCellReady;
|
|
public bool TerrainReady;
|
|
public bool CompositeReady;
|
|
public bool Unhydratable;
|
|
public int Invalidations;
|
|
public int Preparations;
|
|
public uint PreparedCell;
|
|
public int PreparedRadius = -1;
|
|
public int RenderRadius = -1;
|
|
public int TerrainRadius = -1;
|
|
|
|
public WorldRevealReadinessBarrier Build() => new(
|
|
isRenderNeighborhoodReady: (cell, radius) =>
|
|
{
|
|
RenderRadius = radius;
|
|
return RenderReady;
|
|
},
|
|
isSpawnCellReady: _ => SpawnCellReady,
|
|
isTerrainNeighborhoodReady: (cell, radius) =>
|
|
{
|
|
TerrainRadius = radius;
|
|
return TerrainReady;
|
|
},
|
|
areCompositeTexturesReady: () => CompositeReady,
|
|
prepareCompositeTextures: (cell, radius) =>
|
|
{
|
|
Preparations++;
|
|
PreparedCell = cell;
|
|
PreparedRadius = radius;
|
|
},
|
|
invalidateCompositeTextures: () => Invalidations++,
|
|
isSpawnClaimUnhydratable: _ => Unhydratable);
|
|
}
|
|
|
|
[Fact]
|
|
public void Begin_InvalidatesPriorDestinationTextureReadiness()
|
|
{
|
|
var state = new State();
|
|
var barrier = state.Build();
|
|
|
|
barrier.Begin();
|
|
|
|
Assert.Equal(1, state.Invalidations);
|
|
}
|
|
|
|
[Fact]
|
|
public void OutdoorReveal_JoinsNearRenderTexturesAndTerrain()
|
|
{
|
|
const uint outdoorCell = 0x11340021u;
|
|
var state = new State();
|
|
var barrier = state.Build();
|
|
|
|
Assert.False(barrier.IsReady(outdoorCell));
|
|
Assert.Equal(WorldRevealReadinessBarrier.OutdoorNeighborhoodRadius, state.RenderRadius);
|
|
|
|
state.RenderReady = true;
|
|
barrier.Prepare(outdoorCell);
|
|
Assert.Equal(1, state.Preparations);
|
|
Assert.Equal(outdoorCell, state.PreparedCell);
|
|
Assert.Equal(WorldRevealReadinessBarrier.OutdoorNeighborhoodRadius, state.PreparedRadius);
|
|
|
|
state.CompositeReady = true;
|
|
Assert.False(barrier.IsReady(outdoorCell));
|
|
|
|
state.TerrainReady = true;
|
|
Assert.True(barrier.IsReady(outdoorCell));
|
|
Assert.Equal(WorldRevealReadinessBarrier.OutdoorNeighborhoodRadius, state.TerrainRadius);
|
|
}
|
|
|
|
[Fact]
|
|
public void IndoorReveal_UsesCenterRenderAndExactEnvCellPhysics()
|
|
{
|
|
const uint indoorCell = 0x11340100u;
|
|
var state = new State
|
|
{
|
|
RenderReady = true,
|
|
CompositeReady = true,
|
|
TerrainReady = true,
|
|
};
|
|
var barrier = state.Build();
|
|
|
|
barrier.Prepare(indoorCell);
|
|
Assert.Equal(0, state.PreparedRadius);
|
|
Assert.False(barrier.IsReady(indoorCell));
|
|
Assert.Equal(-1, state.TerrainRadius);
|
|
|
|
state.SpawnCellReady = true;
|
|
Assert.True(barrier.IsReady(indoorCell));
|
|
Assert.Equal(0, state.RenderRadius);
|
|
}
|
|
|
|
[Fact]
|
|
public void Prepare_WaitsForStaticMeshPublication()
|
|
{
|
|
var state = new State();
|
|
var barrier = state.Build();
|
|
|
|
barrier.Prepare(0x11340021u);
|
|
|
|
Assert.Equal(0, state.Preparations);
|
|
}
|
|
|
|
[Fact]
|
|
public void ImpossibleClaim_CrossesExistingLoudRecoveryPath()
|
|
{
|
|
var state = new State { Unhydratable = true };
|
|
var barrier = state.Build();
|
|
|
|
barrier.Prepare(0x113401FFu);
|
|
|
|
Assert.True(barrier.IsReady(0x113401FFu));
|
|
Assert.Equal(0, state.Preparations);
|
|
Assert.Equal(-1, state.RenderRadius);
|
|
}
|
|
}
|