Quick Links: Gideros Home | Download Gideros | Developer Guide
Save basic data online
  • 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.
  • SinisterSoftSinisterSoft +1 -1 (+1 / -0 )
    Maintainer
    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

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

    Likes: theone10

  • @sinistersoft i dont know how to do that. I just thinking in some method 100% gideros friendley. :)
  • hgy29hgy29 +1 -1 (+2 / -0 )
    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
  • 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? :-?
  • totebototebo +1 -1 (+1 / -0 )
    Member
    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
  • pie +1 -1 (+1 / -0 )
    Member
    @theone10 a table or a json string?

    Likes: theone10

  • SinisterSoftSinisterSoft +1 -1 (+1 / -0 )
    Maintainer
    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

  • 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 +1 -1 (+1 / -0 )
    Maintainer 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

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

    Likes: theone10

  • theone10theone10 +1 -1 (+1 / -0 )
    Member
    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

  • totebototebo +1 -1
    Member
    Let us know how you get on!
    My Gideros games: www.totebo.com
  • theone10theone10 +1 -1
    Member
    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 +1 -1
    Member
    Does this work on iOS or Android only?
    My Gideros games: www.totebo.com

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID

In this Discussion

Top Posters