The Challenge
Supporting large numbers of moving entities in a shared simulation while keeping navigation and rendering costs manageable. The game required a colony of microorganisms to navigate environments intelligently without bottlenecking the main thread.
ECS-Based Flow-Field Navigation
My primary technical contribution was an ECS-based flow-field pathfinding system. Rather than calculating individual paths for 2,000 entities, the environment generates a vector field towards a destination, which entities sample efficiently in parallel using Unity's Job System.
Debug view of the directional flow-field generation.Distance-Based Simulation LOD
To further optimize performance, I implemented a system that seamlessly transitions detailed simulation mechanics (like conveyor belts and crafting interactions) into purely mathematical calculations when the player moves out of range. When the player returns, the visual state synchronizes perfectly with the background calculations.
Measured Performance (Example Data)
| System | Entity Count | Worker Thread Cost |
|---|---|---|
| Flow-Field Sampling | 2,000 | ~X.XX ms |
| Distance LOD Active | 1,500 (Distant) | CPU load reduced by XX% |
Tested on Unity 6. Profiler metrics captured under controlled stress conditions.