Saving game data, best strategies?

Working on my current project, I’m getting to a point where I want to save game data. Seems to me there’s two areas here:

  1. Data describing long term stuff. Like number of enemies defeated, total score, time played, worlds visited etc. 

  2. Data describing the immediate situation, for example rebuilding all of the sprites on the screen. 

Seems there are two methods for saving data writing files with io or using a database with sqlite3. 

I’d like to hear about how the rest of you handle all of this? I’m trying to decide on a strategy for myself. Writing a file seems easy enough. How much data, and when to save the data becomes a question. 

Check out DMC auto-store. Couldn’t be easier to use:

http://developer.coronalabs.com/code/dmc-lib-auto-store

The dmc_autostore library is very cool.

I was testing it out and ran into a problem. It seems that it doesn’t work well with sprites. The autostore object is not a standard array and doesn’t use the # operator to get the length. This causes a problem if you pass autostore data to display.newSprite().

Is it possible to convert autostore data back to a regular Lua table? 

hey SoggyBag,

right now there is a len() method which allows you to get the length of an array. soon i will be testing functionality which should allow the # syntax to work as well.

also, i have been using an updated version of dmc_autostore in a project of mine that has a new method called ‘clone()’ – it will convert any data element within autostore back to a regular Lua structure.
i have just pushed it to a branch at github - ‘dmc_autostore-v1.0.3’ so you can give it a test drive.

cheers,
dmc

Right on, I’ll have to try the new version. The dmc_autostore lib is very cool. 

Check out DMC auto-store. Couldn’t be easier to use:

http://developer.coronalabs.com/code/dmc-lib-auto-store

The dmc_autostore library is very cool.

I was testing it out and ran into a problem. It seems that it doesn’t work well with sprites. The autostore object is not a standard array and doesn’t use the # operator to get the length. This causes a problem if you pass autostore data to display.newSprite().

Is it possible to convert autostore data back to a regular Lua table? 

hey SoggyBag,

right now there is a len() method which allows you to get the length of an array. soon i will be testing functionality which should allow the # syntax to work as well.

also, i have been using an updated version of dmc_autostore in a project of mine that has a new method called ‘clone()’ – it will convert any data element within autostore back to a regular Lua structure.
i have just pushed it to a branch at github - ‘dmc_autostore-v1.0.3’ so you can give it a test drive.

cheers,
dmc

Right on, I’ll have to try the new version. The dmc_autostore lib is very cool.