Download

Event Dispatcher performance with 1000's of listeners

Have a coding architecture challenge.
I have several thousand instanced static mesh characters whose ‘state’ I need to change at runtime.

I was thinking that EventDispatcher makes the most sense because of the 1 to many relationship. However my understanding is that ‘bind’ comes at a slight cost since it happens every tick.
If you have 1000’s of actors all binding to the same event will there be a siginficant performance penalty?
And if so, what is the best alternative?

You bind it only once. Not on Tick. Looping on Tick in BPs is a performance killer.


Not sure what the initial cost is (is it even measurable?) but once it’s done, it’s done. Whenever any of those Pawns get destroyed, the LB will be notified. If you get a 1000 calls in a single frame, you’ll notice, though, ofc.

You typically have to figure out and update the most relevant actors first and then subsequently update the others who are far away over the course of a few frames. Depending on how many actors you have, you’ll have to create more conditions for when they update.

For instance, if the player can’t see them do they need to update? or is it only when the player sees them that this update becomes relevant?