Multiplayer [2023] - Server Authoritative Movement - Netcode For GameObjects Pt 4

preview_player
Показать описание
Hey All, Back at it again!
This time we're looking at Server Side Authoritative movement for our player.

Hope you're enjoying the series so far i'm having a blast discovering everything netcode for gameobjects has to offer.
If you'd like to support me please consider hitting that subscribe button or going a step further and supporting on patreon.

The discord is also a great way to get help, meet other developers and share projects you've been working on.

I also am affiliated with NordVPN, if you're both interested in a VPN and want to help support or already have a subscription and need to renew it then please consider using my link:

The above helps a lot!
Рекомендации по теме
Комментарии
Автор

Very nice tutorial! My main issue was I was unsure about the security of using client authoritative movement but also I couldn't get ANY movement on the client side. I followed this and got it to work but the most puzzling is that when I went back to my old solution it also worked... So I am left frustrated that I do not understand what was causing the issue to begin with now... Great tutorial regardless!

HipToBeeSquare
Автор

with this code, if you were to have a host, their player moves much faster than all the clients. I understand that there might only be clients (most likely with a server authoritative setup) but I think its still causing a problem. If you move your player around as a client, it speeds up for a fraction of a second every once in a while resulting in it looking like the player is jumping around and its frequent enough to be a very bad experience.

justchuck
Автор

Hi, thanks for great tutorial.
However, I have problem with jumping using server auth movement. Host object jumps fine, but clients seems to be very heavy. Any idea why ?

kamilszechlicki
Автор

very cool tutorial! is there any way to reduce latency while leaving server autherative?)

rstql_
Автор

Great vid. One thing I might do different is at the start of Update do "if(!IsOwner) return;" this would get rid of the of the "&& IsLocalPlayer" conditions I believe.

addisonjacoby
Автор

been looking how to do this for age, thanks man👌👌

keelanaskew
Автор

Thank you for another great and easy to understand tutorial. Will you be addressing deltatime issues with clients and the server? This affects the player speed in my experimentation. Also, will you cover client-side prediction? These are the two issues that I have a hard time with.

jimsohr
Автор

I'm very new to Unity's new Netcode system. Such a simple and straight forward tutorial I had to keep looking around because I couldn't believe it was that easy to have server authoritative movement. You are a saint 🙏

nickmuffin
Автор

Hey bro and how to do it with the animations if i have like 4 different characters with jump animation inclusive ?

ararashi
Автор

Man, I really love your videos, but please consider to recording in another resolution.
the lines of code are really too tiny to read

KerryURKRAFT
Автор

You are calling serverrpc each frame, if your frame rate is 1000fps, you call 1000 rpc. Is that ok?

beyondtheuniverse
Автор

Great video! I noticed, when setting the transform position of the ServerPlayer to a spawn position above the plane in my scene, that gravity on the Rigidbody does not appear to be working. The spawned prefab floats at that location and the script moves it around in the air. Even if I add Network Rigidbody. Might it have something to do with server authoritative Update focused only on playerInput?

gc-ybfr
Автор

clean totorial, great explanation. good job man you explained this better then most videoes i have watched on this.

RetroEcoChicken
Автор

Thanks! did it this way

public void context)
{
_move =
}

public void Move(Vector2 move)
{
_move = move;
rb.velocity = new Vector2(_move.x * moveSpeed, _move.y * moveSpeed);

}

[ServerRpc(RequireOwnership = false)]
public void MoveServerRPC(Vector2 move)
{

_move = move;
Move(_move);
}

then in fixed update

if (IsServer && IsLocalPlayer)
{
Move(_move);
}
else if (IsClient && IsLocalPlayer)
{
MoveServerRPC(_move);
}

minima_studios