feat(A.5 T5): StreamingRegion two-tier RecenterTo + TierResidence tracking
Adds TierResidence enum (None/Far/Near), _tierResidence dictionary seeded by MarkResidentFromBootstrap, and the canonical two-tier RecenterTo overload returning TwoTierDiff. Pass 1 walks the new far window and emits ToLoadFar / ToLoadNear / ToPromote; Pass 2 walks prior residents and emits ToDemote / ToUnload using Chebyshev hysteresis thresholds (NearRadius+2 / FarRadius+2). EncodeLandblockIdForTest exposes the encoding rule to test assemblies. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7bcababf82
commit
fb6b61e8ef
2 changed files with 165 additions and 1 deletions
|
|
@ -34,4 +34,23 @@ public class StreamingRegionTwoTierTests
|
|||
Assert.Empty(diff.ToDemote);
|
||||
Assert.Empty(diff.ToUnload);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RecenterTo_PlayerWalks_NullToFar_AppearsInToLoadFar()
|
||||
{
|
||||
var region = new StreamingRegion(centerX: 100, centerY: 100, nearRadius: 1, farRadius: 3);
|
||||
_ = region.ComputeFirstTickDiff();
|
||||
region.MarkResidentFromBootstrap();
|
||||
|
||||
// Walk one LB east — center (100,100) → (101,100). LB column at lbX=104
|
||||
// (relative dx=+3 from new center) enters the far window from null.
|
||||
var diff = region.RecenterTo(newCx: 101, newCy: 100);
|
||||
|
||||
foreach (var y in new[] { 97, 98, 99, 100, 101, 102, 103 })
|
||||
{
|
||||
var id = StreamingRegion.EncodeLandblockIdForTest(104, y);
|
||||
Assert.Contains(id, diff.ToLoadFar);
|
||||
}
|
||||
Assert.Empty(diff.ToLoadNear);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue