feat: weight vertical distance in chunk-load priority

Adds Configuration.VerticalPriorityWeight (default 4). The priority
formula in ChunkStreamer.RecomputeTargetSet now uses
dx^2 + dz^2 + dy^2 * VerticalPriorityWeight, so horizontal chunks at
the player's Y are dispatched before equally-distant chunks above or
below. Fixes janky loading where deep-underground chunks were
competing with surface chunks for early dispatch slots.
This commit is contained in:
2026-06-01 13:41:55 +02:00
parent 4fe552b8bd
commit 2c95c7831a
3 changed files with 40 additions and 3 deletions

View File

@@ -122,9 +122,12 @@ public sealed class ChunkStreamer : IDisposable
if (this._failed.Contains(pos)) continue;
if (this._tracked.Add(pos))
{
int priority = (pos.X - p.X) * (pos.X - p.X)
+ (pos.Y - p.Y) * (pos.Y - p.Y)
+ (pos.Z - p.Z) * (pos.Z - p.Z);
int dx = pos.X - p.X;
int dy = pos.Y - p.Y;
int dz = pos.Z - p.Z;
int priority = dx * dx
+ dz * dz
+ dy * dy * this._cfg.VerticalPriorityWeight;
this._pendingLoad.Enqueue(pos, priority);
}
}