How do I reduce memory usage in my game

My game here, Plants Vs Zombies Defense Tycoon, is using more memory than I would like on the client and server:


I was initially suspicious of a memory leak, but I am very thorough with cleaning up my code. There is no memory leak; the above screenshots display the constant memory usage regardless of how long the game has been running. Now I am led to believe my game is just too graphically demanding.

I thought I did all that I could to avoid this issue. I have spent a lot of my time optimizing in areas where it’s possible. I have heard that optimal client memory usage is 500 MB

-I think the 3D Models are optimized. There are 600 ~ 1200 vertices in character models.

-The physics parts I use are cleaned up very quickly and rendered on the client not the server. Physics parts (sun from the tycoon) are toggleable on the client and memory usage here is not bad (around 60 MB consistently).

-Particle emitters are used frequently, I use flipbook particles occasionally (I think they are more costly?), but these are rendered on the client and toggleable as well.

-The surrounding map is detailed, but map detail can be toggled, and I have optimized the detail of models in the map as much as possible.

-Streaming enabled is active with these settings:
image
All models in my game follow the most up to date streaming technology (at the time of writing this), and the appropriate streaming options.

-Almost everything is rendered on the client, and can be unrendered via the press of a button in settings. The amount of physics parts used (limbs falling, etc) is toggleable too.

-Physics parts which are out of range do not render, sounds which are out of range do not play, and particles are not emitted if they are too far. On top of that, the tycoons owned by other players can be hidden which does drop memory usage about 50 MB.

1 Like

The memory only increased 20 MB, which is normal. “Memory” is affected by an open instance of Roblox Studio.

There isn’t a problem with memory leaks I’m not worried about memory increasing, I want to reduce the baseline memory usage.

It’s using less than 900 MB, so it’s good.

Thank you but I am looking for ways to decrease memory usage to ~500 MB on the client. I currently have a maximum of 4 players per server, which I want to increase to 6. Before I increase my maximum player count to 6 I need to reduce client and server memory usage. I appreciate your feedback though :smile:

Actually, it might be a sound that is taking up memory if that is your target. Some very uncompressed sounds can take up a lot of memory.

I didn’t even think of that and a lot of sounds are unused, I’ll try cleaning it up. Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.