So i want to make my game more optimized and playable even in low end pc
The problem is when your graphics is on its lowest you can barely see anything in the map
When you turn it for like level 4 it will give you a framedrop if your pc is trash
Solutions I tried:
I tried placing all the while loops code all in one script so i don’t have multiple loops running
We tried to lessen the amount of parts inside the workspace
Change the rate for snow particle emitter and set it to low
we tried this stuffs and it helps just a little bit but its still laggy. I checked on the client memory usage and its usually 300 - 500 mb only i wonder whats the problem
You should really try not to use while loops as much as possible, another tip is try disabling collisions for certain parts the player can’t touch, may help a bit.
@Boogagle
What’s wrong with while loops?!? The problem wouldn’t be the while loop, but rather whatever code is running inside of the while loop.
@DybalaplaysYT
It would be better to use Voxel instead. Compatibility is only meant to be used in old places that were made with Legacy lighting in mind, and it’s meant to be a temporary solution until the developer can fix it.
Not necessarily, if it’s a while true do loop they can definitely get performance heavy. You’re usually better off with a RunServixe heartbeat connection.
I mean, you can go test it yourself and see which one runs faster.
while true do can be used for purposes other than doing something after a yield, so it doesn’t make sense to lump the two together. Even then, Heartbeat would still use a similar (if not the same) amount of resources anyway, and if there’s a difference then it’s unnoticeable.
Functions you have bound to fire on every render step take around two milliseconds (an eighth of a frame, this is a LOT), and various other scripts (all of which are named LocalScript) take up around another millisecond of frame time. On top of this, the player is rendering upwards of two million triangles per frame, which is more than enough to cripple an iPhone X or low-end PC. You have a lot of script and model optimization to do
There are several helpful resources on the topic of performance in many fields which you can find via the search bar. I’ve written a guide on it here which may help you;
@UnknownParabellum
I think they chose to do that because they’re just trying to give a quick example.
@varjoy
There’s nothing wrong with an infinite loop. Isn’t using Heartbeat also creating an infinite loop? (keep in mind you can end both loops by (breaking/disconnecting it) And Heartbeat takes memory too. Anything you do is going to take memory.
Have you tested that? Even if that’s true, the difference would be unnoticeable. (i’m assuming you’re talking about while true do compared to Heartbeat, since you didn’t make it clear what you’re talking about)
Also, there are cases where infinite loops are
needed, like a day and night cycle that updates to the next time every few minutes instead of updating every frame.
You can also… not use wait? There’s alternatives like this and this. They have functions that serve the same purpose as wait, but without all the problems it has. Also again, not all while loops are infinite wait loops.