Saving Attributes vs Saving Tables
TomCoffee
Member, PRO Posts: 175
Been using GameSalad for little apps for years but now I'm working on a real "game" for the first time. I have about 10 player values that need to be changed and saved after each round of my game is finished. Which is better for this: saving attributes or saving tables?
Saving tables seems to be "easier" because as the table values change in the round I can just save them all at the end each round with a SAVE TABLE behavior and be done with it. Referencing values from tables is also pretty easy.
Saving each and every attribute (and then loading them again separately if needed) seems to be a bit of a headache.
Is there a performance difference between the two methods? I do realize that in some cases I'll have to first load a table value into an attribute to use or change it sometimes, but that isn't a big deal.
How do you professional game makers handle saving data in your games? Thanks for any guidance!
-Tom
Saving tables seems to be "easier" because as the table values change in the round I can just save them all at the end each round with a SAVE TABLE behavior and be done with it. Referencing values from tables is also pretty easy.
Saving each and every attribute (and then loading them again separately if needed) seems to be a bit of a headache.
Is there a performance difference between the two methods? I do realize that in some cases I'll have to first load a table value into an attribute to use or change it sometimes, but that isn't a big deal.
How do you professional game makers handle saving data in your games? Thanks for any guidance!
-Tom
Comments
Attributes
Easy to work with, no need for long-winded tableCellValue() expressions
Easy to label (not just a row/column intersection but rather a specific name)
Tables
Easy to save (a single behavior for tens, hundreds, thousands of attributes)
Auto-load at runtime
Ability to copy a full table into a master table and then copy it back to reset the game
"Nightly" build functions such as Loop over Table and tableSearch() are extremely powerful for accessing data in repetitive or quick ways
Easy to pre-fill with large amounts of data values due to CSV import/export features
Ability to change "levels" by increasing the row number and keeping the code the same
Easy to code randomized selections for more than just integers
Ability to sort data using loops
Also, as a side note the Nightly build available to Pro members includes the ability to enter table expressions on either side of a Rule condition so there is no longer the need to first store table values in attributes.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I have had to use about 40 extra rules that could have been entirely avoided if I put 20 attributes into a table.
I'm having to do a ton of "If attribute is 1 then" "If attribute is 2 then" etc. when if I stuck them in a table it would just be one change attribute with a table cell value.
In other words, if a table will reduce the load of your logic and the number of rules you need, go with tables. If not, stick with whatever makes you happier.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
This is a simple puzzle game and I like tables so... During the game I'll most likely keep values in Attributes and then when a level ends I'll write those attribute values into a table and save the sable.
I'm a little curious about what happens when someone leaves the game in mid-level... Will have to experiment.. I've noticed if a GameSalad app is "off" for a while it seems to reset (or restart) on its own when I eventually go back to it. Not sure if that's a function of GameSalad or the hardware (do most of my testing on iOS)...
Thanks!
-Tom
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User