Skip to content

Terrain chunks (MCNK)

A tile's terrain is 256 MapChunk chunks (tile.chunks, indexed y * 16 + x) — the MCNK data, fully decoded: the 9 × 9 + 8 × 8 = 145 height and normal grids, the texture layers with their decoded 64 × 64 alpha maps, the shadow map, the doodad/object references and sound emitters, plus the version-gated vertex colours, baked lighting, terrain materials and legacy liquid. Every field documents once, badged with its MCNK sub-chunk and the expansion range it exists in (a badge-less field is present in every supported version).

chunks binds by reference, and every numeric grid is a zero-copy NumPy view:

import numpy
chunk = tile.chunks[y * 16 + x]
heights = numpy.asarray(chunk.heights)       # 145 floats, writable in place
heights += 5.0                               # raise the whole chunk
alpha = chunk.alpha_maps[1]                  # layer 1's 64x64 blend map (bytes)
Expansions:VanillaTBCWotLKCataMoPWoDLegionBfASLDFTWW

The MapChunk chunk

MapChunk

MapChunk()

A terrain chunk (MCNK), abstract over the client version. Usually obtained from ADT.chunks rather than constructed; the per-version MapChunk* classes are subclasses. Construct a concrete version with MapChunk.for_version(expansion). See https://wowdev.wiki/ADT/v18#MCNK_chunk.

for_version staticmethod

for_version(expansion: Expansion) -> MapChunk⟨version⟩

Construct the concrete MapChunk for a client version — the abstract MapChunk is never instantiated directly. The return type narrows per expansion (a typed overload per Expansion member), so for_version(Expansion.Wotlk) returns a MapChunkWotlk; a runtime Expansion value yields the AnyMapChunk union.

Fields

Header

The MCNK header record (flags, grid position, area, holes).

header property writable MCNK

header: SMChunk

The chunk header (flags, grid position, area, holes, origin).

Surface

The 9 × 9 + 8 × 8 = 145 vertex grids: heights, normals and the version-gated per-vertex colours and baked lighting.

vertex_colors property MCCVWotLK

vertex_colors: list[CImVector]

Per-vertex colors (MCCV, WotLK+): 145 BGRA entries blended onto the terrain (0x7F = neutral).

vertex_lighting property MCLVCata

vertex_lighting: list[CArgb]

Per-vertex baked lighting (MCLV, Cata+): 145 ARGB entries from level-designer omni lights.

heights property MCVT

heights: list[float]

The 9x9 + 8x8 = 145 terrain heights (MCVT), relative to the chunk origin, in the interleaved outer/inner row order.

normals property MCNR

normals: list[MCNREntry]

The 145 terrain normals (MCNR), X Z Y signed bytes.

Texturing

The texture layers with their decoded 64 × 64 alpha maps, the shadow map and the Cata+ terrain materials.

material_ids property MCMTCata

material_ids: list[SMTerrainMaterial]

Per-layer terrain material ids (MCMT, Cata+).

layers property MCLY

layers: list[SMLayer]

The texture layers (MCLY); layer 0 is opaque, later layers blend through their alpha map.

alpha_maps property MCAL

alpha_maps: list[list[int]]

One decoded 64x64 (4096-byte) alpha map per layer, aligned with layers (layer 0's is empty); 0 = base texture, 255 = this layer.

shadow_map property MCSH

shadow_map: list[int]

The decoded 64x64 (4096-byte) shadow map (MCSH), 0/1 per texel; empty when the chunk casts no baked shadow.

References & effects

Which of the tile's placements draw in this chunk, and its sound emitters.

doodad_refs property MCRF

doodad_refs: list[int]

Doodad references (MCRF doodad part pre-Cata, MCRD Cata+): indices into the tile's MDDF placements drawn in this chunk.

object_refs property MCRF

object_refs: list[int]

Object references (MCRF object part pre-Cata, MCRW Cata+): indices into the tile's MODF placements drawn in this chunk.

sound_emitters property MCSE

sound_emitters: list[CWSoundEmitter]

Sound emitters placed in this chunk (MCSE): pre-WotLK versions carry the full 52-byte inline emitter (CWSoundEmitterVanilla), WotLK+ the 28-byte SoundEntriesAdvanced reference (CWSoundEmitter).

Liquid

The legacy per-chunk MCLQ water (superseded by the tile-wide MH2O since Cataclysm — see the entity page's structured liquid).

legacy_liquid property writable MCLQVanillaWotLK

legacy_liquid: MCLQData

The legacy per-chunk liquid (MCLQ, up to and including WotLK).