Saving user progress between devices

@Team, @Community

Currently, google game services’ “saved games” feature is not supported in Corona. So, what other option do we have for user logins and saving user progress between devices? I wouldn’t believe Corona doesn’t already support this essential functionality.

I’m talking about having the user logged in and then send some info to a service saying something like “Pack 1: user is at level 7, Pack 2: user is at level 18”

This is crucial, considering that the life cycle of a mobile device is usually less than 2 years and moreover many users are often resetting their devices. I’ve many complaints from my users about not being able to retrieve their progress on their new device.

Thanks in advance!

@Magenda I think it’s a bit odd too that Google storage is completely missing from the existing plugins. On the iOS front, such storage was just recently introduced via the iCloud plugin. On the Android side, it seems that your options include rolling your own home-brewed solution or using one of the currently supported third party services:

AppWarp: http://appwarp.shephertz.com/game-development-center/corona-game-developers-home

Photon: https://docs.coronalabs.com/plugin/photon/index.html

Coronium IO: https://coronium.io/

 

 

Update: Previously I had linked to Coronium GS (which is meant for game matches and such) when I actually meant the more general purpose Coronium IO which is what Coronium GS is built upon. @roaminggamer caught my mistake and pointed it out below.

Everything @jerejigga said, plus don’t forget Coronion IO (which preceeded GS and is also awesome.)

Doh! I meant Coronium IO! I copied and pasted from another forum post I had made about real-time game servers and there I had provided a link to Coronium GS. I have updated the above post appropriately.

Many people have used Parse.com in the past, but Facebook is shutting them down. We are working to get a version of Coronium up as a Corona based cloud service. @Develephant is now on our staff and he is building out our cloud services based on his work. Our officially recommended stance today is to use Coronium for this until we can bring it online here. It should be pretty simple move when ready. 

We just recently added the iCloud plugin for iOS. The Google Play Storage plugin is on the planned list, but it’s behind a few other things before we can get to it. No ETA.

Hey guys,

I`m trying to add a feature to save data - and It will be great to do accross platforms - win32+android+itunes. So users can play there and there via same save. Does that makes sence? =) Or atleast backing save data online - will be great.

Can you point me - where to look? I didnt found that at photon =( parse is out of picture, 

this is close - http://appwarp.shephertz.com/game-development-center/corona-client-apis/#setcustomuserdata this is almost what i need but i suspect i need atleast 64k per user.

@efgames.net and all. Upon closer inspection of the APIs I am now questioning the value of AppWarp and Photon for game state storage. They both seem to allow certain custom properties to be set but they are clearly not intended to act as a means for long term storage. My apologies for recommending either of these as a good solution for this purpose.

That leaves just one of the options that I have already listed: Coronium IO. That said, there are certainly other options. Any hosted system that readily reads and writes JSON data via REST and has some basic security could be used. Two services that come to mind are AWS and Google AppEngine. There are certainly many others. In most cases, you would would need to do some work to get everything setup. I will keep looking and see if there is some service that offers this out of the box.

I did some very quick searching and found that Google does in fact provide exactly what I described!

https://cloud.google.com/storage/docs/json_api/

It uses OAuth 2.0 for authentication. Fortunately, someone else just posted some code that uses OAuth 2.0 to access any Google REST API! https://forums.coronalabs.com/topic/62087-succes-google-oauth2-for-corona-and-lua/

If you are up for the task, I bet you could get Google-based, cross-platform game state storage setup in a day or two and once it’s setup you’ll have almost no maintenance burden except for Google’s hosting fees.

Beyond basic setup, the main thing you would need to figure out is the best way to uniquely identify a player and keep his/her data private to that player. This would take some tinkering both in the Google Cloud Platform Console and in your Corona game code.

The Google cloud standard storage costs $0.026 per GB per month. https://cloud.google.com/storage/docs/storage-classes

Also, I found an existing Lua library that you can use. It even includes documentation on setting it all up.

https://github.com/leafo/cloud_storage

Update: I probably should have inspected this Lua library a little better before posting this. It likely won’t work out of the box due to some dependencies that are not included in Corona. The docs for this library though can at least help you get things setup on the Google side. It also demonstrates the API usage. So at the very least you can use it as a reference.

It’s kind of overkill to setup and pay a hosted db just to keep some high scores.

Until Corona Team supports Google Play “Saved Games”, what about a simpler solution:

Let the user login to Google Play and store there a high score for each pack / zone of the game (as a different leaderboard category). On game start, sync the local high score with the Google one.

My game has a coin-based system (iap) for unlocking level packs, so I’m thinking that I could even use achievements (“pack is unlocked”, “pack is completed”, “user reached level X in Y package”) to sync bought items (internally with gold coins) and user progress between devices.

Do you see any caveat with this approach?

Using Google Play achievements is limiting in a number of ways but the biggest one is that the user may not be logged into Google Play. Another one is that this approach is limited to Android devices with Google Play installed so it won’t work for Amazon devices or iOS. I did just recently stumble upon something that might just meet your needs and cost you nothing (assuming you stay within limits). Google’s Firebase is free within limits and has a REST API for the Realtime Database. I found a Corona library from 2015 that is for the older Firebase DB REST API. I am not sure if it works for the current Realtime Database REST API. It might be worth checking it out though. Here are some links.

Newest Firebase DB Links

https://firebase.google.com/docs/database/

https://firebase.google.com/docs/database/rest/start

Firebase Pricing

https://firebase.google.com/pricing/

Old Firebase DB REST API

https://www.firebase.com/docs/rest/api/

Corona SDK library for old Firebase DB REST API

https://github.com/vsergeyev/corona-firebase

The Corona library is just a thin wrapper for the REST calls so it should (hopefully) be easy to adapt if it does not work as-is.

@Magenda I think it’s a bit odd too that Google storage is completely missing from the existing plugins. On the iOS front, such storage was just recently introduced via the iCloud plugin. On the Android side, it seems that your options include rolling your own home-brewed solution or using one of the currently supported third party services:

AppWarp: http://appwarp.shephertz.com/game-development-center/corona-game-developers-home

Photon: https://docs.coronalabs.com/plugin/photon/index.html

Coronium IO: https://coronium.io/

 

 

Update: Previously I had linked to Coronium GS (which is meant for game matches and such) when I actually meant the more general purpose Coronium IO which is what Coronium GS is built upon. @roaminggamer caught my mistake and pointed it out below.

Everything @jerejigga said, plus don’t forget Coronion IO (which preceeded GS and is also awesome.)

Doh! I meant Coronium IO! I copied and pasted from another forum post I had made about real-time game servers and there I had provided a link to Coronium GS. I have updated the above post appropriately.

Many people have used Parse.com in the past, but Facebook is shutting them down. We are working to get a version of Coronium up as a Corona based cloud service. @Develephant is now on our staff and he is building out our cloud services based on his work. Our officially recommended stance today is to use Coronium for this until we can bring it online here. It should be pretty simple move when ready. 

We just recently added the iCloud plugin for iOS. The Google Play Storage plugin is on the planned list, but it’s behind a few other things before we can get to it. No ETA.

Hey guys,

I`m trying to add a feature to save data - and It will be great to do accross platforms - win32+android+itunes. So users can play there and there via same save. Does that makes sence? =) Or atleast backing save data online - will be great.

