How to optimize planet rotation when a large number of actors are attached to the planet actor

I’m developing a space sandbox building game and I’m running into a serious lag problem
My planet will orbit the star, and it will also spin on its axis

When I land on a star without any buildings, the game runs fine with no lags
But when I started building buildings on the planet, with only a small number of buildings, the whole game started to freeze drastically. As the number of buildings increased, it couldn’t play the game normally.

One of my buildings is an actor. After the building is generated, it will be attached to the planet so that the building and the planet remain relatively stationary.

The main cause of lag is planetary rotation. When I disable all rotations and keep the universe still, lag no longer occurs.

Is there a way to optimize game performance while retaining the planet rotation game mechanism?

I was experimenting with planet rotation at one point. The moment you start attaching actors, everything goes pear shaped :slight_smile:

What I ended up with in the end, was writing a pawn, that could actually walk around the planet. Much better.

You still have the slight problem of making the planet look right while you’re approaching it. You might want to try one of ( or combination of )

  1. Texture that makes it look like actors are placed on it

  2. HLODs?

  3. Merged meshes.

You always have that atmosphere barrier to go through, which is plenty of time to swap.

1 Like

I’d guess that the performance impact comes from updating all the transforms/physics. But you should profile to make sure.

If you haven’t already you could try to disable collisions so that these actors don’t have to update their overlaps whenever they change due to the planets rotation.

Also since everything is relative you could instead do it the other way around. Make your planet stationary and then have the camera rotate to fake the planets rotation. You’d also have to change how the star and other planets move around as well though.

1 Like

Thank you for your answer

In fact, I have been focusing on optimization during the development process and pursuing the minimum consumption

But I completely ignored the collision problem of this building! I didn’t expect the collision issue to cause such severe lag!

Due to severe lag, I have also considered the second solution you proposed, but this will make network synchronization difficult. I hope that my game can be connected by multiple people.

Fittingly, my game doesn’t need these collisions

This is the effect after I turn off collision, the frame rate can reach more than 110 frames

Thank u

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.