Skip to main content

MAZ field reference

File page · Format catalogue · Schema source

This page is generated from the Kaitai schema MAZ.ksy each time the site is built. The schema is the authoritative description; statements are established unless marked inferred or unknown, and the evidence is listed on the file page (see the reading guide).

  • Schema: Eye of the Beholder II DOS MAZ files
  • Byte order: little-endian
  • Schema license: MIT

Description​

A MAZ file holds the walls of one dungeon level: a 32 × 32 grid of cells, each with one wall-reference byte per side. The level's INF file names the MAZ file it uses and maps each wall reference to its graphics, properties and special action (see INF.ksy). See the format overview.

The file starts with three 16-bit words, taken as the grid width, the grid height and the size of a cell record (inferred); every original file holds 32, 32 and 4, for 6 + 32 × 32 × 4 = 4102 bytes. The game never interprets them: it reads the six header bytes into the first entry of its block table, where the first cell then overwrites width and height and the third word remains as the state word of block [00:00] (see the anomaly). The order of width and height therefore has no effect, and their signedness is unknown.

The game clears its block table, then reads exactly 4096 bytes of cells after the header and copies the 1024 records in order into the table; a grid of another size does not fit this reading. The results of the reads are not checked: with a shorter file, the missing cells would keep the previous contents of the read buffer (inferred). For a level that already has a record in LEVELS.TMP, a level visited before, the block table is restored from that record instead of the MAZ file.

Cell i is at column i mod 32 and row i div 32, counted from zero; row 0 is the northern edge and column 0 the western edge. Byte s of a cell is its side facing direction s: 0 north, 1 east, 2 south, 3 west (see /eob2/enums/DIRECTION).

The valid constraints describe the 32 × 32 × 4 profile this schema supports, not a check made by the game. Bytes after the cells, absent from the original files, are kept as raw data. The schema covers the DOS version of EOB II only; "every original file" means LEVEL1.MAZ to LEVEL15.MAZ.

File structure​

FieldTypeSize, repetition and constraints
widthu2must equal 32
heightu2must equal 32
cell_sizeu2must equal 4
cellscellrepeated width * height times
trailing_unknownbytes to end of stream—

width

Width of the grid in cells (inferred); 32 in every original file. The game never reads it: the first cell overwrites it in memory.

height

Height of the grid in cells (inferred); 32 in every original file. The game never reads it: the first cell overwrites it in memory.

cell_size

Size in bytes of a cell record (inferred), matching the four wall references of a cell; 4 in every original file. The game never reads it as a size: the word remains as the state word of block [00:00], where 4 reads as four occupants (/eob2/structures/LEVEL_BLOCK_RUNTIME#anomaly-map-header).

cells

The 1024 cells of the grid, in block order: record i is the cell at column i mod 32, row i div 32, the same split the game uses for the distance between blocks.

trailing_unknown

Bytes after the cells, kept verbatim; the game does not read them. Empty in every original file; their meaning, if any, is unknown.

Type cell​

FieldTypeSize, repetition and constraints
wall_bytes4 bytes—

wall_bytes

The four wall references of the cell, one per side: byte s is the side facing direction s (north, east, south, west; see /eob2/enums/DIRECTION). What each value looks like and lets through comes from the level's INF wall mappings, except for the references the game treats specially (/eob2/enums/SPECIAL_WALL_REFERENCE).