Can you point me - where to look? I didnt found that at photon =( parse is out of picture, 

this is close - http://appwarp.shephertz.com/game-development-center/corona-client-apis/#setcustomuserdata this is almost what i need but i suspect i need atleast 64k per user.

@efgames.net and all. Upon closer inspection of the APIs I am now questioning the value of AppWarp and Photon for game state storage. They both seem to allow certain custom properties to be set but they are clearly not intended to act as a means for long term storage. My apologies for recommending either of these as a good solution for this purpose.

That leaves just one of the options that I have already listed: Coronium IO. That said, there are certainly other options. Any hosted system that readily reads and writes JSON data via REST and has some basic security could be used. Two services that come to mind are AWS and Google AppEngine. There are certainly many others. In most cases, you would would need to do some work to get everything setup. I will keep looking and see if there is some service that offers this out of the box.

I did some very quick searching and found that Google does in fact provide exactly what I described!

https://cloud.google.com/storage/docs/json_api/

It uses OAuth 2.0 for authentication. Fortunately, someone else just posted some code that uses OAuth 2.0 to access any Google REST API! https://forums.coronalabs.com/topic/62087-succes-google-oauth2-for-corona-and-lua/

If you are up for the task, I bet you could get Google-based, cross-platform game state storage setup in a day or two and once it’s setup you’ll have almost no maintenance burden except for Google’s hosting fees.

Beyond basic setup, the main thing you would need to figure out is the best way to uniquely identify a player and keep his/her data private to that player. This would take some tinkering both in the Google Cloud Platform Console and in your Corona game code.

The Google cloud standard storage costs $0.026 per GB per month. https://cloud.google.com/storage/docs/storage-classes

Also, I found an existing Lua library that you can use. It even includes documentation on setting it all up.

https://github.com/leafo/cloud_storage

Update: I probably should have inspected this Lua library a little better before posting this. It likely won’t work out of the box due to some dependencies that are not included in Corona. The docs for this library though can at least help you get things setup on the Google side. It also demonstrates the API usage. So at the very least you can use it as a reference.

It’s kind of overkill to setup and pay a hosted db just to keep some high scores.

Until Corona Team supports Google Play “Saved Games”, what about a simpler solution:

Let the user login to Google Play and store there a high score for each pack / zone of the game (as a different leaderboard category). On game start, sync the local high score with the Google one.

My game has a coin-based system (iap) for unlocking level packs, so I’m thinking that I could even use achievements (“pack is unlocked”, “pack is completed”, “user reached level X in Y package”) to sync bought items (internally with gold coins) and user progress between devices.

Do you see any caveat with this approach?