-
Notifications
You must be signed in to change notification settings - Fork 0
Serialization Design
PaulAlger05 edited this page Apr 17, 2022
·
27 revisions
The file format we will use for saving the state of the game and all it's components will be a binary file.
Each object will have it's own serialize/deserialize method to read/write data from/to a binary file.
Note: The world instance will have save/load methods that call the player serialize methods and the level serialize methods. Which will recursively call every objects serialize method as needed to save an entire game state.
The binary file will be saved with the following format/order:
currentLevel
difficulty
playerInventory
playerEquippedItem
playerArmor
Strength
Speed
Health
levelNumber
totalEnemies
currentScreen
currentRow
currentCol
screens
entitiesOnScreen
entityCoords
entityType
entityHealth
grid
location
screenLeft
screenRight
screenUp
screenDown
Where each variable corresponds to the variables of the object:
Ex.
- currentLevel = The world's currentLevel variable (int)
- totalEnemies = the currentLevel's totalEnemies variable (int)
- screens = the list of screens the level has (Screen[][])
and so on...
Save/load file implementations
2022/04/12 Ethan Collins Recommended adjustments:
- Note the use of planned recursive serialization for objects with instance variables of other objects.