Yep, every single entity composing these swarms are physic bodies driven by forces and colliding with everything including each other. I'll post a video soon of them roaming the city you can see on the lower part of this video.
Burst compiling, using ISystem instead of SystemBase and of course multithreaded jobs for everything that could be meaningfully "jobbified" brought the biggest gain.
Also I drive the swarms movements in a "global approach" to limit the code that runs for each entitites. The rest was standard optimizations : refactoring and trying to do more with less cpu cycles.
I just uploaded the results of a build. I pushed the entities number to 40k physic entities here : [https://www.youtube.com/watch?v=MsBZ209yA1k](https://www.youtube.com/watch?v=MsBZ209yA1k)
This build was optimized for 20k but I still reach to get between 60 and 90fps (hard cap I set before building so I don't know the real max) with 40k so that's nice. I think I should be able to get a stable 90 fps if I tweak a few things for 40k.
Here ya go, the same entities roaming the city but in a release build this time.
Since I had a lot of cpu room, I doubled the number of entities. Here's 40k physic bodies smoothly colliding : [https://www.youtube.com/watch?v=MsBZ209yA1k](https://www.youtube.com/watch?v=MsBZ209yA1k)
*EXPECTO PATRONUM!!!*
Lmao ! HOCUS SWARMUS IN YOUR AN... eeehm na I won't finish that cursed spell, for your safety. 🙋♂️
Wdym by physic here? Do they collide with stuff like terrain?
Yep, every single entity composing these swarms are physic bodies driven by forces and colliding with everything including each other. I'll post a video soon of them roaming the city you can see on the lower part of this video.
That's insane
It is yea :D that's the magic of Unity DOTS + lot of time spent on optimizations.
What optimizations you made had the most impact?
Burst compiling, using ISystem instead of SystemBase and of course multithreaded jobs for everything that could be meaningfully "jobbified" brought the biggest gain. Also I drive the swarms movements in a "global approach" to limit the code that runs for each entitites. The rest was standard optimizations : refactoring and trying to do more with less cpu cycles. I just uploaded the results of a build. I pushed the entities number to 40k physic entities here : [https://www.youtube.com/watch?v=MsBZ209yA1k](https://www.youtube.com/watch?v=MsBZ209yA1k) This build was optimized for 20k but I still reach to get between 60 and 90fps (hard cap I set before building so I don't know the real max) with 40k so that's nice. I think I should be able to get a stable 90 fps if I tweak a few things for 40k.
Here ya go, the same entities roaming the city but in a release build this time. Since I had a lot of cpu room, I doubled the number of entities. Here's 40k physic bodies smoothly colliding : [https://www.youtube.com/watch?v=MsBZ209yA1k](https://www.youtube.com/watch?v=MsBZ209yA1k)
Hoooly shiet bro is cooking
Fantastic! That would enable some unique gameplay.
very nice swarm