Physics performance with many actors and overlaps.

Hi everyone!!

I’m working on a physics-based conveyor system in Unreal Engine, and I’m running into performance bottlenecks. I want to share my setup and experiments to see if anyone has ideas for improvement.

Setup details:

  • Each item is a Blueprint, and each conveyor is also a Blueprint.

  • Conveyors have an Overlap Box that detects when an item enters.

  • On BeginOverlap, the item’s Primitive Component is stored in an array; on EndOverlap, it’s removed.

  • Every 0.05 seconds, a function loops through the array and applies Add Linear Force to each primitive. I’ve also tried Add Impulse and Add Force, but performance is similar or worse.

Things I’ve tried to optimize:

  • Using an Event Timer (0.05s) and then Tick to avoid creating many parallel functions. The timer stops when the array length is 0, though for my tests this doesn’t happen because many conveyors and items are constantly moving.

  • Async Tick in UE5.4+ for physics.

  • Having a BP manager that holds a single array of all items in the scene, so only one function/tick iterates over thousands of items instead of each conveyor having its own function/tick.

Performance observations:

  • Around 2k items seems to be my bottleneck.

  • In UE 4.27, most of the time is spent in GPU and Game Thread.

  • In UE 5.4+, looking in more detail, Overlaps seem to be the main cost.

  • I used to have draw call issues, but those are already solved.

  • I’ve tested UE 5.4 – 5.7 and 4.27; results are consistent with 2k actors dropping FPS to ~30.

Other optimization settings:

  • Physics-simulated actors have shadows off.

  • Overlaps are only enabled for a custom Object Type, everything else ignored.

  • Items and conveyors use simple block collision.

Questions:

  1. Is there a better way to move items with physics on conveyors more efficiently?

  2. Can 10k actors at 30 FPS+ realistically be achieved in Unreal using physics?

  3. Any advice on using Unreal Insights effectively to find the bottlenecks?

Last test I made was in 4.27.2 since ppl say performance with physicx its better, didnt find it much better, probably even worst since I had to disable A LOT of stuff to make it comparable to 5.4+, created a zip with a dev package in case you wanna check it: Unique Download Link | WeTransfer

Thanks in advance for any advice!

Hey there @Tristefino! Welcome back to the community! The short answer is that 10k physics actors all calculating even simple physical collisions at once is an extremely tall order. It’s usually recommended to try and fake as much of that as possible or to use a data oriented system like MASS to be able to handle these entities.

If you absolutely must have them be actors, then disabling physics on them whenever they aren’t in a tight scope would be imperative. Depending on exactly how much scope (for example a first person factory game would have relatively small physics scope, but something top down or big picture like Factorio would have a relatively wide one) you could create a system to fake physics on anything outside of the player’s immediate view, and only enable physics simulation when an event triggers it or the player moves in scope, much like a “physics LOD” system.

However my true recommendation would be to use MASS entity, a data oriented ECS style system to handle hundreds of thousands of entities with basic movements. It’s complex, but is purpose built for handling this many entities easily. MASS itself doesn’t have much documentation in the way of physics, but this community project has a functioning physics setup if you’d like to examine it.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.