-
Notifications
You must be signed in to change notification settings - Fork 1
Serialization Design
Isaac Abrahamson edited this page Dec 6, 2018
·
7 revisions
The GameApp class will contain methods called Save(), Load(), Serialize(), and Deserialize(). Serialize will convert data into string. Save method will call this and output to a file. Load will read the data from file and call Deserialize on it. Deserialize will call the appropriate functionality for each object to be modified.
The data will be stored in a textfile in the game's appdata directory. The data file will have the following format:
Hardcore
Time Remaining
Player
Enemies
Pickups
Each object in a list will be separated by semicolons ;. Each data value inside an object that is serialized will be separated by commas ,.
Example file:
False
2942
Tank,Royale_Platformer.Model.WeaponPistol,False,5,10,20,20.29604,15.46927,0
Support,Royale_Platformer.Model.WeaponKnife,False,4,5,0,35.09962,1.494563,0;Support,Royale_Platformer.Model.WeaponKnife,False,5,5,0,6.400981,16.4862,0;Tank,Royale_Platformer.Model.WeaponPistol,False,5,5,20,29.12477,11.49539,0;Tank,Royale_Platformer.Model.WeaponPistolShield,True,5,5,50,39.12472,8.504682,0;Gunner,Royale_Platformer.Model.WeaponAR,False,5,5,20,34.54378,1.497251,0;
Royale_Platformer.Model.PickupWeaponUpgrade,3.5,1.5,0;Royale_Platformer.Model.PickupWeaponUpgrade,4.5,10.5,0;Royale_Platformer.Model.PickupWeaponUpgrade,7.5,2.5,0;Royale_Platformer.Model.PickupWeaponUpgrade,8.5,10.5,0;Royale_Platformer.Model.PickupWeaponUpgrade,25.5,2.5,0;Royale_Platformer.Model.PickupWeaponUpgrade,48.5,10.5,0;Royale_Platformer.Model.PickupArmor,18.5,2.5,0;Royale_Platformer.Model.PickupArmor,21.5,12.5,0;Royale_Platformer.Model.PickupArmor,22.5,3.5,0;Royale_Platformer.Model.PickupArmor,24.5,2.5,0;Royale_Platformer.Model.PickupArmor,30.5,2.5,0;Royale_Platformer.Model.PickupArmor,32.5,2.5,0;Royale_Platformer.Model.PickupArmor,35.5,11.5,0;Royale_Platformer.Model.PickupArmor,40.5,4.5,0;
Unit tests are not up-to-date with the latest serialize approach.