This is an old revision of the document!
What is MDF?
MDF stands for Mars Data Format. It's a JSON-esque file format that's used to define almost all user-accessible data for the Mars Engine. They are used for .mdf
files, which are normally used to define objects and data found in the Definitions
directory, but are also used by the .m3d
file format, which is used to define 3D models, and the .map
format, which contains levels for the game.
Properties
A property is any string of characters, called the Name, followed by an =
sign, and then some further text, called the Value. The Name specifies which property is being set, while the value specifies the data for that property. Names generally aren't arbitrary, as the engine will be expecting specific Names in order for the values to be passed into the engine correctly.
Name and Value must be made out of Valid Identifier Characters, or be surrounded by double quote marks.
Name = Value Name = "Value"
Valid Identifier Characters
Names and Values can only contain these characters (Excluding spaces):
A-Z a-z 0-9 _!+-.
Optionally, you can also surround the Name or Value with double quotes to include otherwise illegal characters, such as spaces, colons, and so on.
✅ ThisIsAValidIdentifier ❌ This is NOT a valid identifier ❌ This:is, ALSO not a valid * identifier ✅ "This is a valid identifier, now with spaces and commas!"
You can also escape quotes if needed in the identifier.
"This identifier has \"escaped\" double quotes in it!"
Elements
An MDF is made up of sections collectively referred to as Elements. There are three major types of element; Values, Chunks, and Arrays.
Value
A *Value* element is just a string of characters that will be assigned to the property.
MyValue = "This is MyValue!"
Chunk
TODO
Array
TODO