I’m working on a top down 2D game that will have multiple interconnected adjacent screens that the player can transition too and from. I’m currently using a system where each screen is a Storyboard scene and when you move off the edge of one screen, that triggers the transition to the appropriate adjacent scene.
I had had some significant memory leaks initially which meant that every time I transitioned scenes my memory increased by about 30kb. This caused my game to bog within minutes to the point of being unplayable.
I’ve followed the advice from this blog tutorial and seem to have managed the five areas of consideration (display objects, global variables, runtime listeners, timers and transitions):
http://www.coronalabs.com/blog/2011/08/15/corona-sdk-memory-leak-prevention-101/
My memory no longer increases every time I switch scenes.
The one challenge I still face is that anytime I enter a new scene (ones I’ve never visited before), memory increases over all by about 8kb (memory remains stable if I’ve already been to the scene at some point, even though I purge scenes on loading a new scene). This memory growth is not an issue if my game “world” remains relatively small. I was planning on having 100 - 200 screens for the player to explore so in this case I’m anticipating a problem (have only built out about 6 screens at this point).
Is making each scene a screen of my “world” an unreasonable use of the Storyboard API (should I build a system for loading and removing my levels and only use scenes for menu, options, etc.)? If I’m purging scenes, I’m not clear on why new scenes would grow the over all memory usage. Is this 8kb increase per new scene expected? Does this indicate that I am still failing to manage my memory in some way? I have created some modules for common aspects of my levels. I believe I’m handling these correctly but could continue to investigate if the 8kb per new scene is unexpected.
Thanks in advance for any insight anyone has
[import]uid: 105707 topic_id: 32150 reply_id: 332150[/import]