From 90a2027d1437112f8cc8691caff154d19f997f7d Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 9 May 2026 22:20:48 +0200 Subject: [PATCH] feat(A.5 T2): TwoTierDiff record + LandblockStreamJob.Load.Kind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds TwoTierDiff — the five-list output of StreamingRegion.RecenterTo (ToLoadFar/Near, ToPromote, ToDemote, ToUnload) per spec §4.2. Used by T3–T6 (StreamingRegion) and T13 (StreamingController). Extends LandblockStreamJob.Load with a LandblockStreamJobKind parameter so the streaming worker can route far vs near vs promote jobs differently (spec §4.3). Patches the one call site in LandblockStreamer.EnqueueLoad with LoadNear as a placeholder that preserves today's full-load semantics until T11 activates the worker thread and T16 routes by tier. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/AcDream.App/Streaming/LandblockStreamJob.cs | 2 +- src/AcDream.App/Streaming/LandblockStreamer.cs | 2 +- src/AcDream.App/Streaming/TwoTierDiff.cs | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/AcDream.App/Streaming/TwoTierDiff.cs diff --git a/src/AcDream.App/Streaming/LandblockStreamJob.cs b/src/AcDream.App/Streaming/LandblockStreamJob.cs index aff6500..e5b9602 100644 --- a/src/AcDream.App/Streaming/LandblockStreamJob.cs +++ b/src/AcDream.App/Streaming/LandblockStreamJob.cs @@ -10,7 +10,7 @@ namespace AcDream.App.Streaming; /// public abstract record LandblockStreamJob(uint LandblockId) { - public sealed record Load(uint LandblockId) : LandblockStreamJob(LandblockId); + public sealed record Load(uint LandblockId, LandblockStreamJobKind Kind) : LandblockStreamJob(LandblockId); public sealed record Unload(uint LandblockId) : LandblockStreamJob(LandblockId); } diff --git a/src/AcDream.App/Streaming/LandblockStreamer.cs b/src/AcDream.App/Streaming/LandblockStreamer.cs index fff7fc6..a325fb6 100644 --- a/src/AcDream.App/Streaming/LandblockStreamer.cs +++ b/src/AcDream.App/Streaming/LandblockStreamer.cs @@ -88,7 +88,7 @@ public sealed class LandblockStreamer : IDisposable // Synchronous mode: invoke the load delegate inline. The result lands // in the outbox and DrainCompletions picks it up later in the same // (or next) frame. - HandleJob(new LandblockStreamJob.Load(landblockId)); + HandleJob(new LandblockStreamJob.Load(landblockId, LandblockStreamJobKind.LoadNear)); } public void EnqueueUnload(uint landblockId) diff --git a/src/AcDream.App/Streaming/TwoTierDiff.cs b/src/AcDream.App/Streaming/TwoTierDiff.cs new file mode 100644 index 0000000..2a24dab --- /dev/null +++ b/src/AcDream.App/Streaming/TwoTierDiff.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace AcDream.App.Streaming; + +/// +/// Output of for the two-tier model. +/// Five disjoint lists describe what changed since the previous Tick. Per +/// Phase A.5 spec §4.2. +/// +public readonly record struct TwoTierDiff( + IReadOnlyList ToLoadFar, // entered far window from null (terrain only) + IReadOnlyList ToLoadNear, // entered near window from null (terrain + entities — first-tick or teleport) + IReadOnlyList ToPromote, // entered near window from far-resident (entities only) + IReadOnlyList ToDemote, // exited near window past hysteresis (drop entities) + IReadOnlyList ToUnload); // exited far window past hysteresis (drop terrain)