Performance implication for actors out of view

How much is the cost of having an actor in the game which is so far from the player that it is almost invisible? Is it better to remove such an actor and respawn it when needed?

If you have visibility culling enabled in your project (HZB occlusion culling is on by default for desktop projects), then offscreen or hidden actors will not have an impact on rendering speed, except for the check to see that they shouldn’t be rendered (which will be very low on a per-actor basis).

However, game logic will always run on your Actor. If you have many Actors in your game world that have a Tick node being used in its Blueprint (or if it’s a C++ Actor and has ticking enabled), then your game still has to run the code to make it tick. Depending on what you’re doing, perhaps a few hundred ticking Actors will not be a problem. But your game will probably start to slow down if you have a few thousand, or if your Actors are doing a lot of work inside of their Tick function. If your Actors don’t tick and aren’t moving around, they have very little cost, and you can have thousands of them no problem.

If you are building your levels by hand, and they have lots of computationally expensive actors (such as a game where you wander around a large dungeon and encounter enemies who are roaming around), you will want to figure out an approach that works for your game. For example, you can use trigger volumes to deactivate the enemies you’ve placed into the level when the players aren’t near them.

If your are making a networked game, you’ll also want to reduce the amount of bandwidth between the clients and server for any Actors that are replicated over the network. There are options within the Actor replication properties panel that let you make Actors stop being replicated to clients if they are some distance away from them.

Thanks for detailed explanation :slight_smile: