PGE-X File format
PGE-X (PGE Extendable) - Universal and flexible text file format used in the Moondust Project. The main thing of this format - is a marking of values and separating data with data sections.
Sections
Sections - are named data containers which writing with large letters without using digits and spaces. The section should be closed with the same string which began section but with appending of '_END' piece:
DATACONTAINER ... DATACONTAINER_END
Sub Sections
PGE-X Format giving able build the data trees:
DATACONTAINER ... SUBCONTAINER ... SECONDSUBCONTAINER ... SECONDSUBCONTAINER_END SUBCONTAINER_END DATACONTAINER_END
Data Entries
Data entries have two types: structure and plain text.
Plain text
Plain text data entries using whole space of data containers:
DATACONTAINER This is a some example of plain text data entry I think, you understand this style of file format building... DATACONTAINER_END
Structure
Each data entry have each line. Parameters separated with a semicolon “;”. All parameters must have a markers. Marker and value separated by colon “:”. Non-exist markers will be skipped. Not allowing to use parameters without markers. Data-type for each parameter defining by its internal. Data-types closed by its markers. Always possible add new marker with possible to save compatible with old versions. Some valued which equal to default values can be doesn't written into the file to reduce size of target file.
DATACONTAINER VAL1:"test";VAL2:"Meow \:3";VAL3:45; DATACONTAINER_END
Data types syntax example
Data example | Data type |
---|---|
12345 | unsigned int/long |
-31414 | signed int/long |
13.45 | unsigned float/double |
-34.772 | signed float/double |
"Hello world" | string |
H48656c6c6f20776f726c64 | hex encoded string |
[123,54,243,33] | int/long array |
["test", "cat", "dog"] | string array |
0/1 | Boolean |
011011010 | Boolean array |
B12FD24 | Byte-encoded Boolean array |
Escaping of reserved characters
Escape sequence | Description |
---|---|
\n | New line |
\” | Safe Quotes |
\\ | Safe slash |
\; | Semicolon |
\: | colon |
\[ | [ |
\] | ] |
\, | Comma |
\% | Percent |
Implementation
The main implementation that does the use of PGE-X format is PGE File Library which is written in C++ as part of Moondust Project and later was organized as an independent C++ library that can be used for both STL and Qt (with using of Qt specific containers like QString, QList, QVector, etc.). The library is being used also in the LunaLua, SMBX2, and TheXTech projects.
File formats using PGE-X
PGE-X data format is used in data files in Moondust Project.
.LVLX - level file format. (Extended Level file)
Download specification: ODT, PDF
.WLDX - world map file format. (Extended World map file)
Download specification: ODT, PDF
.SAVX - a game-save file format of Moondust Engine.
.LVL.META - an extra meta-data store (primarily, position bookmarks) for legacy SMBX64 LVL files. Doesn't appears when there is no these data used.