#Jitter in movement - first person perspective game in NGO

1 messages · Page 1 of 1 (latest)

nocturne cape
#

Hi, I want to create a game using NGO 2.8.0 in Unity 6.3. I'm trying to wrap my head around implementing a first-person controller. I assumed that:

In my game, players will be moving around tight levels, which is why I want to use CharacterController for collision handling. A host-authoritative approach seemed the most intuitive to me, mostly because a lot of gameplay logic will rely on players' positions. For example, if players are hiding from AI enemies, it seems easiest to rely on host-side raycasting to determine whether a player is visible to enemies.

Currently, in a build, playing as host is perfectly smooth. However, as a client, I’m experiencing rubber-banding. The jitter is especially visible while looking around.

What am I doing wrong here? Are my assumptions correct?

#

I attached the player prefab setup, code, and a video from the editor, where I simulate network conditions using NetworkSimulator (the same behavior can be observed in a build).

strong gorge
#

the camera probably shouldn't be a network object. there is no reason to sync camera transforms over the network.
You would need to disable the character controller on the remote player objects. Character controller will override the transform

nocturne cape
#

Thanks for the fast reply!

#

Regarding the character controller, did you mean characterController.enabled = IsOwner;? When i add this to my code, clients won't move at all from host perspective

nocturne cape
#

Also there will be a lot of errors CharacterController.Move called on inactive controller, because I call it every frame from server for non owned players

strong gorge
nocturne cape
#

great, that seems to have fixed the teleportation issue!

#

i no longer reparent it to player and now this is how my camera script looks like:

private void LateUpdate()
{
    if (_anticipatedTransform != null)
    {
        transform.position = _anticipatedTransform.transform.position + OFFSET;
        transform.rotation = Quaternion.Euler(0f, _anticipatedTransform.transform.eulerAngles.y, 0f);
    }
}

should it be smooth already?

strong gorge
#

Anticipated transform is a bit tricky. It does a rollback so you have to re-simulate to where it is locally

nocturne cape
#

i'm not sure if i understand. i thought the anticipated state is the local one from client perspective. if not, how should i resimulate?

strong gorge
# nocturne cape i'm not sure if i understand. i thought the anticipated state is the local one f...

Anticipated states can be updated locally but it will always roll back when the server sends an update. You need to keep track of the input that are sending to the server. When the transform rolls back you need to replay those inputs to get back current.

Check out how the sample does it
https://github.com/Unity-Technologies/com.unity.multiplayer.samples.bitesize/tree/main/Experimental/Anticipation Sample

GitHub

A collection of smaller Bitesize samples to educate in isolation features of Netcode for GameObjects and related technologies. - Unity-Technologies/com.unity.multiplayer.samples.bitesize

nocturne cape
#

wow, it seems to be exactly what i need Responsive server-authoritative player movement

#

i will need a bit more time to get through it and implement whats needed

#

just didn't think that my case would be that complicated, i expected out-of-the box 5min solution

#

thanks a lot for all the help, i will try using that tomorrow

nocturne cape
#

Hi, I gave up on the server-auth approach for now. I started exploring the client-driven approach thinking that it might be easier. I launched the official ClientDriven sample and I've noticed pretty bad rubberbanding when simulating standard network conditions

I am attaching the network conditions I'm simulating and the video showing client movement from host perspective. It's pretty easy to notice the small teleportations and stops despite the client was moving all the time. Shouldn't it be smooth and interpolated from host perspective?

#

does this setup for client network transform look right? I did not change anything, these are the values from github

strong gorge
nocturne cape
#

hi, thanks for sending over another sample!

#

however, the movement looks nearly the same as in the previous sample

#

i used the same connection preset as previously

#

should i expect smooth movement in this case?

strong gorge
nocturne cape
#

no, i am not using relay yet. that's just plain unity transport, straight from the sample. i am launching 2 games using multiplayer playmode

#

the playmode scenario is pretty simple as well

strong gorge
nocturne cape
#

i can send project files here if it helps. however my only change from the sample is adding the network simulator

strong gorge
#

Might be an issue with the network simulator. I don't see rubberbanding when using the template through Relay

#

Also what version of NGO are you on? The network animator was recently updated. You would need to the authority mode on it as well

nocturne cape
#

this package uses NGO 2.7.0

#

however when you're testing through relay, are you really testing real world scenario? i mean, you're still connecting your pc to your pc, right?