I have a game with over 20 different maps (some very detailed). Currently I keep them in ReplicatedStorage and move whichever one is picked to Workspace (and remove the old one). For some larger, more detailed maps, I split the map up into multiple models and load one every second, which seemed to lower lag due to the loading being spread out. My game is on all devices supported by Roblox, so I was looking to make it perform better on older devices. Would changing how I load maps (for example using ServerStorage when not in use) improve performance? Also, is there anything else I could do?
Storing all maps in game.ReplicatedStorage
increases player load times unnecessarily, and wastes client memory. Instead, you should store them in game.ServerStorage
as you say, and load them as necessary.
Breaking down computationally expensive tasks, like cloning a large map, can be valuable since you can give a chance for other threads to do work if you yield every time a portion of the map is loaded. However, cloning portion by portion without yielding in between doing so won’t give you any benefit, since no other threads will have a chance to do anything.
Thanks. This makes sense, I noticed memory usage is around 500MB and a lot of users float in the air for a long time (presumably long loading times). So this seems to be the exact issue.
I addressed this in my original post. Because you’re not yielding, there’s no gain from doing this. In fact, it will be negligibly more computationally expensive than cloning the entire model.
I am doing something like this in a for loop. But I grouped a bunch of parts into models ahead of time, and load them in 1 by 1 with wait(1)'s between them.
(I’m not sure if there is a more efficient way or not, but it lowered lag for me compared to loading it in all at once)