Object State Syncronization (Not Unity Networking Components)

Hey everyone,

I am currently developing a mmo using unity engine, i have wrote the server with the udp communication and i have wrote some client scripts to process the packets on recieve. however everything is working as expected, apart from 1 thing, wich is why im writing this.

i have spawning complete, however i am sending new location update packets every 200 miliseconds (providing the entity has moved) however on the client side wat is the best way to smoothly move the other players entities (not the controlled entity by the client)?

i have looked into using lerp and itween but both appear very jittery when it comes to actually moving the game object.

Regards

Ultimation

iTween should be a very smooth interpolation. Can you provide some more details about what you are trying to do and what is going on in your scene?

ok, basically i have a packet handler running wich will process recieved packets from the server, here is the movement function that processes the movement packet
This script is attached onto the targets Gameobject
class ObjectMovement:MonoBehaviour
{
Vector3 Destination = new Vector3(0, 0, 0);
Quaternion RotationDest = new Quaternion(0, 0, 0, 0);

public void UpdatePosition(Vector3 dest,Quaternion rotation)
{
Destination = dest;
RotationDest = rotation;
}

void Update()
{

transform.position = Vector3.Lerp(transform.position, Destination, Time.deltaTime*(float)1.0);
transform.rotation = Quaternion.Slerp(transform.rotation, RotationDest, Time.deltaTime * (float)1.0);
}
}

This code is wat i am currently using the movement is fairly smooth, but it goes slower then faster i want it to stay at a constant speed. any ideas?

Ultimation, I know you’re not using the built-in networking components, but if you look at the “NetworkInterpolatedTransform” script that comes with the Networking Example from the resources section, you can see an example of how they compensate for lag and smooth out movement by keeping a buffer of 20 previous positions. You could probably use it as inspiration and code something similar for your setup.

Thanks, will check it out!

What is unitys Network.time?

is it the tickcount of the remote machine?

I’m not really sure, but I think its just the time since a network connection was established?

i will agree with that, i will let you know how this turns out! thanks for the advice.

ok, after some research, i have no idea wat network.time actually is or how its calculated. any ideas?

Unity Networking example doesn’t work as it seems to be written in old Unity versions? Have someone got the fixed version that’s capable with Unity 3.0 onwards…?