Client VS Server Authority Humanoids. Weird Performance Results

I’m making a big RPG, in which there are gonna be some NPCs, that need to patrol, attack player, etc.

So I decided to do some performance testing with extreme case (1000 Humanoids moving simultaneously) to determine what’s better, Client or Server Authority.
The results shocked and confused me.

All the zombies are created on the server initially, I tried 2 different options. In both cases this same basic script used.

while task.wait() do
    for i,v in pairs(NPCs) do
        v.Humanoid:MoveTo(v.TargetPos.Value)
    end
    task.wait(5)
     for i,v in pairs(NPCs) do
        v.Humanoid:MoveTo(v.StartPos.Value)
    end
    task.wait(5)
end

Option 1 - Server Authority
So as I said, all the zombies are initially created on the server. Firstly I put the above code into a server script, so that everything is Server sided. Here’s what happened:

As you can see, ping was mostly around 200 the whole time.

Option 2 - Client Authority
As before, zombies are initially created on the server.
But in this case, I first transfer all of their authority to clients using RootPart:SetNetworkOwner(Player), and then do the same code I mentioned at the start, but this time in a Local Script.

As you can see, ping most of the time was above 300.

The Main Question

Why do client controlled Humanoids lag more, and does this mean that it’s better to do everything in a server script?

P.S. Note, that CREATING zombies on the client too is not an option, because I want them to be replicated to other players too. If I create them on the server, but transfer NetworkOwner and do everything on the client (as I did above), everything replicates easily.

Perhaps you have an laggy client yourself.

What you need to remember here is that now instead of the server processing everything, your client is now processing the movements of every single zombie on top of the things it already controls on your client.

It probably has to do with the Server being the owner of the called function, thus not really increasing your ping, but the server has worse results is it is handling badly coded Humanoids (core). Then, when the Client is processing the movement, it has a higher ping since it needs to process the Humanoids, but has better visual results since, well, it’s based on the user’s internet connection.

Obviously the same client was used in both cases, it doesn’t answer the question why the same client lags more when it itself controls the humanoids, as opposed to when Server does it.

And mainly, it doesn’t answer the question what’s better to use in the actual game, Server or Client Authority.

you were getting 200 ping because your network recieve was getting throttled, messages had to be delayed on the recieving end

however usually most routers have way less upload speed than download speed (my download speed is 150 mbps while my upload is 45 mbps)

the throttle for download is less than the throttle for upload (its faster to download data than upload it)

So for someone like me, who doesn’t know what throttle is and didn’t really understand what you said.

What should I use in the actual game, if I want to get max performance, but still want everything NPCs do to be replicated to all clients.

basically throttle just means, you can upload less data than you can download

to get max performance have the humanoids controlled by the server. if you wanted clients to have control then you would need to also pass the entire AI to be calculated by the client too

1 Like