What is Replication Latency and how do you measure it and what are the side-effects? NetworkReplicator

What is Replication Latency?

That’s the question that I am asking in this thread. Obviously as the name already implies, it has to do something with Replication and that apparently it can lag.

I will mention some information that I discovered.

Where did you even hear about it?

Very Good! Lemme answer that.

Summary

The answer is in the Laser Finger Pointers Gear.

To import it in Studio, simply copy paste this:

game:GetObjects("rbxassetid://115377964")[1].Parent = game.Workspace

and you will have this thing in your Workspace
image

Then go to the Server Script at Line 46.

There is the term Replication Latency.

It makes sense, nothing is magic!

Let’s think about the Roblox Engine. The Client is the Client, it is not the Server. If the Server changes the Color property of a BasePart, IT HAS TO send that information to the Client somehow.

And this seems to be done through this mythical thing called Replication.

The problem is…

  • Can we see the exact steps it goes through to do Replication?
    • If so, how?
    • How precise it the information?
  • Can we control it? (Probably not, or not yet)

Suspicious Services

There’s NetworkClient and NetworkServer, which create ClientReplicator and ServerReplicator. These are locked properties. I assume that those are relatable to the Replication, in some way or another.

NetworkReplicator

https://robloxapi.github.io/ref/class/NetworkReplicator.html

Has a bunch of protected methods. Not a problem for testing.

This is one of the information Replicator has, that it sends through Roblox Signals.
image
This information, but it’s not telling a lot.

:SetOutgoingKBPSLimit()

This function seems to limit how many KB/s can go through.

THIS FUNCTION demonstrates the purpose of Network Ownership.

I set it to 1, my character was able to move around very nicely. However, when I used the lasers they were really laggy.

The Network Ownership things you own, are the physics you control. But the Client can’t modify the Properties.

Seen that, you could completly screw over the entire Replication System and just utilize RemoteEvents. Problem is you’d have to create every Part on the Client and make the Server purely hold the data. I don’t think it’s worth it, unless one wants to go crazy. It’s still questionable what is more efficient in Roblox’s Networking. Whether it’s RemoteEvent or the default Replication.

So I did the opposite. I changed the SetOutgoingKBPSLimit to 1 for the Client, and the one for the Server back to normal.

My character still moves nicely on my end, but not on the server’s. When I use the Laser, the server still tries to replicate it nicely, however, there’s now a problem. My Mouse is delayed, because that’s information from the Client.

It’s possible that it’s delayed due to how the Laser Pointer Script works. However RemoteEvents don’t seem to be affected?

Well they are affected.

local idk = {} for i=1,1000 do table.insert(idk, "e") end

print("Sending")

game.ReplicatedStorage.RemoteEvent:FireServer(idk)

This should be obvious, but this meaning is now super-amplified. The amount of KB you send through RemoteEvents does affect Network, but depends on how the Network is setup on the game, but that’s defined by Roblox.

You don’t have to exaggerate. I’ve manipulated my Outgoing KB for the sake of figuring out what the outcome would be.

I then tried to see if I can see where this information is at…

Note that this need to be running inside of an actual Script, otherwise the profiler won’t tag the area. Or maybe I did it wrong, because I tried doing something from the console before and it showed up, it was just a bit hard to find, I had to look at the CSV.

I couldn’t get the one for the Client working, but it’s probably not special anyways.

You can fake Replication lag though…
image

Other than that, this is mostly everything I figured out about it.

I don’t know how much you’d have to spam to lag everything. Not sure if RemoteEvent and Replication are on the same level, when I changed the KB/s, it affected everything Network related.

But the smaller the data, the more data you can eventually send? One can go really crazy and exaggerate with the data that is sent through RemoteEvents. Maybe, it’s even important for Shooter games, probably.

However, if I set Replication Lag in the Studio Settings, it does affect RemoteEvents as well.

 


Conclusion, I probably answered my own question that I wanted to ask in the first place. One thing that remains open is how you can naturally make Replication lag, without changing the settings nor using protected methods.

But I still wonder about a better way to visualize Replication Data for debugging purposes.

2 Likes