Skip to content

Serialization Design

Rhys Fuller edited this page Apr 5, 2022 · 8 revisions

File Format

  • File will be in binary.
  • File will begin with the string "Civilization209" to prove that it is a proper save file of the game.
  • File will then have an integer representing the current score of the game.
  • File will then have a double representing the game speed.
  • File will then have an integer X representing the number of items in the Entity List.
  • Following that, there will be X sections representing X entities.
    • Section will start with a string identifying the type of entity.
    • Section will then have two doubles representing the location coordinates.
    • Section will then have an integer representing the turn count.
      • For sections representing Mobile Entities, there will then be two doubles representing the current destination coordinates.
      • For sections representing Mobile Entities, there will then be a double representing speed.
      • For sections representing Mobile Entities, there will then be a double representing heading.
        • For Mobile Entity Sections representing Troops, there will be an integer representing health and a character representing nationality.
        • For Mobile Entity Sections representing Projectiles, there will be an integer representing damage.
        • For Mobile Entity Sections representing Weather, there will be a char representing weather type.
      • For sections representing cities, there will be an integer representing the population.
      • For sections representing cities, there will be an double representing incrementation rate.
      • For sections representing cities, there will be a char representing nationality.
      • For sections representing cities, there will be a boolean representing selected.
      • For sections representing cities, there will be a double representing fire rate.

Sample File

Links to Relevant Code

Clone this wiki locally