The World format uses a BTDB database as a container. It uses a Key Size of 5, and the Database Signature should be "WRLDBV1.1".

This format is used for each planet you visit as well as for your ship in orbit.

World Metadata

The World Metadata is stored in the database with a Key of [0,0,0,0,0].

Uint32World Width
Uint32World Height
PackedMetadata Length
Metadata
Uint32Version
FloatSpawn X
FloatSpawn Y
PlanetPlanet
WorldStructureStructure
PackedNumber of Settings
Settings[*]
StringKey
VariantValue

World Tiles

The World Tiles are stored in the database with a Key of [1,XH,XL,YH,YL].

XH
High byte of Sector X
XL
Low byte of Sector X
YH
High byte of Sector Y
YL
Low byte of Sector Y

Each database block contians a 32x32 array of tiles. So to get the block that contains the information for the tile at [9000,500], you'd use a Key of [1,0x01,0x19,0x00,0x0f].

The database block returned is then zlib compressed using the deflate algorithm (so use inflate to decompress it).

Then the uncompressed block has the following format:

PackedVersion
PackedGeneration Level
Tile[32*32]Tiles

Generation Level
1 - Base Tiles
2 - Tile Features
3 - Entities