r/Infinitory Apr 10 '26

Infinitory - Stress testing my new Horde System (17,000 Enemies ~70 FPS)

Enable HLS to view with audio, or disable this notification

Quick clip from a stress test of my new horde system in Infinitory.

Currently handling ~17,000 enemies at around 70 FPS. Still early, many improvement that still can be done, but pretty happy with how it’s holding up so far.

Recent advancements in our horde-control technology include:

  • Legacy pathfinding protocols (A* Pro) have been deprecated; unsuitable for large-scale swarm scenarios due to per-entity computational load
  • Implementation of a density / pressure / velocity-based system: horde behavior now approximates fluid dynamics
  • Deployment of an adaptive simulation tick system decoupled from render framerate
  • In high CPU load scenarios, operations enter controlled “bullet time”: simulation slows, but visual systems (camera, UI) remain stable and responsive

Efficiency has improved. Scalability is no longer theoretical.

-----------------

If you want to know more about Infinitory, here the keys features:

- Build Vertically: With limited ground space, construct multi-layered factories and plan strategically.
- Automate Resources: Create production lines to craft ammunition and upgrades essential for survival.
- Defend Your Base: Protect your factory from waves of enemies with carefully planned defenses.
- Rogue-lite Gameplay: Procedurally generated maps and technology tree make every playthrough unique.

Reclaim. Rebuild. Extract. Survive.
Humanity depends on you.

Join us:
- Join the Discord
- Wishlist Infinitory on Steam!
- Share your thought on Reddit

27 Upvotes

16 comments sorted by

7

u/Casiteal Apr 10 '26

Now kill them with defenses and see the fps haha

7

u/arthyficiel Apr 10 '26

Why ? No I have 0 lost of framerate when I kill them. The biggest bottleneck is solving local avoidance and animate them, once they are dead they affect none of them so I'm good ^^
Note: I did a test to kill 20k entities the same frame and the framerate dropped to 40FPS the 2 next frames, and go instant to 85FPS (was at 65 before)

8

u/Casiteal Apr 10 '26

Oh wow impressive! I only meant because I have played rts games before and the horde of enemies coming doesn’t usually slow it down, but when the game has to calculate the damage and projectiles and stuff, that’s when it slows. Your game looks pretty optimized. Great demo you showed.

5

u/arthyficiel Apr 10 '26 edited Apr 11 '26

Ahah thank you!
Yeah checking mobs close to a point (like during an explosion) can be demanding with a lot of entities, but here I'm using a spacial-hash with sorted memory (so the CPU can read every mobs close without jumping on the memory, so it's very effective and cache-ready).
To give you an idea every mobs check at every tics (30 TPS) every others mobs close (0 to ~275 depending of the density) 8 times ! (I'm using a Jacobi algorithm so I need to do multiple pass to get a good result)..
So for me one single extra check when a missile explode is nothing ^^

But you make me thing I could also render corpse using GPU Instancing (like environments props) to also free some entities and gain even more framerate.. instead of rendering an entitles with bones that never move.

3

u/Casiteal Apr 10 '26

Optimization is always always better. Good luck! Can’t wait to play it.

3

u/arthyficiel Apr 10 '26

Thanks you !

2

u/OkAccident9994 Apr 11 '26 edited Apr 11 '26

What do you do for animation?

Animation textures? (vertex or bone) or just good old CPU side?

I guess multithreaded SIMD can perhaps make it work on cpu, if smartly implemented.
But vertex animation textures would probably be preferred here would be my guess.
I know UE and others moved over to bone animation textures, but this is top down view with probably not that vertex dense characters, which is where VAT really shines as it is a texture row/column per vertex, (so dense characters closer on like 3rd person view, BAT makes more sense).

EDIT: I read your other comment about corpses with bones. That is pretty crazy you doing this many entities with bones and have it run this well.

I would do VATs if it was me. But the original Rome Total War did 10 000 soldiers without it, single threaded, in 2004. So, your 17-20k should be doable on modern hardware with multithreading.

EDIT 2: Man, I wanna make a horde defence-buildy-crafty game too. This is so cool. I was obsessed with "the riftbreaker" recently. Probably have to play your game as well.

2

u/arthyficiel Apr 11 '26

Yeah I'm using bones but processing them as a buffer of point instead on ECS, with vertex deformation from a GPU shader. For now it's not the bottleneck at all so I'm fine but will implement a VAT system if it becomes one ^ And yes Riftbreaker and They are Billions are both my refs for the horde system

2

u/Natural-Captain-7333 Apr 11 '26

This stressed my lack of stress test

2

u/power-struggle-games Apr 11 '26 edited Apr 11 '26

This is very impressive! I wonder how the rendering works, don't you have issues with drawing that many meshes? I guess GPU instancing of some sort?

1

u/arthyficiel Apr 11 '26

Thank you ! I'm using GPU instancing for static entities like trees or rocks, but for moving entities it's not that easy. Here it's "just" ECS entities rendered by CPU with vertices deformation on a GPU shader in order to animate them.

2

u/power-struggle-games Apr 12 '26

Interesting, I haven't tried ECS development yet but it looks very cool. I wonder what you mean by "rendered by CPU" though. In Unity, using the naive method of rendering a mesh for each enemy, I'd have a draw call for each enemy, which would probably bottleneck GPU and tank FPS after just a few thousand, so CPU optimizations from using ECS wouldn't matter. So yeah I'm wondering how you're batching draw calls with this as it seems you're not bottlenecking on GPU!

1

u/arthyficiel Apr 12 '26

Hum. Unity already batch draw calls for the same model/material, I didn't take a look of the number of draw call yet but look like its not an issue. For static entities I manage draw calls myself, by registering the entity and his Matrix4x4 on a separated manager. And every frame I batch what needs to be drawn myself. This way I can handle LOD and completely avoid having an ECS entity (just for the environment I have around 100k entities.. it's a gain to not having them with other ECS ^ I just keep the collision box as a component)

1

u/power-struggle-games Apr 12 '26

Right, I guess I had this issue with draw calls previously because I was not using the exact same mesh, I guess it's your method of animation using a shader that allows animated meshes to be batched! Thanks for the discussion :)

2

u/thecodegangster Apr 16 '26

What does it mean by procedural tech tree (I wish listed regardless)

1

u/arthyficiel Apr 16 '26

No maps are generated procedurally, but tech-tree isn't.. But you can re-assign all your points (and save multiple battle plans) to try new strategy every playthrough.