Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Save basic data online - Gideros Forum

Save basic data online

theone10theone10 Member
edited December 2016 in General questions
Hi all,

Im finishing my game, and I want to save some basic data (lives,level progress,...) of each user. Im using gamecenter and Google play services for leaderboards... Actually I save this data in a local .txt, but I want to put It online.

I have been looking for answers, in this fórum...and I have seen some methods REST based like firebase or kinvey, i decide start with firebase and gideros, but the plugin i have found have no authentication function ( was in a 2012 thread).

Someone of you have used firebase or kinvey. Do you recomend me another method for this basic operation.

Thanks a lot.

Comments

  • Do you mean for loading into another device they own - if so you could save it to a google 'slot' and load it back on the other machine.

    Likes: theone10

    +1 -1 (+1 / -0 ) Share on Facebook
  • Liking this! And on iOS? :)
    My Gideros games: www.totebo.com
  • How do you save to a Google slot? :)

    Likes: theone10

    +1 -1 (+1 / -0 ) Share on Facebook
  • @sinistersoft i dont know how to do that. I just thinking in some method 100% gideros friendley. :)
  • hgy29hgy29 Maintainer
    You can use Gaming plugin for this (at least with Google Play services):
    • Gaming:loadState(key) --numeric key, raised STATE_LOADED or STATE_ERROR
    • Gaming:updateState(key, data[, immediate]) --update data, numeric key, can raise STATE_CONFLICT or STATE_ERROR
    • Gaming:deleteState(key) --delete data for numeric key, can raise STATE_DELETED or STATE_ERROR
    • Gaming:resolveState(key, version, data) --resolve state conflict for slot key with version and data, should be called if STATE_CONFLICT event was dispatched, may raise STATE_LOADED event for new resolved data
    +1 -1 (+2 / -0 ) Share on Facebook
  • Thanks @hgy29 , sounds nice. I have been looking for info about It, and looks its ready for iOS too.

    I have reading saved games info and they have changed the system on July this year. Hope gideros plugin keep working.

    About functionallity, sometimes will be nice some examples... Because what is key argument in the functions. I know data is the info you want to save. But if I want to save the content of two different variables, how I have to do? Save each variable in different key? :-?
  • If you guys get it to work on Google Play and iOS, let us know! I want to save progress in the cloud, but my tests all fail with the Gaming plugin.

    Likes: theone10

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 ) Share on Facebook
  • @theone10 a table or a json string?

    Likes: theone10

    +1 -1 (+1 / -0 ) Share on Facebook
  • I convert my table to a json string then save that. When I load it back as a json string I then convert it back to a table.

    Likes: theone10

    +1 -1 (+1 / -0 ) Share on Facebook
  • when i try it, i will post my results. Im gonna try.

    @sinistersoft thanks for the info, very useful. @pie is this what you refer?
  • SinisterSoftSinisterSoft Maintainer
    edited December 2016 Accepted Answer
    just before save:
    local saveString=json.encode(savedata)
    if saveString~=lastSavedData then
    	gaming:updateState(0,saveString)
    	lastSavedData=saveString
    end
    on load:
    local savedata=json.decode(e.data)
    if savedata then
    --here process incoming saveData table

    Likes: theone10

    +1 -1 (+1 / -0 ) Share on Facebook
  • @theone10 yes that's what I intended, but I never tried to do it :)

    Likes: theone10

    +1 -1 (+1 / -0 ) Share on Facebook
  • just months later... i try it. And on android goes perfect, in some weeks i'll try on ios.

    Thanks again guys :D

    Likes: totebo

    +1 -1 (+1 / -0 ) Share on Facebook
  • totebototebo Member
    Let us know how you get on!
    My Gideros games: www.totebo.com
  • theone10theone10 Member
    edited July 2017
    The first i init gaming plugin and add to stage the event listeners for login(complete/error) and of the state(loaded/error) and I do the login.

    When raise login complete i do loadstate(0) and when raise the loaded listener, I do as @sinistersoft wrote Up there.. and when saving i do exactly the same example Code. It fails any of event listener I load a local string.

    Now Im handling some conflicts...
  • totebototebo Member
    Does this work on iOS or Android only?
    My Gideros games: www.totebo.com
  • Sorry for my late answer. I just try it at the moment on android... soon ill check on ios

    Likes: totebo

    +1 -1 (+1 / -0 ) Share on Facebook
  • One thing to remember, at least if you are doing this manually is handle offline (or server down).

    So, if there is something you want to send to your service, if you are offline then queue it (store local file), then the next time the app loads/resumes (or timer) you re-attempt the POST or send attempt. I used this approach for storing high scores in a cross platform way, although I wrote a custom service and host it in amazon aws.

    Likes: theone10

    +1 -1 (+1 / -0 ) Share on Facebook
  • talistalis Guru
    Accepted Answer
    I totally agree about handling offline. Just want to point out cheating issues in offline files:
    You can use one of those below methods or even combine all of them to increase security;

    1-Be sure to code your own hash system or use any current one so even the files are altered in offline mode you can be aware of it and act according to it, use the online version, warn the user etc... Try to save information in two or more separate files. And link those files secretly together.
    So much simple example not to be implemented in this way:(Just to give you idea)
    Number of Characters of File A must be the beginning of file b
    Number of characters of file B*Number of Characters of File A*10 must be the beginning of file C
    So in any case whenever your program opens those files for reading let it check for this relation between files. If any alterations occurred take necessary action.

    2-You can encrypt your files always.

    3-Logical tests while reading your file data or inside the program. For example: no one can click to screen more than 10 times a second.

    4-Obfuscate your code to false direct your pray. Name hp variable as mana, or name it directly something not meaningful even:D and try not to use order in your save file.

    5-Encrypt your project.

    Of course those things are all can be discovered and despite of all your efforts your file can be altered. But in any way it is fun to implement those for me at least :D

    Likes: antix, theone10

    +1 -1 (+2 / -0 ) Share on Facebook
  • talistalis Guru
    Accepted Answer
    Just found it here lies more information about the security:
    http://giderosmobile.com/forum/discussion/comment/52127#Comment_52127

    Likes: theone10

    +1 -1 (+1 / -0 ) Share on Facebook
Sign In or Register to comment.