Hi guys.
My app is not yet finished but I would think past the first release. What i am trying to figure is what happened if I need to release an updated version in the future. Specifically what happened to the player high score, achievements and so on.
I am using JSON (with data.lua found on this forum) and a gameSettings table to save the player info, game settings like sound and so. Something like this (in main.lua):
[lua]_G.gameSettings = { }
_G.gameSettings =
{
[“gameVersion”] = 1,
[“hiScore”] = 0,
[“score”] = 0,
[“musicOn”] = true,
[“fxOn”] = true,
[“fxOn”] = true,
[“isGameActive”] = true,
[“isGameSaved”] = false,
[“gameLevel”] = 3,
– and so on
data.saveSettings() – I THEN SAVE the global _g.gameSettings (from data.lua)[/lua]
The real question, is how you guys would approach updating a app later that may need a different structure for gameSettings table? For instance let say I need to add a feature like local multiple player and so need to keep track of more than one player highscore (just an example) In that case, the gameSettings will need to change to accomodate the extra players data. Something like:
[lua] _G.gameSettings =
{
[“gameVersion”] = 1,
[“hiScore”] = {0,0} – for a second player
…
}[/lua]
I may also want to add a player name like [“name”] and so on. Of course if I know in advance what future version I may build I could simply add them now (and I will) But what about variables that I cannot think about right now?
Obviously I cannot just change the gameSettings table for version 2.0 of the game since it would screwed up everybody who has used version 1.0.
I was thinking maybe having temporary variables like [“v1”], [“v2”] but that’s not very elegant! Also I am not sure how I can predict if for instance [“v1”] will be a simple variable or an actual table like [“v1”] = {123,123,123}
How do you guys deal with such problem?
Thanks in advance for any pointers.
Mo.
[import]uid: 49236 topic_id: 16437 reply_id: 316437[/import]