I have a server with a NavMesh component that moves a bunch of NavMeshAgents in the scene and I want to sync their movement to connected clients. I'm expecting a huge amount of AI controlled characters, so I want a way that requires as few updates as possible.
Here's my initial approach: I separated linear velocity and angular velocity. When the velocity changes (I set up a threshold so that it only syncs when the change is significant), I send an update to clients so they update their velocity, then they calculate their new position based on the last synced velocity in their update function. I do the same thing for angular velocity and I update the character's rotation in the update function.
I was also planning to send a full sync of the character's position + rotation at a certain time interval to correct any major errors in movement.
It works okay for the linear velocity, but the rotation is not precise enough, so the character gets out of sync very quickly.
Do you have ideas on other approaches I could try? Or ways to improve my current approach?
We're not using Unity high level networking, we're building from the Unity Network Transport.