The .cub file is the startup contract between the map author and the engine.
It provides the mandatory texture paths, floor and ceiling colors, then the 2D
grid that will be validated before any MiniLibX initialization is allowed.
A valid .cub file contains three logical blocks:
- texture headers:
NO, SO, WE, EA
- color headers:
F, C
- map body: the 2D grid consumed by validation, collision, and raycasting
All required headers must exist before the runtime can continue.
Texture paths must resolve to readable .xpm files, either as absolute paths
or as paths relative to the .cub file location.
Header order is flexible. The parser accepts NO/SO/WE/EA/F/C in any order as
long as each required identifier appears exactly once before the map block.
Empty lines before the map are allowed and ignored. Once the map begins, every
remaining line is treated as map content until end of file.
The map starts at the first non-empty line that looks like map data. In this
repository, that means a line composed only of accepted map characters from the
shared mandatory/bonus alphabet. From that point forward, trailing
configuration-like text is no longer parsed as headers: it becomes invalid map
content instead.
This page focuses on parser-facing structure rules: headers, duplicates, RGB
syntax, map-start detection, and spawn presence.
Deeper checks such as full enclosure, BFS leak detection, and open-area
validation belong to the dedicated map validation and parsing pipeline pages.