Would it be wise to send a massive dictionary via FireClient every few seconds?

Let’s say I have data that is structured like this:

Tbl = {
 {Pet = 20, Dmg = 100, Lvl = 5, Equipped = false};
 {Pet = 20, Dmg = 100, Lvl = 5, Equipped = false};
 {Pet = 20, Dmg = 100, Lvl = 5, Equipped = false};
 {Pet = 20, Dmg = 100, Lvl = 5, Equipped = false};
}

Every time the player touches a coin which could be every 1 - 2 seconds and even less, it would send this data back to the player every time. I would prefer to do this as it is the way I set up my data updating on the client side (whenever a value changes, it returns back to the client, I am using DataStore2 for this). However would it be wise to do this? Would I be hitting any data transfer limitations?

1 Like

Yes. The network speed of the player. It would be wise to minimize the amount of data you transfer always, for speed and performance reasons.

Rather than sending the whole table every time, consider sending it only once, and then streaming any changes.

4 Likes

Being honest, I’m not sure if it’s too much.
But what you can do is cache it, to avoid having to send data to the client every 2 seconds or less.

1 Like

Thanks! Good thing I checked beforehand because a lot would need to be changed if I later realise that this is not wise.

1 Like

One more thing - while streaming changes, I’d use a UUID rather than table indices. More reliable.

2 Likes

As long as you send under 50kbps you’re fine (~853 mbps). Otherwise latency will slowly increase over time causing a ton of perceived server lag.

I would recommend sending only table changes and first sending the full table.

1 Like

Another way is to fo a lazy world state update periodically. Just to say hey every once in awhile you get the big table. But stay clear of doing logic on recieve.

Instead use a message bus methodology and let the remote drop off the data into a module and then let the things looking for it poll the model for if something they want is there.

This keeps your messaging centralized and vastly reduces the number of remotes you need

1 Like