GameGuru Dev Blog - More To Save

After one of my drives exploded, and after repairs and file restorations, I am back in the coding seat adding more functionality, specifically the Save/Load Progress feature I am tasked to complete, which can now store the player's weapon selection, health and lives count, plus all the weapons carried, and their various ammo values. The best part is that all this happens via LUA script and not hard coded.  The standalone currently does not save or restore things like entities or other in-game metrics, but I've created a test map which shows all the states in transition so it's just a matter of laying down some more code. The method of saving the game states to a file is also pretty neat, in that to avoid backward and forward compatibility issues as more data needs saving, the script identifies properties with a key, and extracts the value from that unique key name. 

123
11
11: Mon Mar 21 22:18:16 2016
0
0
g_PlayerPosX=25519.14453125
g_PlayerPosY=634.99572753906
g_PlayerPosZ=24842.34765625
g_PlayerAngX=9.5199975967407
g_PlayerAngY=-48.649990081787
g_PlayerAngZ=0
g_PlayerHealth=100
g_PlayerLives=3
g_PlayerGunName=modern\magnum357
g_WeaponSlotGot[1]=1
g_WeaponSlotGot[2]=0
g_WeaponSlotGot[3]=0
g_WeaponSlotGot[4]=0
g_WeaponSlotGot[5]=0
g_WeaponSlotGot[6]=0
g_WeaponSlotGot[7]=0
g_WeaponSlotGot[8]=0
g_WeaponSlotGot[9]=0
g_WeaponSlotGot[10]=0

As you can see from the example above, each line represents a property and value, and new properties can be added all the time, but existing properties (perhaps from older files) will still be found and recognized. This way I don't need a header version, and because the data is not in a binary block, it's good for debugging as I continue to work on it.  Of course, you can imagine some smarty pants will figure out how to open the game progress file and give themselves some more health/lives/ammo but I have no immediate objection to that for a first version.  I think a few more days and I should be able to save the state of all the example games that come with GameGuru, and of course the new Easter Game too!