Comment by senfiaj

11 days ago

Could use quad trees, or similar bucketing. But I think he already stated that he tried to avoid the processing of long distance pairs. So probably he does some localized bucketing. Personally, I don't even fully understand what his simulation is doing. There are tradeoffs between accuracy / performance, depending on the specific problem. So hard to judge here.

Thanks for the feedback. There are some O(n²) components (mate finding, pathogen spread, proximity), but they’re mitigated with zone-based spatial hashing and throttling, so it’s not naive all-vs-all.

One big recent win was actually on the rendering side: I was rebuilding complex morphology geometry every frame for large organisms. I’ve added caching for that, which significantly reduced spikes during population blooms.

At very high populations the sim tick itself becomes the bottleneck, even for mostly O(n) logic per organism. When populations crash (which they usually do ecologically), performance recovers.

Quad trees / more adaptive structures are on my radar, but I’m trying to balance complexity vs predictability for now.