#Performances optimisation

1 messages · Page 1 of 1 (latest)

nocturne crypt
#

Hey, i'm trying to learn about performance optimization on roblox and i was wondering something

I never faced any performance issue until yesterday, spamming a remoteevent that was passing my whole player unit data 10 times cus i was giving 10 units made my game freeze and ping went to 700+ms which made me realise i should learn about this as fast as possible to avoid rewriting a huge part of everything i did in a few weeks

So here is my question :
Performance wise, what is the best way to deal with all the data my client need (display etc), the remotes and how the server should pass the data ? I also heard about things like Memory Leaks etc, what are these ? how can i see if there is one and how to prevent ?

As example, right now i'm using Local/ModuleScripts for my GUIs, LocalScript get the data in a variable with RemoteFunctions and then when its a function i will need from different scripts i use ModuleScripts or else i keep it in the LocalScript. Then i call the function and pass the data this way
in this scenario, what should i do ? Stay like this, = nil the data if i dont need it anymore ? Make a Module that store the data so i just refresh it using RemoteFunctions and specific target so only 1 script have all the data and it doesnt duplicate in each ? (im pretty sure its the last)

nocturne crypt
#

This is screens from the performance menu, is the usage high ? normal ? what can affect it and how can i reduce it if its possible ?

There is a lot of things from what i see but most performance tutorials i found were "use modules" "avoir getting data multiple times in a same script when u can pass it from function to function"..

fierce moth
#

Use Collision Fidelities
Render Fidelities
use less remote events
Streaming Enabled

nocturne crypt
fierce moth
#

what?! using alot of remote events is bad, you should only use them when you need to, also cause remoteevents arent always performant roblox also created unreliable remoteevents these are remoteevents that u can use whenever but they do not guarantee to work always as the name states "Unreliable"

nocturne crypt
# fierce moth what?! using alot of remote events is bad, you should only use them when you nee...

Well, yeah i use them when i need to but if you have many functions that pass data to client you will need multiple remotes
As example, updating inventory, specific item, currencies, characters etc etc

And on top of the "main" tables, if you only change 1 unit you dont need to send the whole table again meaning 1 more remote for this specific task

I'm not sure i understand what you mean by a lot of remotes, do you mean having them in quantity in replicatedstorage or just using a lot of remotes at the same time ?

fierce moth
#

"As example, updating inventory, specific item, currencies, characters etc etc" this is okay
quantity isnt a problem i mean using them in places where you dont need to i've seen alot of devs using them to much ex. (making a countdown system

bad example: firing remote event every second❌

good example: firing remote event only at the start and end and using tick to keep the time same ✅

)

jsut try to fire remote events only when you need to

nocturne crypt
# fierce moth "As example, updating inventory, specific item, currencies, characters etc etc" ...

ahhh okay, i already do this

One question i have is, right now lets say i have multiple UI that need to display things like equipments, full inventory, specific items
What i do right now is basically get the whole inventory table and filter it since i dont want to make a remote for every single separate item

But what if i create a module in ReplicatedStorage and on ProfileStore init i duplicated the data in this module under different tables
Like Module.Inventory, Module.Equipments etc

And then, when a script needs it instead of making one more local variable that will weight something i just get the value from server and store it in that module
This way i only have 1 variable to pick data and display it on UI etc instead of one in every script that needs it

Would it be a good thing to do for performances optimization ?