Skip to content

Serialization Design

EthanCollins02 edited this page Apr 13, 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.
The binary file will be saved with the following format/order:

currentLevel
difficulty
 screens
   entities
 currentScreen
 currentRow
 currentCol
...and so on

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[][])

A small snippet from an example binary file would be the following:

Save/load file implementations

Design Review

2022/04/12 Ethan Collins Recommended adjustments:

  • Note the use of planned recursive serialization for objects with instance variables of other objects.

Clone this wiki locally