Ghost components interpolation on predicted entities

I want my game to have client-side prediction work for the character controller, and health and other stats just sync to the server without predictions. Megacity Metro does the same thing, and I have a question about it. Will interpolation for components work if the Ghost type is Predicted?

Hey ooonush,

This is possible, with two options: Imagine you have some systems affecting the character controller, and other systems affecting health.

  1. If you want all of your systems inside the PredictedSimulationSystemGroup (to more easily reason about them), simply mark-up the server only health & stat systems as server-only (via [WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation)]).
  2. Alternatively, you can simply place them outside the prediction loop, while keeping the character controller systems inside the prediction loop.

Not identically, but broadly yes. IIRC, all components on a predicted ghost which are not being predicted by the client will simply Clamp to the latest values returned by the latest snapshot containing this ghost. Thus, it’s similar to if you have the Health.CurrentValue field set to [GhostField(Smoothing = SmoothingAction.Clamp)]. I believe the only caveat for predicted ghosts here is that this value change does not wait for ClientTickRate.InterpolationTimeMS i.e. NetworkTime.InterpolationTick.

Got it, too bad you can’t use both interpolation and prediction in one Ghost. Thanks for your answer :grin:.

1 Like