Entity Interpolation is jittering

Hello! I’m doing a custom replication, but the character jitters when interpolating and idk why


Interpolation.rbxl (96.7 KB)

not sure i see any interpolation here? seems like you’re just constantly setting the CFrame at around 20hz over network?

Got a recording of the jitter? That’d help us figure out what’s going on

Also can try these out first

You’re setting the model cframe to Snapshot:Get(RenderAt), so:

  • Make sure model roots are anchored, you might be getting jittering from the models falling in the physics simulation rate every frame. It’s being set every frame, sure, but if physics sim rate is higher than script fps then it’s definitely affected by gravity at least, making the rendering unstable
  • Use RenderStepped instead of PostSimulation. I’m assuming the characters are rendered without expecting any physics interactions from the rendering (client) side, so this should give you smooth(er, hopefully) rendering

^ If those don’t fix it:

  • Make sure Snapshot:Get(t) returns an interpolated value from snapshots received (for all we know, it could be rounding the time then returning the closest snapshot instead of lerping between snapshots, hence the jitter – go check)
  • Make sure Snapshots are being saved and sorted properly, check Snapshot:Push and verify it
  • Make sure you’re actually receiving the snapshots in the proper format (check serialization/deserialization)

In the snapshot module its interpolating


Here video!
Gravity set to 0
Anchored - true
Snapshots using circular buffer, so its working correctly

Are you sure the alpha value for vector.lerp is always constrained to [0, 1]?

Yep

(AfterData.Time - BeforeData.Time)``` -- This code making [0, 1]. If im add math.clamp(x, 0, 1) but its didnt change anything

Try comparing your code to existing custom replication systems like Chrono

  • How is the camera moving? It looks like camera position is independent from the character model position. The camera is moving smoothly while the character thing is jittering.
  • Try a higher interpolation buffer – I’m not sure how much you’re using, but it looks like you’re running out of frames to “render” and it catches up here and there.

Also I’m assuming this is only a debug kind of view to show how rendering from the network looks like, if this is for your own player controlled character then it’d be a very bad user experience.

Green - client
Red - server
Blue - interpolated position

Chrono using dynamic interpolation buffer and client time. I need to use server time and snapshots from server