When the game quits, are the current values in the table saved and automatically retrieved when the game starts? I want to save data this way instead of saving a value to a key.
Comments
Braydon_SFXMember, Sous Chef, Bowlboy SidekickPosts: 9,273
You'll need to use the Save Table behavior for the table to save its content. It will automatically load the data.
no it should not have an issues unless you are saving multiple tables every .1 seconds. Even then you have to really overkill it. but it depends on the persons game at the end. I did an endless runner game where I saved into a table the highscore every .1 seconds and it didn't cause any performance issues.
Table data persists as long as the game is not shut down and restarted when the table is not saved. (Just like game attributes) As said above, tables saved via the Save Table behavior, will automatically be loaded when the app is shut down and restarted. Though it is lost when the app is deleted and then reinstalled. HOWEVER, when you save a table, any updates to the table between app versions will not update and override the saved table unless the app is uninstalled(thus losing all saved data) and reinstalling. Or you add in logic to update the table. (Except columns because new columns can't be added or removed.) So plan ahead.
HOWEVER, when you save a table, any updates to the table between app versions will not update and override the saved table unless the app is uninstalled(thus losing all saved data) and reinstalling.
Could you please clarify this bit? Sorry but I don't understand what you're saying.
EDIT: Scrap that, you mean changes to the table structure. I thought you meant changes to the data.
I would save the table as often as possible. Example, In my game, you collect an item. It's added to the inventory table. Table does not get saved. Player gets a phone call. Player comes back to game. Item is now missing from inventory and player cannot progress. What did I learn? If the save table is in complex group of rules/behaviors that fires when touch is released, and it's one of the last behaviors to fire in that group, it doesn't always save. Save that table often and save it again.
HOWEVER, when you save a table, any updates to the table between app versions will not update and override the saved table unless the app is uninstalled(thus losing all saved data) and reinstalling.
Could you please clarify this bit? Sorry but I don't understand what you're saying.
EDIT: Scrap that, you mean changes to the table structure. I thought you meant changes to the data.
I also mean to the table data too. So say you have an actor that gets its size values from a table. The table holds the values for 1024x768. You also used that same table to save high score values, but in a different column. In your next iteration of the game, you decided to change the actor's size value to 800x600 in the table. The change won't take effect in the next version because you have used the Save Table behavior and the original values are also saved. Instead of adding logic to update those values and resave the table, it is better to make sure you separate tables into things that will get saved and those which are data and can only be modified by the developer.
@CodeMonkey I added 30 blank rows to my stats table for the future thinking that if I could think of other things to track I could add them without any problem, but what you're saying is that I can't and that those 30 rows are now useless? Not actually worried about 30 blank rows, as I guess I can start a stats2 table instead. I just want to make sure I understand correctly before I cock it up later on.
It turns out I was actually saving the table in several places so that would explain why the data is available each time the app is properly closed and re-opened.
You could just add logic in an update to the app to update the already saved table via changing the table value during run time and saving, thus changing the saved table with the new info, rather than hard coding the info into the table and losing it to the saved table right?
You could just add logic in an update to the app to update the already saved table via changing the table value during run time and saving, thus changing the saved table with the new info, rather than hard coding the info into the table and losing it to the saved table right?
Sounds reasonable. Having a rule to only update the row and columns if they're currently blank. Thanks
Comments
As said above, tables saved via the Save Table behavior, will automatically be loaded when the app is shut down and restarted. Though it is lost when the app is deleted and then reinstalled.
HOWEVER, when you save a table, any updates to the table between app versions will not update and override the saved table unless the app is uninstalled(thus losing all saved data) and reinstalling. Or you add in logic to update the table. (Except columns because new columns can't be added or removed.) So plan ahead.
EDIT: Scrap that, you mean changes to the table structure. I thought you meant changes to the data.
It turns out I was actually saving the table in several places so that would explain why the data is available each time the app is properly closed and re-opened.