refactor nav coverage into clustered windows

Replace region-based runtime pathing with interest-cluster coverage windows so active nav areas stay contiguous and spawn anchors participate in initial coverage.
This commit is contained in:
Alexander Borisov
2026-04-08 13:52:00 +03:00
parent 7282621211
commit 0b380def78
11 changed files with 680 additions and 219 deletions
@@ -17,6 +17,12 @@ namespace InfiniteWorld.VoxelWorld.Contracts
void GetInterestPoints(List<WorldInterestPoint> results);
}
public interface INavCoverageReader
{
bool IsPositionCovered(Vector3 worldPosition);
void GetCoverageWindows(List<NavCoverageWindowSnapshot> results);
}
public readonly struct ChunkNavSourceSnapshot
{
public ChunkNavSourceSnapshot(Vector2Int coord, int version, ChunkNavBuildSourceDescriptor[] sources)
@@ -77,7 +83,31 @@ namespace InfiniteWorld.VoxelWorld.Contracts
{
PlayerActor = 0,
ActiveNpc = 1,
Other = 2
SpawnAnchor = 2,
Other = 3
}
public readonly struct NavCoverageWindowSnapshot
{
public NavCoverageWindowSnapshot(int id, Bounds bounds, NavCoverageState state, int interestCount)
{
Id = id;
Bounds = bounds;
State = state;
InterestCount = interestCount;
}
public int Id { get; }
public Bounds Bounds { get; }
public NavCoverageState State { get; }
public int InterestCount { get; }
}
public enum NavCoverageState
{
Pending = 0,
Building = 1,
Ready = 2
}
public readonly struct ChunkNavGeometryReadyMessage
@@ -83,8 +83,12 @@ MonoBehaviour:
worldGenerator: {fileID: 2927522923773808063}
config:
agentTypeId: 0
navRegionSizeInChunks: 2
maxNavMeshBuildsPerFrame: 1
navBoundsHorizontalPadding: 1
navBoundsVerticalPadding: 2
navWarmupRadiusInRegions: 1
maxActiveCoverageWindows: 3
clusterMergeDistanceInChunks: 4
coveragePaddingInChunks: 2
coverageQuantizationInChunks: 1
minCoverageWindowSizeInChunks: 4
chunkCollectionMarginInChunks: 1
@@ -255,6 +255,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 171707223}
- component: {fileID: 171707224}
m_Layer: 0
m_Name: SpawnPoint
m_TagString: Untagged
@@ -277,6 +278,19 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &171707224
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 171707222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a0a7758ae4541b39ed0b5d1fe912869, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::VoxelWorldScene.VoxelWorldSpawnAnchor
priority: 2
--- !u!1001 &1165873058
PrefabInstance:
m_ObjectHideFlags: 0