Skip to main content

Dungeon tiles (VCN)

File formats · Field reference · Schema

In brief​

The 3D view of the dungeon is assembled from small square pieces of graphics. A VCN file is the box of pieces for one dungeon style: hundreds of 8 × 8 pixel blocks, plus two short colour tables. The matching VMP file says which block goes where in the view.

There are five VCN files, one per dungeon style named by the INF files: CRIMSON, DUNG, FOREST, MEZZ and SILVER. Each is stored in a CPS container and must be unpacked first.

From the file Tile sets (VCN) to the game. The file holds, in order: Block count (2 bytes); Backdrop colours (16 bytes); Wall colours (16 bytes); Blocks (32 bytes each). The game: Unpack the CPS container; Keep at most 1,484 blocks; EGA: colour each block once. In memory: Tile blocks and their two colour tables. Used by: Drawing the walls, floor and ceiling.
The game turns it into tile blocks and their two colour tables.

Organization​

PartSizeContents
Block count2 bytesNumber of blocks.
Backdrop colours16 bytesPalette colour for each pixel value of a backdrop block.
Wall colours16 bytesPalette colour for each pixel value of a wall block.
Blocks32 bytes each8 rows of 4 bytes; each byte holds two pixels, the first in the high half.

A pixel is a value from 0 to 15, not a colour: the game turns it into a palette colour through one of the two tables. When a wall block is drawn over a backdrop, a pixel whose wall colour is 0 is skipped, so the backdrop shows through.1 Mirroring a block reverses the order of its pixels.2

Reading the file​

The game loads the tile set that the level's INF file names when it loads the level, and again when a script reloads the wall graphics. It unpacks the CPS container, copies the two colour tables, then the blocks.3 It loads at most the first 47,500 bytes of blocks, 1,484 whole blocks, whatever the count says; the largest file, DUNG.VCN, has 1,474.

How the colour tables are used depends on the display mode. In VGA mode the game picks the table each time it draws a block, as above. In EGA mode it colours every block once, when the level is loaded: with the backdrop colours if the backdrop uses it, otherwise with the wall colours. A pixel of value 0 is then the transparent one. In the Tandy mode the game first passes colours 1 to 15 of both tables through a table of the display driver.3

What it becomes in memory​

The blocks go to a buffer of their own and the two colour tables to a table of the game; in EGA mode the driver keeps the coloured blocks in video memory.32 Only the drawing of the walls, floor and ceiling uses them. Nothing in the game changes the colours of the blocks with distance or light: the view's darkening with distance applies to items and monsters, not to the walls, floor and ceiling.

Example​

The first 18 bytes of FOREST.VCN once unpacked:

offset bytes meaning
0000 8a 03 906 blocks
0002 00 ec eb ed e9 ea e8 ee e7 e3 e5 e6 e4 ef e2 e1 backdrop colours for values 0–15

The wall colours follow at offset 0x12, and the 906 blocks at offset 0x22: 2 + 32 + 906 × 32 = 29,026 bytes, the unpacked size announced by the container. The largest block number used by FOREST.VMP is 905, the last block of this file.

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references (REF-MW-004, REF-SCUMM-006, REF-SCUMM-010).

Footnotes​

  1. Tile compositor. ↩

  2. VCN name, colour tables, colour table fill and VCN colour tables in memory. ↩ ↩2

  3. VCN loader, also run by the special event that reloads the wall graphics, and the VCN block buffer; the display mode; EGA block colouring, EGA block masks and the EGA branch of the tile drawing. ↩ ↩2 ↩3