A seamless infinite universe simulation built with Unity ECS.
- Every galaxy you see can be reached
- No boundaries, infinite exploration
- Average 50K+ particles in the universe
Built with Unity ECS for seamless performance. Entities are just IDs that hold Components (data). Systems process matching entities in parallel - they read components, do the work, and write results back.
flowchart TB
E1["GalaxyCore Entity"]
E2["GalaxyGas Entity"]
E3["StarParticle Entity"]
E4["CameraTracking Entity<br/>(Singleton)"]
E5["UniverseSettings Entity<br/>(Singleton)"]
subgraph A1["GalaxyCore Archetype"]
AC1[GalaxyCoreComponent]
AC2[GalaxyRenderComponent]
AC3[GalaxyLODComponent]
AC4[LocalTransform]
end
subgraph A2["GalaxyGas Archetype"]
AG1[GalaxyGasComponent]
AG2[LocalTransform]
end
subgraph A3["StarParticle Archetype"]
AP1[StarParticleComponent]
AP2[StarParticleRenderComponent]
AP3[StarParticleColorComponent]
AP4[LocalTransform]
end
subgraph A4["CameraTracking Archetype"]
AS1[CameraTrackingComponent]
end
subgraph A5["UniverseSettings Archetype"]
AU1[UniverseSettingsComponent]
end
E1 --- A1
E2 --- A2
E3 --- A3
E4 --- A4
E5 --- A5
style E1 fill:#0d1117,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9
style E2 fill:#0d1117,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9
style E3 fill:#0d1117,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9
style E4 fill:#1c2128,stroke:#3fb950,stroke-width:2px,color:#c9d1d9
style E5 fill:#1c2128,stroke:#3fb950,stroke-width:2px,color:#c9d1d9
style A1 fill:#161b22,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9
style A2 fill:#161b22,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9
style A3 fill:#161b22,stroke:#58a6ff,stroke-width:2px,color:#c9d1d9
style A4 fill:#161b22,stroke:#3fb950,stroke-width:2px,color:#c9d1d9
style A5 fill:#161b22,stroke:#3fb950,stroke-width:2px,color:#c9d1d9
flowchart TB
subgraph Systems["⚙️ SYSTEMS"]
direction TB
S1[CameraTrackingSystem<br/>Synchronize camera position to CameraTrackingComponent]
S2[GalaxySpawnSystem<br/>Dynamically spawn/despawn galaxies based on distance]
S3[GalaxyLODSystem<br/>Calculate LOD levels based on distance to camera]
S4[StarParticleManagementSystem<br/>Spawn/despawn star particles based on LOD]
S5[GalaxyCoreMovementSystem<br/>Update galaxy core position using velocity]
S6[GalaxyGasMovementSystem<br/>Update gas position following galaxy core]
S7[StarParticleMovementSystem<br/>Update star particle orbital positions]
S8[StarParticleRenderSystem<br/>Update render properties: twinkle, fade-in, scale]
end
S1 --> S2
S1 --> S3
S3 --> S4
S5 --> S6
S5 --> S7
S7 --> S8
style Systems fill:#161b22,stroke:#a371f7,stroke-width:2px,color:#c9d1d9
- 5-level LOD based on distance from camera
- Particles dynamically spawn/despawn as LOD changes
- Limits operations per frame, spreads work across multiple frames
- Prioritizes closer galaxies for smoother transitions
- Only galaxies within spawn radius are active
- Uses 3D grid cells for efficient spatial management
- Cache frequently queried data to avoid redundant lookups
- Movement and rendering updates run as parallel jobs
- Minimize runtime component addition/removal
- Prefer
SetComponentoverAddComponent
- Custom ECS-compatible shader
- Renders thousands of particles in a single draw call


