Save & Load game, many attributes

MarcoColMarcoCol Member, PRO Posts: 297
edited June 2012 in Working with GS (Mac)
Hi,
I am asking me, how I can made in my strategygame a loading/saving option for the user.
With only score it is not a problem. But in my game I have a lot of attributes like names, scores, positions, year-numbers and so on. How can I do that? Must I add for each attribe a attribute in the attribute-window?
Or is there a chance to save everything for example in a file?

Answers

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

    Hi @MarcoCol

    Unfortunately there's no shortcuts in GSC when it comes to saving and loading attributes. So yes, you have to add a Save and Load Behaviour for each and every attribute you want.
  • MarcoColMarcoCol Member, PRO Posts: 297
    So if I have 800 attributes in my game, then I must add 800 single attributes...?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2012

    If you want all of them to be saved and loaded, then yes. (So based on your example: with both Save and Load, that'll be 1600 Save and Load behaviours required...) :-(
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Now that we have writable tables it is possible to use them to save a bunch of attributes in them.

    If you do it right you could have only 1(!) Save Table behavior instead of hundreds ov Save/Load Attribute behaviors. :)

    Check the Cookbook and the videos on gshelpers.com to have a better understanding on tables. On gshelper.com there should even be a video on saving attributes on a table.

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

    D'oh! I forgot about Tables... :-) Good one from @MarkOnTheIron but remember though that loading and saving attributes this way involves a little bit more work to use them in the Rules, and that they all would be the equivalent of game attributes, i.e no self or scene attributes...
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Yep, tables makes it MUCH easier to save and load those attributes. :)
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    @gyroscope Using tables don't really take so much more work than classic attributes and you can avoid a lot of rules by using them.

    I'm in love with writable tables :)
  • master200012master200012 Member Posts: 372
    @MarcoCol just tagging you to make sure you've seen these updates!
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2012
    @gyroscope Using tables don't really take so much more work than classic attributes and you can avoid a lot of rules by using them.

    I'm in love with writable tables :)
    Hi Mark, I'm intrigued now, with your recommendation! (And @Braydon_SFX comment too... I'm certainly going to look into using tables for attributes for the major project I've been preparing on and off for quite a while... thanks!

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

    @tshirtbooth OK, that's definitely swung it; I'm checking out attributes via Tables asap!
  • MarcoColMarcoCol Member, PRO Posts: 297
    Ok. Have a look on different videos for using tables. But how can I change there the attributes? with changes in the game? For example if the user set a new color, or type in a text/number, how can I change (and save) this in the tables?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited June 2012
    You write the changes to their table location and save the table. So if you write everything to one table you only have to save that table no need to load it as it is already there. @gyroscope tables rock and I use them for everything I can as they are dormant when not being accessed unlike game level attributes. I even use tables for preset groups of true/false configurations. Building a game without tables is like trying to light a fire without matches by rubbing two sticks together..lol
Sign In or Register to comment.