Child actor components and the cost of UpdateTransform

Hi all,
I’m working on a space combat sim with somewhat large spaceships.
The development is going well (considering I’m a beginner) and the game so far works exactly in the way I want :slight_smile:
However, I am concerned by the fact that I might be spending far too much CPU for topics which could be strongly optimized.

I’d like to ask for advice and help in optimizing the ship subsystems.
These subsystems are all important systems of the ship: engines, turrets, sensors etc. I have them as Child Actor Components inside my ship blueprint.
They contain their own functionalities, completely run by events, with ALL ticks disabled. What needs to tick is setup with timers on Custom Events (e.g. every 1s).
The subsystems are also able to take damage and get disabled.
They have no meshes, just the SceneRoot. They have no collision.
They also use the “Use parent attach bound” option, which I read somewhere it’s a good optimization in this case. It seemed to me that this helped, but not really enough.

When I run the typical Stat Runfile and analyze it in the Session Frontend, I see that there is a very high cost to update the Transform of these Child Actors.
This is perfectly affordable up until <5-8 ships, but makes the game somewhat slowdown below 60FPS if they become >10.

How can I optimize this kind of ship subsystems?
Should I remake them into Components? Would that actually be an optimization?
Are there other ways to implement such subsystems into a ship?
Any suggestion? :slight_smile:

Thanks a lot for any help or suggestion on this topic! :slight_smile:

On just updating rotations of stuff like turrets?

Nope, I have zero meshes in the subsystems and the “turrets” don’t actually rotate.
I just made them as an Actor with no mesh and it doesn’t even rotate.
It has a direction and checks if the enemy is within a certain firing arc. If so, spawns the projectile.
Nothing else, very minimalistic :slight_smile:

The cost is literally due to the fact that these components need to be updated in their position, because the ship is moving and they need to follow her in the movement.
For a few ships this is very low cost, but for many ships it becomes too much for the CPU :frowning:

Could you share how you are referencing and updating?

Just to be clear: I might not be able to find you a solution, but really interested in exploring your problem and perhaps 2 heads might be better than one. :innocent:

Sure :wink:
It’s very simple and basic, really.
I just have the ship, and it has the StaticMesh “Hull” as root. It has Physics simulation enabled.
It has a few SceneComponents. One of them is called “SubsystemsScene” and its children are the Child Actor Components which are the Subsystems.
I took care to put these Child Actor Components in the right spots of the “Hull”: the turrets are one in front, two on the sides etc
The Engine Subsystems are where the engines are in the “Hull” Static Mesh and so on.

Very basic really. The consumption of the CPU comes from the physics engine, which is updating the Transform of these Child Actors on the Hull when it moves.
And it moves all the time, of course. Plus all the other ships move all the time, meaning that the CPU has lots of Child Actors to update continuously every frame.

What I’m really wondering is: can I have the engine consume less CPU time when updating the position of all these Child Actors?
Is this the only way to implement these Subsystems? Or could I use something else which consumes less CPU time? :slight_smile:

I would assume the amount of attached actors to sockets shouldn’t make physics more demanding, since these attached actors have physics disabled and still follow.

Hi, I would have hoped so.
It seems however that the engine really struggles when updating child components, and it seems to be really just in updating their location.
I might have just too many components, unfortunately.

However, this is precisely why I’d like some help :slight_smile:
How could I optimize the subsystems of a spaceship in a way where I can use less components in my blueprint? :slight_smile: