I’m creating a Point and Click Adventure Game and I want to be able to have multiple Saved Games for Multiple Players. Should I use Json or can I use simple text files to accomplish this? Depending on the answer are there any good tutorials on this subject. Thank you for your time.
A lot depends on the type of data you need to save. What I would recommend is simply store your data in a Lua table. Then use the code from this tutorial to create two functions, one to load tables and one to save tables. It uses a simple flat file, but uses the JSON library to encode and decode the data. Its powerful but really simple at the same time.
Rob
Applicable tutorial link ;) :
https://coronalabs.com/blog/2014/10/14/tutorial-saving-and-loading-lua-tables-with-json/
Thanks Alex and Rob. I am using a table at the moment to hold all my variables, which are being read in from a normal text file but I am searching for something that will work better for my needs or at least make it more efficient. Rob is the tutorial Alex posted the tutorial you were talking about?
Didn’t really see anything in that tutorial about handling multiple saved files. Is there any information floating around about that?
Yes, Alex took care of my brain lapse in posting the URL!
Wanna save multiple tables? Just save each table to a different file name. You pass a filename to each call, so you can have as many saved tables as you need.
Rob
I always have your back, Rob!
@animationarsenal Saving game variables with JSON becomes second-nature once you get the hang of it. There aretons of resourcesin the Corona forums with info about how to save JSON data, as well, so that you can easily get off the ground in no time flat!
Great Teamwork! Thanks Guys you’ve been a big help.
Yes and Yes Alex.
You guys have helped me out a few times so I’m going to give you guys in game credits and a free copy of the game when it’s finished. Thanks again for the help. Let me know if you get this message.
A lot depends on the type of data you need to save. What I would recommend is simply store your data in a Lua table. Then use the code from this tutorial to create two functions, one to load tables and one to save tables. It uses a simple flat file, but uses the JSON library to encode and decode the data. Its powerful but really simple at the same time.
Rob
Applicable tutorial link ;) :
https://coronalabs.com/blog/2014/10/14/tutorial-saving-and-loading-lua-tables-with-json/
Thanks Alex and Rob. I am using a table at the moment to hold all my variables, which are being read in from a normal text file but I am searching for something that will work better for my needs or at least make it more efficient. Rob is the tutorial Alex posted the tutorial you were talking about?
Didn’t really see anything in that tutorial about handling multiple saved files. Is there any information floating around about that?
Yes, Alex took care of my brain lapse in posting the URL!
Wanna save multiple tables? Just save each table to a different file name. You pass a filename to each call, so you can have as many saved tables as you need.
Rob
I always have your back, Rob!
@animationarsenal Saving game variables with JSON becomes second-nature once you get the hang of it. There aretons of resourcesin the Corona forums with info about how to save JSON data, as well, so that you can easily get off the ground in no time flat!
Great Teamwork! Thanks Guys you’ve been a big help.
Yes and Yes Alex.