From 0ea78295882275d106dd8bb5efd336261be4c0d6 Mon Sep 17 00:00:00 2001 From: "Debucquoy Anthony (tonitch)" Date: Sun, 5 Mar 2023 22:50:41 +0100 Subject: [PATCH] Adding Documentation for parser in jdb Signed-off-by: Anthony Debucquoy --- JournalDeBord/src/SUMMARY.md | 6 ++++- JournalDeBord/src/spec/FileParser.md | 38 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 JournalDeBord/src/spec/FileParser.md diff --git a/JournalDeBord/src/SUMMARY.md b/JournalDeBord/src/SUMMARY.md index 7c32410..da89d34 100644 --- a/JournalDeBord/src/SUMMARY.md +++ b/JournalDeBord/src/SUMMARY.md @@ -3,4 +3,8 @@ # Rapports - [Première entrevue](./rapports/130223.md) -- [Deuxième entrevue](./rapports/200223.md) \ No newline at end of file +- [Deuxième entrevue](./rapports/200223.md) + +# Specification + +- [File Parser](./spec/FileParser.md) \ No newline at end of file diff --git a/JournalDeBord/src/spec/FileParser.md b/JournalDeBord/src/spec/FileParser.md new file mode 100644 index 0000000..f34d0bc --- /dev/null +++ b/JournalDeBord/src/spec/FileParser.md @@ -0,0 +1,38 @@ +--- +title: File Parser +author: Debucquoy Anthony (tonitch) +date: 5 March 2023 +--- +# File Parser Specification + +For the Project, I wanted to challenge myself, I decided to do my own file parser with my own specification that would +have the special objective of being really small. + +## The File format + +The file would use the .level file extension. + +The file could contain anything, the used data is enclosed in between an header and a parser. +This could be used to add Music, images and other stuff in the level file for instance + +Only one Header and One Footer should be present in the file. +The parser will only read the first one it finds so to avoid problem, it is best practise to put the +level data at the top of the file. + +- The HEADER will be defined by the characters 'S', 'M', 'S' +- The FOOTER will be defined by the characters 'S', 'M', 'E' +- The bytes in between are the level data + - byte 1: Width of the map + - byte 2: Height of the map + - bytes 3 -> Width * Height (+1 if Width * Height % 8 is not 0) + - byte after Map Data: Pieces amount + - for each pieces + - 1 byte: size of the piece + - 4 first bits : width + - 4 last bits: height + - next bytes -> Width * Height (+1 if Width * Height % 8 is not 0) + +## Known Limitation + +1) by putting the piece size on one byte. We limit the maximum piece size to 15 x 15 (1111 | 1111) +I don't think we will ever need a piece larger than 5x5 so this is clearly a feature, not a bug! :-) \ No newline at end of file