levels - memory management tips

Hi all, I’m going to release my first game very soon and am trying and optimize the code before sending to the App Store.

My game is made of 10 levels and I would like to clear the memory and remove all the objects before passing from one level to another. In particular I have a main.lua being the level 1 and then calling level 2. Level 2 calls level 3 and so on.

How do you optimize memory usage? Indexed tables create 10 times the amount of data I need. On the other hand, initializing the same variables level after level is the easiest way but at what cost?
Thanks in advance for your tips. [import]uid: 67641 topic_id: 17797 reply_id: 317797[/import]

Put necessary local (!!!) variable into database, clear all, load next level and variable fron database. [import]uid: 12704 topic_id: 17797 reply_id: 67924[/import]

Thanks for your answer.

Using the storyboard api just now from the latest daily build, will update the community about my progress.

Also intending to save/load data, level after level, and not sure if ice from Graham Ranson is still needed in this new environment.
edit: got the answer for load/save from http://blog.anscamobile.com/2011/11/common-storyboard-api-questions/ !! :slight_smile: [import]uid: 67641 topic_id: 17797 reply_id: 68994[/import]

The final touch to my game is going to be a leaderboard.

I am not going to use Open Feint at this stage because I can’t connect to any wi-fi network from my ipod touch, so it is impossible to set up and test it properly.

Instead, I’m going for a local leaderboard: I want to store the best scores in a local file and retrieve them every time the game is launched. Is this a legit thing to do? [import]uid: 67641 topic_id: 17797 reply_id: 69555[/import]

For a local leaderboard Ice should be able to help you there. I have included a helper function in it called “storeIfHigher” which will allow you to automatically have a new score saved if it is higher than the already stored one. Of course you could just use it to store all scores or both, it’s up to you. [import]uid: 5833 topic_id: 17797 reply_id: 69560[/import]

I’ve been using Ice - it’s superb and I would certainly recommend it. Thanks @GrahamRanson. [import]uid: 74503 topic_id: 17797 reply_id: 69572[/import]

Thank you! Really happy to hear that it is getting used and liked! [import]uid: 5833 topic_id: 17797 reply_id: 69593[/import]

Many thanks, Graham, I’m going the Ice way too! [import]uid: 67641 topic_id: 17797 reply_id: 69610[/import]

It’s what all the “cool” kids are doing. Oh yeah, I want there. [import]uid: 5833 topic_id: 17797 reply_id: 69611[/import]

@GrahamRanson Nextone lib you should call moustache :wink: [import]uid: 12704 topic_id: 17797 reply_id: 69612[/import]

Haha good call, just got to decide what to make now :slight_smile: [import]uid: 5833 topic_id: 17797 reply_id: 69614[/import]

@GrahamRanson

BTW. Graham, can you help me with GC?
http://developer.anscamobile.com/forum/2011/11/24/game-center-through-support-how-jump-game-center-without-restarting-game
Regards [import]uid: 12704 topic_id: 17797 reply_id: 69615[/import]