Alpha Map Format

Alpha worlds consist of several files, all held together in one folder under a very rigid directory structure.

= Level =

The level is a file called "level.dat" in the root of the world.

= Chunks =

Chunks are stored in folders inside the world corresponding to their coordinates in base-36. The path is "//c...dat", where  is the base-36 representation of the X coordinate of the chunk AND'd bitwise with 63.

For example, if we have the chunk coordinate (39, -13), we end up with the path 13/1f/c.13.-d.dat

The main world is stored in the root directory of the world. The Nether is stored in the "DIM-1" folder in the root and uses the same chunk folder system.

The Base-36 Algorithm
To retrieve the base-36 representation of a number, use the digits "0123456789abcdefghijklmnopqrstuvwxyz", and prefix the result with a hyphen ("-") if the number is negative.

Example code in Python, from Beta:

def base36(i): """    Return the string representation of i in base 36, using lowercase letters.     """ letters = "0123456789abcdefghijklmnopqrstuvwxyz" if i < 0: i = -i signed = True elif i == 0: return "0" else: signed = False s = "" while i:        i, digit = divmod(i, 36) s = letters[digit] + s    if signed: s = "-" + s    return s

Example code in C#:

= Players =

Persistent data for players is stored in a folder called "players". Each player has a file called " .dat".

Beta player files
Player files are NBT encoded.

The file starts with a nameless TAG_Compound which contains all other data.

Inventory items are in the TAG_Compound format with the following tags:

Other formats
The following format is not used in Beta. May be the Alpha format.

= Map Generation =

There are several approaches to map generation.

Noise
Two-dimensional noise functions can be used to provide a terrain height at certain coordinates.