How can I achieve higher entity counts? #1797
-
The Question(s)As the title says, I would like higher entity counts in the 10s and 100s of thousands. What is the best way to do that in Stride? Is there a known ceiling? What should be possibleThe following videos show two scenarios where I've attempted to stress the limits of .NET and Silk.NET's OpenGL native wrapper using a very basic ECS engine of my own. I saw very high entity counts with minimal burden on the GPU (RTX 3060 - 6GB) or CPU (i9 12900 @ 2.9 GHZ) with 10-20% and 0.5% utilization respectively. However, I can't explain the relatively low framerate despite barely taxing my resources. The implementation is a somewhat naive, custom ECS pattern using .NET 7 and an approach similar to how I should note that entity counts as high as 25,000 comfortably achieved 60 FPS, I aimed the counts higher to compare performance to boid examples using Unity's ECS patterns. Those typically hit 20-30 FPS with ~100,000 entities. Orbitals - (100k entities @ ~10-20 FPS)The orbital example performs state calculations against orbital elements (not N-Body). orbits.mp4Boids - (100k entities @ ~10-20 FPS)The boids example uses an octree BST and boid separation, cohesion, and alignment calculations in a simplified N-body example. boids.mp4 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
https://www.youtube.com/watch?v=ZXA6VOcz6Y4
one of the main problems are the draw calls from the processor to the GPU |
Beta Was this translation helpful? Give feedback.
-
If it is to run locally, I suggest maybe looking into more hardcore ECS with optimized data layout, such as https://github.com/genaray/Arch. |
Beta Was this translation helpful? Give feedback.
-
You need to use instancing, there are 3 ways to do that in Stride: Also have a look at the Svelto source code examples: It does exactly what you are trying to do... |
Beta Was this translation helpful? Give feedback.
-
If GPU and CPU load is minimal then it's most likely IO pressure and since I doubt you're working the disc, it means memory based operations are at fault. This could be down to CPU operations waiting on memory to be available or GPU waiting on memory transfer between RAM and VRAM. |
Beta Was this translation helpful? Give feedback.
You need to use instancing, there are 3 ways to do that in Stride:
#741 (comment)
https://github.com/tebjan/StrideTransformationInstancing
Also have a look at the Svelto source code examples:
https://github.com/Doprez/Awesome-Stride#ecs-examples
It does exactly what you are trying to do...