Author Topic: NeoLemmix Formats - Basics of text-based files  (Read 6838 times)

0 Members and 1 Guest are viewing this topic.

Offline namida

  • Administrator
  • Posts: 12426
    • View Profile
    • NeoLemmix Website
NeoLemmix Formats - Basics of text-based files
« on: August 11, 2019, 08:16:17 PM »
Aside from audio and graphics, NeoLemmix data files are generally text-based. This includes levels, replays, object metainfo - pretty much everything. This means you can open them in a text editor, such as Notepad, and examine or even modify the data in a relatively human-friendly form.

NeoLemmix uses the same basic structure for all such files, except for "settings.ini" and "hotkeys.ini". Compared to some text-based formats like XML or JSON, NeoLemmix's format is fairly simple. As a general rule - if a file's extension is four letters and starts with "NX", it's a text-based data file that this applies to.

Each line of the file consists of a keyword, and optionally, a value. These are separated by a single space (NeoLemmix might handle more correctly, but this is never guaranteed); and any number of spaces may be used at the start of a line (but NOT at the end of a line) for formatting purposes - these extra spaces have no effect on the actual data.

Note that editor versions up to 1.14 do not always obey the "one space between keyword and data" rule. This is being fixed in 1.15.

For example:

Code: (A line with the keyword "EXAMPLE", and no value) [Select]
EXAMPLE
Code: (A line with the keyword "EXAMPLE", and the value "Hello") [Select]
EXAMPLE Hello
Values are never enclosed in quotation marks, even if they contain spaces or any other special characters. Keywords are never case-sensitive, although convention is to write them in uppercase. Values generally aren't case-sensitive either, although there can be cases where case is important (for example, a level title) and will be preserved. Convention is less clear here, and either all-uppercase or all-lowercase is considered acceptable.

Numeric values can either be in decimal or hexidecimal. In the case of hexidecimal, they should be prefixed with an x. Eg: COLOR xFFFFFF.

Lines are not order-sensitive, except in regard to other lines with the same keyword. For example, in a file that lists levels for a pack, there would be multiple lines with the "LEVEL" keyword, and the order of these determine the order of the levels in the pack. But in a level file itself, there would be a "LEMMINGS" line (for the lemming count) and a "REQUIREMENT" line (for the save requirement), and it does not matter which one comes first, because they have different keywords.



In more-complex files, there is a need for grouping data into sections. As an example, a level file would have a section for each terrain piece, a section for each object, etc.

A section is started with a line consisting of a keyword, prefixed with a $ sign. The group is then ended with "$END". It is convention - but not a requirement of the format - to indent the lines inside a group with two spaces. Here's an actual example taken from a level file in Doomsday Lemmings:

Code: (A terrain piece) [Select]
$TERRAIN
  COLLECTION namida_horror
  PIECE clump_04
  X 45
  Y 128
$END

As with lines, groups are order-sensitive with regard to other groups that have the same keyword, but are not order-sensitive with regard to other groups that have a different keyword.



As some last notes, you can include comments in a NeoLemmix text file by putting them on a line beginning with # - as usual, this can have any number of spaces before it. You cannot start a comment mid-line - comments must be on their own line. It is also perfectly acceptable to have some blank lines to break things up - these are simply ignored by NeoLemmix.
« Last Edit: October 02, 2019, 06:30:32 PM by namida »
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)