Repository navigation
Closed
Description
Summary
Extend Typhon's ECS with spatially coherent entity clusters, per-cluster R-Trees, and a tiered simulation system. Game code runs different systems at different frequencies for different spatial regions, enabling 10M entities within ~43% tick budget.
Design Docs
README.md— Architecture overview, key decisions, resolved questions01-spatial-clusters.md— Spatial coherence, migration, hysteresis, bulk loading02-cluster-rtree.md— Per-cluster R-Trees, broadphase/narrowphase, multi-cell query03-tier-dispatch.md— Tier metadata, system/view filtering, amortization, dormancy, budget metrics04-tick-integration.md— Tick lifecycle, migration fence, checkerboard, Morton keys, API surface05-anthill-application.md— AntHill demo usage of all features
Key Architecture Choices
- Shared grid, single cell size across all spatial archetypes (Q1)
- Transient cell state — cluster-to-cell mapping rebuilt from entity positions at startup (Q2, Q6)
- Per-archetype per-cell R-Trees with lazy allocation, static/dynamic split (Q10)
- One-tick stale spatial index accepted between movement and migration fence (Q3)
- Parallel per-cell bulk loading for 10M entity seeding (~160ms) (Q4)
- Dealloc empty clusters only — no compaction (Q5)
- Game owns tier policy — runtime provides helpers (SetCellTierMin, ResetAllTiers) (Q7)
- Checkerboard = one DAG node, two internal phases (Q8)
- Tier-filtered change detection — iterate tier clusters, check bitmap word per cluster (Q9)
Dependency Graph
#229 Spatial Clusters + Migration <-- foundation
|-- #230 Per-Cell Cluster R-Trees + Query
|-- #231 Tier System + Dispatch
| |-- #233 Cluster Dormancy
| +-- #234 Checkerboard + Budget Metrics
+-- #232 Tick Lifecycle Integration (depends on #229, #230, #231, #233)
Critical Path
#229 -> #230 + #231 (parallel) -> #232
Sub-issues
- Spatial Tiers: Spatial Clusters + Migration #229
- Spatial Tiers: Per-Cell Cluster R-Trees + Query #230
- Spatial Tiers: Tier System + Dispatch #231
- Spatial Tiers: Tick Lifecycle Integration #232
- Spatial Tiers: Cluster Dormancy #233
- Spatial Tiers: Checkerboard Dispatch + Budget Metrics #234
- Spatial Tiers: Parallel Bulk Loading (deferred from #229) #236 — Deferred: Parallel Bulk Loading. No consumer hitting the sequential-spawn bottleneck yet. Tracked as standalone backlog item.
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Priority
None yet
Activity
[-]Spatial Tiers — Multi-Resolution Simulation (Umbrella)[/-][+]Spatial Tiers — Multi-Resolution Simulation[/+]Spatial Tiers: Multi-Resolution Simulation (#228) (#237)