Understanding the Static Optimization Mode

Hi there!

I have a question about using the Ghost Static Optimization mode in Unity DOTS. Specifically, I’m wondering if it’s appropriate to use this mode for destructible objects such as trees and walls.

I’m also curious about how the static optimization mode works. As far as I understand, the ghosts are completely removed from snapshots if they don’t change. But if ghosts don’t have a specific message for creation/destruction, how will client connections see the static entities if they never change and are never synchronized?

Thanks for any insights you can provide!

Hey Opeth,

It is appropriate to use static optimize if your ghost has long periods of zero change (with regards to GhostFields). If even one GhostField changes every frame, it isn’t appropriate to use, unless you can use dead reckoning to infer that change (e.g. the asteroids in the NetcodeSamples flying at a fixed velocity).

You are right that static optimize attempts to remove the ghost from most snapshots. However, the ghost will be added to the snapshot every time it changes (using importantance and relevancy rules). We use snapshot acking to resend until success.

Also note: Being created or destroyed are two such changes, and are therefore replicated. If you have a static ghost which is not replicated after some change, it’s likely a bug.

This mechanism works on a per client basis, meaning a late joining player will be sent every existing static ghost too. I.e. we handle all cases, including entering and exiting relevancy.

1 Like

Hey NikiWalker,

Thank you for your answer! I have one more question though :slight_smile:

Have you considered implementing a feature that would allow for switching between Static and Dynamic ghosts, similar to how you have implemented prediction and interpolation? This would be particularly useful for games like VRising, where there may be hundreds or even thousands of monsters that remain static until a player interacts with them by getting too close or attacking them.

Thank you again for your time!

Not as far as I am aware, but it’s an interesting idea. Note: While static optimize is less efficient than dynamic (in the cases where the monster in your example becomes active), it should still be fairly good, especially if said monsters are short lived (i.e. only active for ~1m in a 1+hr session).

We’re always interested in repro projects and specific profiler observations though, so do let us know if you’re seeing a substantial difference. We have some other bandwidth optimization ideas that are likely worth exploring too.

1 Like