More Efficient World Offset Shifting?


Currently, the Level initiates a world offset shift by going through every actor and notifying it of the shift. I was thinking it would be a bit more efficient if the Level set a bool which indicated a shift (along with the shift data) and then the actors were notified from within a more fundamental loop through the actor list – perhaps before Tick() is called. And, obviously, the bool would be reset after the list had been iterated.

I think that might provide a performance gain since you’re not going through the list of actors an extra time. On the other side you’d be checking that bool every tick but I think that would cost less than going through every actor – at least, given a healthy number of actors.

Just a thought.

Actually it would need to be a tad more complicated because while you’re iterating the actors, the ones you’ve processed are updated to the new origin but the ones you haven’t aren’t. So you’d need two (global) origins and a flag in each actor that indicated if it had been switched over or not. Maybe it’s not so much more efficient this way but it might be worth investigating. It just sucks if there’s a hiccup from the changeover. There has to be a better way.