Hi all, I'm triying to make a Boids system with the most simple approach of spawning prefabs with "physics shape sphere" and apply a World SphereOverlap every X frames.
So I created a IJobEntity executed with ScheduleParallell on a system every 5 frames or so. I save the "collisions" for further processing on many systems/jobs.
The thing is that I can only spawn about 5k entities (prefabs simple circle sprite with sphere physics shape with NO collision response). Over that 5k the system drops to 13fps and with 10k it drops to 0.3fps (more than 110ms CPU time).
Is this the expected result? With the BOIDS official example I can spawn more than 100k and no drop in performance (the fishs with animations, lights, behaviour etc...) I know the boids example don't use physics but its own spatial partitioning and Data Oriented design but I was wondering if I'm doing something wrong. Should I do my own spatial partitioning and forget about physics for so many entities?
I already have a physics step in place, with multi-threaded. I did not touch the physics settings (apart from layers interaction 1x1).
Here is the code: (for each entity create a collision world overlap sphere over the entity and save data to a buffer for the entity)
https://gist.github.com/Surt/07e41e0e02874c1ebde7c26cc22a4264
P.D. I'm writing the lookup unsafe because using Command Buffer parallell it slows down A LOT MORE and nobody is using that bufferlookup except for reading.
Also, I'm using the debugger,. Most of the cpu time is used on this jobs parallell (70ms with 10k entities), apart from the render loop for so many entities.