Storing level attributes and level scores in tables
So I want to avoid making the same mistake as last time. In my first game I created a table to store upgrades that were available. However I also used that same table to store the status of each upgrade as purchased or not. The problem with this is that once the save table behaviour runs, you can no longer alter that table on the client's device. For example adding a new upgrade for purchase. So my understanding now is to have a "menu" table that you never save during the course of a game. And a writable "purchase status" table that simply tracks the status of the purchase.
My new project I have a bunch of levels and various meta data to store for each one. Time, Points etc...
So I have a read only levels table that stores the level and other information. I add to this table when I create a new level. And then I have a level_status table where I save the user's data for each level.
My confusion comes with saving the data in this writable table. It makes sense to me to store the data of the current level when the user is playing that level. However what if I add new levels in the future? Do I have to use the add row feature but if so, how do I know which rows the current user already has in their table?
All of the tutorials regarding storing per level scoring always show the same thing. A table with levels in it that gets edited. They don't really deal with the important issue of saving data and later adding new tables. If anybody can help me with this I would really appreciate it.
My Latest GS Game - Tiny Spirit
My First GS Game - Dashing Ralph
Comments
Ok I answered my own question. Here is the answer:
Have 1 row in the scores table. In the score saving logic, wherever that is in your game, make sure you first have the required row for that level.
So do...
If count(tbl_scores) < game.currentLevel
---Add row to end of table
Then save your score to that row of the table. This will only work if you have sequential levels. If you do not have sequential levels you will have to use table search I believe.
My Latest GS Game - Tiny Spirit
My First GS Game - Dashing Ralph