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:
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.