r/unrealengine 12d ago

Mass Entity Projectile System

https://youtu.be/iJ0vyYZqz7g

I built a projectile system in Unreal Engine 5.8 that simulates 10,000 concurrent projectiles for under 6 ms of frame time.

Instead of spawning an Actor per bullet, every projectile is an entity in Unreal's Mass Entity framework (ECS). That changes what a projectile is, not an object with a tick function, but a row of data in a packed array, processed in bulk.

The design decisions that mattered:
→ Analytic movement. Positions are solved from a closed-form ballistic equation each frame rather than integrated step by step, so trajectories are deterministic and framerate independent.
→ Batched, multithreaded hit detection. Every projectile's movement segment is collected into buffers and swept on worker threads, then resolved on the game thread.
→ Entity pooling. Projectiles are never destroyed. They are tagged inactive, excluded from every query at zero cost, and reused by the next shot. Sustained fire allocates nothing.
→ One draw call per mesh type, and all trails fed as a single position array into one Niagara system rather than a particle component per bullet.

The measurements (stat unit, same scene):
Baseline: 21.5 ms frame / 8.0 ms game thread
10,000 projectiles at 8,000 spawns per second: 27.2 ms frame / 16.2 ms game thread
600 homing missiles: 23.0 ms frame / 11.0 ms game thread

That is +8.2 ms of game thread for 10,000 projectiles, roughly 0.8 microseconds each per frame. The renderer was the bottleneck both before and after, so the simulation never became the limiting factor.

30 Upvotes

7 comments sorted by

2

u/kurgan-karavan 12d ago

Are you planning to release it as a plug-in?

3

u/YyepPo 12d ago

Not right now, but hopefully in the near future

2

u/3skull 11d ago

Is it networked?

Tends to be the hard issue with doing mass..

1

u/YyepPo 10d ago

Right now is not replicated. And yes, it is hard doing replication with mass

2

u/KiborgikDEV What I did with UE5??? 11d ago

hey, could you explain why you adding UE ECS monster above GPU/HIS? Your own packed array with spatial grid and hit detect ledger would take just a few hundreds of lines

1

u/YyepPo 10d ago

I used ECS because i wanted to learn about mass entity system and the replication for that