How Do You Test Save Data You Generate With The Io. Api Between Game Sessions While Working On The Simulator?

Hi All,

I’m working at being able to save and load game data for my current project.

I was able to use Rob M’s tutorial/library to get up and running with this functionality in about 2.5 minutes flat (thank you Rob!):

http://omnigeek.robmiracle.com/2012/02/23/need-to-save-your-game-data-in-corona-sdk-check-out-this-little-bit-of-code/

This works awesome while I’m in my current simulator session saving and loading data at different points in time. How do I actually get the io. API to save data between sessions on the simulator so that I can test what it will be like for a user who leaves the game and then comes back to it at a later point?

Is there a way to do this or do I have to build to hardware and test on hardware to try out this functionality? I’d love to test on the simulator so that I can read the output window for various print statements that I’m using to track the functionality with.

I guess another way of phrasing my question would be:

When a person uses the io. API to create a file in the system.DocumentsDirectory, does that actually save anywhere for the simulator to use? Or does this only work on hardware?

Thanks in advance for your help with this :slight_smile:

Hi @EHO,

Certainly, this feature saves to your local machine, but not everybody knows where it goes. :slight_smile:

From the Corona Simulator, select File > Show Project Sandbox

This should open up a window that contains your “local” Corona projects, organized by folder. Open the folder you want (it should be named according to your project). Inside there, you’ll see the folders representing what’s on the device. For example, “Documents” represents the “system.DocumentsDirectory”. You can view these files, remove them, whatever else… in fact, that’s pretty much essential if you want to ensure that your data is being saved/formatted exactly as you need it.

Hope this helps,

Brent

Hi Brent,

This is perfect. I found my save file as you described and now I can manually check against what I would expect to be there at any given point in time. The file does seem to “persist” between sessions just as one would hope a file in the DocumentsDirectory would on a real hardware build. I feel like I’m totally set up for working with saving and loading game data. 

Thanks for your help, between Rob’s tutorial and your feedback I’ve gone from knowing nothing about saving and loading data to feeling like I’ve pretty well sorted this out. :slight_smile:

Hi @EHO,

Certainly, this feature saves to your local machine, but not everybody knows where it goes. :slight_smile:

From the Corona Simulator, select File > Show Project Sandbox

This should open up a window that contains your “local” Corona projects, organized by folder. Open the folder you want (it should be named according to your project). Inside there, you’ll see the folders representing what’s on the device. For example, “Documents” represents the “system.DocumentsDirectory”. You can view these files, remove them, whatever else… in fact, that’s pretty much essential if you want to ensure that your data is being saved/formatted exactly as you need it.

Hope this helps,

Brent

Hi Brent,

This is perfect. I found my save file as you described and now I can manually check against what I would expect to be there at any given point in time. The file does seem to “persist” between sessions just as one would hope a file in the DocumentsDirectory would on a real hardware build. I feel like I’m totally set up for working with saving and loading game data. 

Thanks for your help, between Rob’s tutorial and your feedback I’ve gone from knowing nothing about saving and loading data to feeling like I’ve pretty well sorted this out. :slight_smile: