Save and load attribute doesn't work

GamepencilerGamepenciler Artist/Game DeveloperMember, PRO Posts: 326
Hi all, I'm having a problem with my save and loading the game. Example I have a "score" attribute, then I also used the same attribute to save. Then I put load attribute at my main screen.

Then I put my game under test and played the game. When I close the game and open it again I lost all the score points and went back to 0. Is there something I did wrong with the save and loading thing?

Artist/Game Developer / Animator at your service..

«1

Comments

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    It won't save and load in creator and I don't think it saves and load in the viewer either. The only time it works is when it's installed on the device as an Adhoc build or installed from the App Store. So if you're sure you've set it up correctly try it installing it on the device.
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    Not in the gamesalad creator, I did a publish and made the .app and put it in my Ipad. Is there something wrong?

    Artist/Game Developer / Animator at your service..

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Oh right, then yes there probably is something wrong with your code, trying putting the load attributes in an after timer, say after 0.1 or 0.5 seconds. It's probably kicking off too early
  • charliehgreencharliehgreen ArizonaMember Posts: 233
    Yeah it only works when I use it on my actual device.
  • chicopchicop Member Posts: 263
    edited September 2013
    Odd it works for me in the viewer by copying the score to a ghosts score
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    @chicop it works while you're playing but the next time you start it in viewer (a complete load) it's all gone. Well that's what happens for me anywho

    I haven't saved a table or attribute in viewer for a while (weeks, maybe even a month) so I may well be mistaken.
  • UtopianGamesUtopianGames Member Posts: 5,692
    edited September 2013
    I made a demo a while back using tables to unlock and also tables to save a "low" score but that can easily be changed.

    http://forums.gamesalad.com/discussion/59888/save-low-score-with-demo-project#latest

    http://www.deepblueapps.com/levels-unlock-with-tables/

    Darren.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    when you change a table value it will auto save the table.
    That's really handy to know! What's the point of the Save Table behavior then?

  • DigiChainDigiChain Member, PRO Posts: 1,288
    @DeepBlueApps - really? So the Save Table Behaviour actually serves no purpose?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2013
    @DeepBlueApps - really? So the Save Table Behaviour actually serves no purpose?
    +1

    -------
    To mention, for anyone wanting to use a Table for Saving & Loading attributes, it's worth pointing out – make sure you use the Copy Table Behaviour first and use the copy for Load/Save otherwise it's a lot of work to reset the Table to start a game fresh.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    To mention, for anyone wanting to use a Table for Saving & Loading attributes, it's worth pointing out – make sure you use the Copy Table Behaviour first and use the copy for Load/Save otherwise you can't reset to start a game fresh.
    And it's this part I find pants! The need to have two copies of the tables in your game when developing it, when a behavior to clear the table would have been much simpler/tidier. What I'm working on at the moment already has about 12 tables because of the need to have a blank MASTER one to copy each time when a new game is started.

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited September 2013
    Sorry guys was thinking of another :P you need to save table :)

    Darren.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2013

    @KevinCross

    Not sure why you find using Copy Table behaviours so bad, Kevin... (it sure beats having to set up a load of change attributes to put back original values in all your Tables... now that'd be pants for me!)
    ... because of the need to have a blank MASTER one to copy each time when a new game is started.
    You don't need to duplicate all values from the master tables for them to copy to, just make them with 1 row and 1 column with the + sign and that's enough (in other words, you don't even have to match the amount of rows and columns, or put in what type of attribute the column(s) will be). So that takes literally a couple of seconds for each of your table masters....

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    @gyroscope, I find having to have to two versions of every table in my list of tables bad, not the copy table behavior as such. I have to have a blank master table with all of the columns in and another blank version to copy the master table into when I want to wipe the table clean.

    It needs another behavior called clear table, and then we wouldn't have to use copy table when we want to clear a table, and we wouldn't need to have to set up two versions of every table.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2013

    @KevinCross As long as the copies of each master are clearly named - TitemsCOPY, for instance – I still can't see the problem, sorry! The master tables and their simple table starts for each, ready to accept a copy, all sit nicely in the Tables section ready for use, no complication... and there's no need to delete them either... copying a table into it again will replace it totally again with that master table.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    @gyroscope fair enough. I've got at least 12 tables though because of the master/copy versions. If they don't ever introduce a clear table behavior so that I can get it down to 6, it might be easier to work with if they'd sort alphabetically or showed as a list and not large icons.

    I'm sure I can edit the xml file to sort them myself, and the DBA program that I purchased recently, which sorts attributes, may have the option to do so too (I've not looked yet).
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2013
    @gyroscope fair enough. I've got at least 12 tables though because of the master/copy versions. If they don't ever introduce a clear table behavior so that I can get it down to 6, it might be easier to work with if they'd sort alphabetically or showed as a list and not large icons.

    I'm sure I can edit the xml file to sort them myself, and the DBA program that I purchased recently, which sorts attributes, may have the option to do so too (I've not looked yet).
    I don't know how GSC could manage without a copy of a Table so as to reset it... it needs the info somewhere, somehow... and the way we can do that now is easy and quick... maybe you'll warm to it one day! ;-)

    I agree it'd be a nice feature to have sorting for the columns tho'... (as well as in the attributes lists)... by name or value... let's hope we get that at some stage. :-)


    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    I don't know how GSC could manage without a copy of a Table so as to reset it... it needs the info somewhere, somehow...
    When I say reset it I mean delete all of the rows, not the column headers and column types. Obviously you wouldn't want to reset/clear a table that stores vital things for a game like an items database but if you've got a blank master table with 4 or 5 columns set up, having to physically set up another blank table just so that you can use "copy table" to clear out any data before a new game seems an unnecessary step.

    I'll live with it though :)



  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2013

    As I wrote, Kevin, for the copy table, all you need is the bare minimum, a table with 1 row and 1 column and no attribute types selected even, i.e just as it appears after pressing the + sign. That's it, done! No "physically setting up" anything except pressing the plus button and naming it. Providing you name it clearly so you know that'll be a particular copy from a master table, it's all done and dusted. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Thanks @gyroscope that's how I currently have my copy tables set up.

    I'll see if re-ordering them in logical order so that the masters and copies are together (i.e. alphabetically) makes things a lot more easier to work with if I have to introduce any more tables, especially when it comes to finding a particular table to manually edit.

    I've hijacked this post long enough I think :)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @KevinCross

    Glad I helped out. :-)

    I've hijacked this post long enough I think :)
    Yes, ditto! Sorry, @ecanhoj

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    oh I got soo many replies lol.. Anyway i'll try to do what @KevinCross says about putting a timer attribute. I didn't use or learn tables yet, i'll probably need to learn that on my next game.. I will try this now then keep you guys posted. Thanks @gyroscope , @DeepBlueApps , @DigiChain :)

    Artist/Game Developer / Animator at your service..

  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    I Preview on the iPad again, the attributes are not loaded back. Is this normal because it's a test .app ?
    I only have score attribute for now I don't think I need to use tables yet..
    But in any case can somebody link me tutorials how to save and load using tables? thanks

    Artist/Game Developer / Animator at your service..

  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    edited September 2013
    Here is a screenshot of what I did so that you guys can tell me what is wrong please thanks :) ..

    photo saveLoad.png

    Artist/Game Developer / Animator at your service..

  • iamcarteziamcartez Houston, TexasMember Posts: 648
    The only issue I can think of is if you are pressing the "e" then typing in the saveScore attribute.

    If I recall, if you use the "e" you will have issues with the save/load attributes and gameCenter stuff. You should just type in saveScore without pressing the "e"...
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    edited September 2013
    I don't think I clicked on the "e"xpression icon @iamcartezI just typed the words over the box field.. tnks

    Artist/Game Developer / Animator at your service..

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    You don't really need the timer around the save behavior.

    I looked at Doodle Kicks and I have a timer of 0.1 around Game Centre login because otherwise it doesn't register when the game is first loaded, but the load attributes on the same actor do not have a timer around them. You could reduce the timer on the load to 0.1, although the timers aren't the reason for it not working. I can't actually see anything wrong in that screenshot.

    How often are you updating game.StarScore and then saving it. Are you saving it at the end of a level/game?

    One last question, when you install it through Xcode Organiser are you deleting the app before re-installing it each time? Or just installing it and overwriting the existing version?

    EDIT: Another one last question ;) Are you certain you haven't got anything in your code that resets game.StarScore?
  • turboChargeturboCharge Member Posts: 15
    edited September 2013
    Oh
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    The score always saves every time the player collect stars. I always delete old app.
    This only happens when the game exits or if the game is closed and i reopen the app. I'd probably make a short test app and see what's going on.. Thanks @KevinCross

    Artist/Game Developer / Animator at your service..

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2013

    Hi @ecanhoj So it sounds like your Save Attribute behaviour is working OK but not the Load Attribute behaviour.

    Which leads me to wonder if you've put the Load behaviour in a proper place for it to be recognised...

    The following is a typical way that the Load Attribute behaviours are used... (in the "traditional" way, i.e without using Tables):

    In your menu scene, two buttons, one with Start Game or New Game, whatever you want, and pressing this will take you to the start of a fresh game.

    Then another button marked Continue or Continue Game, and before the Change scene behaviour, you put your load behaviours (including which level, if there's more than one level in the game; and it's here your Load Attributes go.

    --Example of Rules in the continue game button:

    When touch is pressed
    Load Attribute key: saveScore attribute StarScore
    --- then carry on with any more load attributes there might be--
    ---and if there's more than one level---
    Rules: -- all nested in the above Rule--
    When game.SceneWhich is 1
    Change Scene Scene1
    When game.SceneWhich is 2
    Change Scene Scene2
    etc.,

    Hope that helps out.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.