Graphical memory usage
As always it is important to check the memory usage of games, especially on mobile.
I regularly check “classic” memory usage, it’s easy with tools such as jvisualvm, and it can be done very quickly.
But GPU memory is always a bit tedious, on my computer I need to close eclipse to switch to the nvidia card (bumblebee, as I can’t find this information on the Intel card) and check if memory usage change with nvidia-settings. So I didn’t check it for quite some time and began being suspicious about the new 3d stuff. And indeed I wasn’t freeing the meshes used for the voxel terrain, so on every new level GPU memory usage was increasing.
Furthermore I had problems on iOs, where the memory is more limited, so I decided to clean up memory usage.
Now less fonts instance are loaded, and the big background images (map selection, main menu background) are loaded only when they are needed and unloaded afterwards (it means menus are a bit longer to load now, just a few milliseconds). I also optimized some small stuff.
Globally the game now uses two times less GPU memory, for a total of around 50mb (depends on level size) on my computer (for the mobile low quality version), 20mb being used by LibGdx/OpenGL apparently (allocated at startup). And it uses 3mb less “classic” memory (for around a 25mb total)
As I said I had some problems on iOs due to limited memory (even after correcting mesh problems), I don’t know why they happened, maybe I was just using too much memory, or maybe some memory isn’t freed correctly (everything seems correct on PC, but I cannot diagnose that easily on iOs). So I might have fully corrected the problem, or just postponed it (ie the game might crash after playing a few levels, a restart fixes it, but that’s not very nice).
I will continue testing, I have some other ideas to free even more memory if necessary (such as switching to texture mapping instead of per-vertice for terrain lighting, I don’t like that because we will loose details and smoothness).
I had some other problems lately: one of my screens died (farewell 223bw… you’ve been very helpful through these years) and my external drive crashed too.
That and the above problems mean release will be postponed a bit, next week should be good.