Hey Devs,
I was recently wondering how I can lower my sent and received network pings since they see rather high about 500+. How do games like pet sim keep theirs so low considering they are a huge game?
Iâd say the first thing you should check is remote event/function spam. Calling them at high rates will cause the pings and network usage to ramp up very quickly.
Same goes if you send HUGE pieces of data through them
Latency is not the same thing as bandwidth.
Is there any modules I can use to help lower it since my game heavily relies on remote events and all that stuff
You could try using networking libraries like Packet.
I donât really use modules like that, I basically just reduce event calls to be reactive* and only send the strict minimum
Another way you can reduce bandwidth usage/Remote calls is by using Attributes where possible or even instances/Value objects and listening to their ChangedSignal
* What I mean by Reactive is listening to updates instead of constantly polling/requesting information on a loop.
A little diagram to help them understand better:
Latency: The time between two points (think of it like ping pong - the time it takes for the ball to go from your paddle to your friendâs paddle)
Bandwidth: the maximum range of frequencies [aka, the size of the internet tube] (also think of it like ping pong - itâs how big the table is. The wider the table, the more balls can bounce on it)
Oh, you mean being âLazyâ? Lazy is a term used when things only run when theyâre called. (Or, computed/initialised when theyâre needed)
Eg, you have a variable âFruitBearingTreeâ. It doesnât have any value initially. Only when you check if it has fruit, then itâs given a value.
âLazy Loadingâ is a different concept where, as you mentioned, you only load/initialize the module when itâs being used for the first time. This concept mostly only applies to how modules are loaded in (there are exceptions when it comes to APIs when you load an object and you donât necessarily want to load all sub-object within your object, itâs makes it more lightweight to retrieve, and then you can lazy load them which makes an additional query to the database to retrieve it when you use it). This is more something I think youâd find in web applications or APIs rather than Roblox
Actually reading back on what I said above, I think your example could qualify, but simply updating values dynamically wouldnât fall as Lazy
Being reactive means doing something like this:
-- Server
local function SomethingIsUpdating()
-- Example of sending the strict minimum, instead of sending all the values,
-- we only send what changed
SendUpdate:FireClient(ModifiedValues)
end
-- Client
SendUpdate.OnClientEvent:Connect(function(ModifiedValues)
-- Update UI, client state, or something based on the modified values
end)
This contrast to polling, which could look something like this:
-- Client
while true do
task.wait(1) -- Polling delay
NewData = GetData:InvokeServer() -- Sent whether or not it changed
end
My example is client-side, but this would be equally as bad if the server sent data like that
Latency is not really something you can easily reduce but would recommend looking into how to make data small and compact.
Less bandwidth generally means smaller chance of data getting lost on the way and needing to be resend again.
Try using buffers or making your own data types.
Buffers let you use 8-bit, 16-bit and 32-bit numbers, with some work arounds 24-bit too.
Ideal for cutting off bits that you wonât use.
If youâre sending numbers that will never exceed 256, you store them in 8-bit integers.
16-bit numbers go up to 65.536.
Find ways to combine or pack data together using buffers when relevant.
If I recall, buffers also come with a built-in lightweight compression which can slightly reduce data usage further.
Shrinking bandwidth usage just generally puts less stress on connections.
Thereâs no way to fully eliminate latency though, it really depends on how far away and how stable connections are.
If you can predict things like player movement or projectile movement, try predicting what their possible âfuture positionâ could be, it makes a game feel more responsive.
this amount is impossible to be made with remoteevent, since you are talking about pet simulator, i guess you talking about visualizing pets
i guess you are moving each pet on server, that causes huge network receive, you should always move visuals like that to client
so on serverside, you will only store data about each player and his equipped pets, while on clientside you will use that data to construct pets models and make them follow player


