The map for my game is very large and uses a lot of meshes and is resulting with very high client memory usage (of around 1250, with the map not finished yet I am expecting around 1400).
I also get low frames in the more detailed part of the map so I had 2 ideas:
First idea was to use StreamingEnabled.
This worked great initially but after the player walks around and explores the game, it seems that StreamingEnabled isn’t unloading the areas the player is no longer in, eventually meaning that I am back to the same issue where the player has explored the map and everything is loaded resulting in high client memory usage.
My second idea was to make a kind of custom loading system where only objects that are near the player are loaded. Initially all the calculations caused too much lag so I ended up making a more efficient version of it. This works kind of but feels very hacky (I am literally just parenting things to replicatedStorage and then parenting them back to their original location when the player is near).
What I am looking for is if there is a way to ‘set’ the maximum client memory usage so that StreamingEnabled unloads areas when it starts to get too laggy.
Is this possible? If not how else can I reduce the lag the map is creating.
StreamingEnabled doesn’t unload objects that are not in reach unless you are very far out. What it does do is it lowers quality of the build.
For example a normal mesh would be deformed slightly and parts would be optimized for a greater performance.
The idea behind it is that players won’t notice that the stuff is lowered in quality because the things being affected are farther away and harder to see already. It’s also seen in games such as GTAV.
Hope this helps
Quick tip: when scripting with StreamingEnabled on always use WaitForChild()
StreamingEnabled considers the device’s memory and unloads objects based on the availability of memory. If areas aren’t being unloaded then the engine still sees that there’s available space in memory to keep the existing parts rendered in.
From the start, StreamingEnabled was only supposed to speed up load times by gradually making maps available as you explore while being conscious of device memory availability. It’s not necessarily or even at all supposed to be a replacement for chunk loading.
You might have a very large map or detailed builds but so long as your device still has available memory it won’t unload anything. As for allotting a maximum memory consumption amount no the developer has no authority over that either, it’s handled by the engine. You can determine how much additionally the engine will stream in around the player with Min/Max radius at the very least.
Anything within 64 studs from the camera’s perspective is rendered at the highest priority, objects in the worldspace will be rendered all the way up to 1024 studs away from the camera’s perspective at a moderate priority.