Synchronized NPcs

** Hello everyone,

I’m currently working on non-humanoid NPC movement. The server creates a folder and, on every Heartbeat, updates the Position attribute to the next waypoint.

The problem is that when I read the Position attribute on the client and interpolate it, I notice that if I set my framerate to 60 FPS or 240 FPS, the NPCs are not properly synchronized with the server, which causes visual latency.

I’d like to know if it’s possible (and worthwhile) to synchronize all NPCs on the same tick, or if that’s unnecessary.

2 Likes

For a more synchronized NPC you could (instead of using a value) sending a remote event to the client with the NPC’s position and the time it was changed, then - on the client - you calculate how much the NPC has already moved since the time the position was changed and then interpolate it normally. Remember that interpolations should be done on .HeartBeat, .RenderStepped or any other RunService’s loop that gives a deltaTime which you can/should use as the alpha on :Lerp() instead of a fixed value. I hope this can help.

1 Like

Thanks for your answer I’ll try that!

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