School_Project/prototypes/saves_prototypes
2023-02-20 12:37:04 +01:00
..
parser.py finishing prototype 2023-02-20 12:37:04 +01:00
README WIP: prototype for saves 2023-02-14 15:21:43 +01:00

# Prototypes Saves files

This prototype is aiming at defining a structure for saving "map" files.

The objective is to have it quite modular so that if we want to add more level we can easily do so.

Another objective is that theses files are as small as possible without missing information.

## What needs to be saved

We need to have the shape of the map itself and the shape and number of each pieces it is a minimum

I also want to define an header (and maybe a footer) to the file so that it is easier to recover if any corruption occure to a drive
(we all been trough that)

## Method

I would like to save a file as byte so I need to have a bitewise parser. This is the objective of this prototype

## Structure

The map file should have the following structure:
- The file should be named <map_name>.shmap (where shmap stand for shape map)
- The file should start with the ascii characters S, M then S (0x534D53)
- The file should end with the ascii characters S, M then E (0x534D45)
- First we define the map shape
    1) the map should always be a square. the lenght of this square will be the first octet after the header.
    2) next we have s x s (where s is the size of the square) bits (1/0) where
        - 0 represent an empty cell (where we can place a shape)
        - 1 represent a filled cell (where we can't place a shape)
- Next we define the amount of shape for this level with a number on one octet
- Next we define each shapes with the same method defined previously for a map

With all that we should have all that is needed for a level to work... further information could be added later this is just a prototype atm