Can you explain in layman’s terms please
This was meant only for the 15 stats.
But isn’t it better to use like a remote for each currency so roblox doesn’t add rate limits?
in short terms, your main field to optimize is handling requests and sending as less data as possible
Thanks to buffers, you can give ID to each place you need the value to be replicated, for instance gui, and send only 8-unsigned integer and 16-integer to reduce your network load 4-8 times
As I said making a network module was the best idea.
not exacly a module, it can be done with simple remote event, you don’t need module for this, value in each case will be different, so 2 lines of code will do
I would make a module for generally organazing the replication system and using buffers to make the payload of the remote very small.
Atleast this is what I did with my replication system and for me it works.
You’re right about this but I think to organize better a system you could use a module and do a system with more features and better organized.
Over-organizing makes no sense, it makes the game more complex
For max few places where you need to decompress, there is really no need to do this
You can also create system that stores values as IDs on client, and you only send value to the client in form of buffer if you have numerical values, or in form of string if you can have more types, strings are only lenght + 2 bytes long, so sending them less often or via separate remote is best option
But doesn’t Roblox behind the scenes send way more like 100,000s of bytes per second, but my server would only be sending a ~500 bytes per second. I’m more worried about Roblox rate limiting the Remote Events
I just like to use OOP, organaizing the game system with modules for me is just simpler but it’s really what @Omnomc prefers, if he likes FP then he can do as you said else like me, from my experience I would stick with community made data replicators if you want the best value, as you may not know how to serialize certain types through buffers.
No, it’s not that complex as you think
Creating buffer and sending it through remote shouldn’t be much of a problem, at the end you’ll have to wait 0.000000000000000000001 seconds more
You’ll save a lot more than normally, and only hard thing might be to fire correct remote every time, like ReplicateString or ReplicateNumber ect.
My advice is to use OOP or modules and fire remote events here, instead of centralized system, this way you’ll have simple and reliable remotes
Is it worth 1KB/s saving when about 200KB/s is being sent from the server back-end? I don’t have a problem with the latency I’m just saying is it worth the extra effort?
I don’t understand why its so complicated just to replicate players stats to client
So instead of making Roblox Studio actually usable they just change the play button to blue
Module scripts is how I do it
What I would change however is, rather than using a BindableEvent, make your client side script into a module script, now, the other scripts can require this module script, and get the stats from methods or properties of your module script
Depends how often you do it. Stats updates should not be happening every frame. Even if they did, IntValues and StringValues also have to replicate every time they change, so you’re not worst off
Since my game has a function where you have to spam click for a few seconds, there will be about 8-10 remote events fired per second, other wise I’d say its about 0.2 remote events fired per second.
I’m saying about 5 remote events would be fired per second on a large server for all players collectively.
But if the player dies, then won’t the reference to the module script be lost as the script would be removed and so another layer of complexity is added? (to re-reference script when player dies)
That’s still probably fine, you can always make a system to only fire the remote every second or so
Depends if it’s in StarterPlayerScripts or StarterCharacterScripts. But the recommended place for module scripts on the client is ReplicatedStorage. You can actually put module scripts anywhere (like being a child of the Player instance), and if you want the ModuleScript to run even if nobody requires it, you can put a script under it (not a local script, a script), set the RunContext property of that script to Client, and make that script require its parent (the module script)
it’s micro-optimization, you reduce number of bytes sending by reducing data size, numbers are 8 bytes each, strings are lenght + 2 bytes each, compressing numbers into 8 or 16 bits integers will benefit you the most if you aim to optimize replication, also compression is super fast, so there wouldn’t be any difference
Do you have any resources to learn this? I’ve never done anything compression-wise before
Not that hard, simply make a buffer, decide what sort of way to store your data you use, then send buffer over remote, and use buffer library to read from it