PMF

Table of contents


Format

  • Current version is 0.0
  • File extension is .pmf
  • Data is little endian
  • LZ4F is used for compression
TypeDescription
HeaderFile header
DataMap data

TypeValueDescription
char[3]{'P', 'M', 'F'}Header magic
u80Major version
u64Creation time as a UTC Unix timestamp
char[1...]{..., 0}Name
char[1...]{..., 0}Description
char[1...]{..., 0}Authors
char[1...]{..., 0}Compiler info
u80..32Gamemode count
char[1..16] × “Gamemode count”{..., 0}Gamemode names

Data

TypeValueDescription
u32String table size
char × “String table size”String table
u32Embedded resource archive size
u8 × “Embedded resource archive size”PAF archiveEmbedded resources
u16Extension count
u32 × “Extension count”Extension sizes
Extension × “Extension count”Extensions
u8Level count
u32 × “Level count”Level data sizes
Level data × “Level count”Levels
u32Global entity count
Entity × “Global entity count”Global entities

Level data

TypeValueDescription
u8Level flagsFlags
u32Size of compressed common data
u32Size of compressed client data
u32Size of compressed server data
u32Size of decompressed common data
u32Size of decompressed client data
u32Size of decompressed server data
u8 × “Size of decompressed common data”Common level dataCommon data
u8 × “Size of decompressed client data”Client level dataClient data
u8 × “Size of decompressed server data”Server level dataServer data
u8Sector size (2n)
u32Level sector countSector count
Sector indexCenter sector
Level sector sizes × 1…Sector data sizes (ordered by [Y][X][Z])
Level sector data × 1…Sector data (ordered by [Y][X][Z])
Level flags
Bits (MSB to LSB)ValueDescription
7..30Reserved
2Keep players’ velocity
1Keep players’ sector offset
0Keep players’ in-sector offset
Level sector count
Bits (MSB to LSB)Description
31..24Sector Y count minus 1
23..12Sector X count minus 1
11..0Sector Z count minus 1
Level sector sizes
TypeDescription
u32Size of compressed common sector data
u32Size of compressed client sector data
u32Size of compressed server sector data
u32Size of decompressed common sector data
u32Size of decompressed client sector data
u32Size of decompressed server sector data
Level sector data
TypeValueDescription
u8 × “Size of compressed common sector data” in respective Level sector sizesCompressed Common sector dataCommon sector data
u8 × “Size of compressed client sector data” in respective Level sector sizesCompressed Client sector dataClient sector data
u8 × “Size of compressed server sector data” in respective Level sector sizesCompressed Server sector dataServer sector data

Sector index

TypeValueDescription
u32Sector index bitsSector index
Sector index bits
Bits (MSB to LSB)Description
31..24Y
23..12X
11..0Z

Common level data

TypeDescription
u32String table size
char × “String table size”String table
u16Material count
Material × “Material count”Materials
u16Physics material count
Physics material × “Physics material count”Physics materials
StringAir physics material
u8Weather environment count
Weather environment × “Weather environment count”Weather environments
u8Gravity environment count
Gravity environment × “Gravity environment count”Gravity environments
StringDefault weather environment
StringDefault gravity environment

Client level data

TypeDescription
u32String table size
char × “String table size”String table
u8Sound environment count
Sound environment × “Sound environment count”Sound environments
u8Sky environment count
Sky environment × “Sky environment count”Sky environments
StringDefault sound environment
StringDefault sky environment
Client-side material × “Material count” in Common level dataClient-side materials

Server level data

TypeDescription
u32String table size
char × “String table size”String table
u32Level-wide entity count
Entity × “Level-wide entity count”Level-wide entities

Sound environment

TypeDescription
StringName
floatLow pass filter amount
floatHigh pass filter amount
floatReverb delay
floatReverb feedback
floatReverb mix
floatReverb low pass filter amount
floatReverb high pass filter ammount

Weather environment

TypeDescription
StringName
float[3]XYZ wind direction and velocity
u32Wind direction random seed
float[3]XYZ wind direction randomness
floatWind direction noise speed
u32Wind velocity random seed
floatWind velocity randomness
floatWind velocity noise speed

Sky environment

TypeValueDescription
StringName 
u8Sky environment flagsFlags
String+X skybox material
String+Y skybox material
String+Z skybox material
String-X skybox material
String-Y skybox material
String-Z skybox material
StringTop cloud layer material
StringBottom cloud layer material
Sector index3D skybox sector
Sky environment flags
Bits (MSB to LSB)ValueDescription
7..10Reserved
03D skybox

Gravity environment

TypeDescription
StringName
float[3]XYZ gravity

Common sector data

TypeValueDescription
u32String table size
char × “String table size”String table
u8Used material count
String × “Used material count”Used material names
u8Used physics material count
String × “Used physics material count”Used physics material names
u8Weather environment region count
Environment region × “Weather environment region count”Weather environment regions
u8Gravity environment region count
Environment region × “Gravity environment region count”Gravity environment regions
u8Dynamic light count
Dynamic light × “Dynamic light count”Dynamic lights
u8Fast light count
Fast light × “Fast light count”Fast lights
u321…Cube count
Cube × “Cube count”Cubes

Client sector data

TypeDescription
u8Sound environment region count
Environment region × “Sound environment region count”Sound environment regions
u8Sky environment region count
Environment region × “Sky environment region count”Sky environment regions
u8Lightmap count
Lightmap × “Lightmap count”Lightmaps
u32Vertex count
Vertex × “Vertex count”Vertex data
Client-side dynamic light × “Dynamic light count” in respective Common sector dataClient-side dynamic light data
Client-side fast light × “Fast light count” in respective Common sector dataClient-side fast light data
Client-side cube × “Cube count” in respective Common sector dataClient-side cube data

Server sector data

TypeDescription
u32String table size
char × “String table size”String table
u8Load region count
Region × “Region count”Load region data
Server-side cube × “Cube count” in respective Common sector dataServer-side cube data
u32Sector entity count
Entity × “Sector entity count”Sector entities

Region

TypeDescription
float[3](+X, +Y, +Z) corner
float[3](-X, -Y, -Z) corner
u32Other active sector count
Sector index × “Other active sector count”Sector indices

Environment region

TypeDescription
float[3](+X, +Y, +Z) corner
float[3](-X, +Y, +Z) corner
float[3](+X, +Y, -Z) corner
float[3](-X, +Y, -Z) corner
float[3](+X, -Y, +Z) corner
float[3](-X, -Y, +Z) corner
float[3](+X, -Y, -Z) corner
float[3](-X, -Y, -Z) corner
StringEnvironment name

Material

TypeValueDescription
StringName
StringUser-defined type
u8Material flagsFlags
u8Material render modeRender mode
Material flags
Bits (MSB to LSB)ValueDescription
7..20Reserved
1Is liquid
0Is transparent
Material render mode
NameValue
ENTMAT_RENDMODE_NORMAL0
ENTMAT_RENDMODE_ADD1

Client-side material

TypeDescription
StringTexture (untextured if empty)
u8Extra texture count
String × “Extra texture count”Extra textures
u32Texture advance time in microseconds
float[2]Texture UV scroll
u8[3]RGB color
u8Alpha (ignored unless ‘Is transparent’ flag is set)
u8[3]RGB emission
u8Shading
Client-side material wave infoWave info (ignored unless ‘Is liquid’ flag is set)
Client-side material wave info
TypeDescription
float[3]XYZ velocity
floatWind influence
floatOffset
floatScale

Physics material

TypeValueDescription
StringName
u8Physics material flagsFlags
floatFriction (if ‘not solid’ flag is not set) or max speed (if ‘not solid’ flag is set)
floatTraction (ignored if ‘not solid’ flag is set)
floatBounce (ignored if ‘not solid’ flag is set)
floatMinimum speed to cause damage
floatBase damage
floatExtra damage per meter per second
Physics material flags
Bits (MSB to LSB)ValueDescription
7..10Reserved
0Not solid

Lightmap

TypeDescription
u8Size (2n)
u8[3] × 2“Size”RGB luxels

Vertex

TypeDescription
float[3]XYZ
float[2]Texture UV
float[2]Lightmap UV

Dynamic light

TypeValueDescription
u8Dynamic light flagsFlags
u32Global ID
Dynamic light flags
Bits (MSB to LSB)ValueDescription
7..20Reserved
1Preserve
0Enable

Client-side dynamic light

TypeDescription
u8[3]RGB color
u8Affected lightmap count
Client-side dynamic light lightmap layer × “Affected lightmap count”Lightmap layers
Client-side dynamic light lightmap layer
TypeDescription
u8Target lightmap
u8[3] × 2“Size” in respective LightmapRGB luxels

Fast light

TypeValueDescription
u8Fast light flagsFlags
u8Initial intensity
u32Global ID
Fast light flags
Bits (MSB to LSB)ValueDescription
7..20Reserved
1Preserve
0Enable

Client-side fast light

TypeDescription
u8[3]RGB color
u32Range count
Client-side fast light vertex range × “Range count”Ranges
Client-side fast light vertex range
TypeDescription
u32Vertices to skip
u32Multiplier count
u8 × “Multiplier count”Multipliers

Cube

TypeValueDescription
u8Cube flags and typeFlags and type
Cube chunk data × 0..1Chunk data (only present if ‘has chunk data’ flag is set)
Parent cube data, Geometry cube data, or Extended geometry cube data’ × 0..1Cube data (dependent on cube type, not present if type is PMF_CUBE_EMPTY)
Cube flags and type
Bits (MSB to LSB)ValueDescription
70Reserved
6Has pathfinding data
5Has lighting data
4Has chunk data
3Is extended client-side
2Is extended
1..0Cube typeType
Cube type
NameValue
PMF_CUBE_EMPTY0
PMF_CUBE_PARENT1
PMF_CUBE_GEOMETRY2
PMF_CUBE_EXTGEOMETRY3

Client-side cube

TypeDescription
Cube lighting data × 0..1Lighting data (only present if ‘has lighting data’ flag is set)
Client-side geometry cube data or Client-side extended geometry cube data’ × 0..1Client-side Cube data (dependent on cube type, only present if type is PMF_CUBE_GEOMETRY or PMF_CUBE_EXTGEOMETRY)

Server-side cube

TypeDescription
Cube pathfinding data × 0..1Pathfinding data (only present if ‘has pathfinding data’ flag is set)

Parent cube data

TypeValueDescription
u8Parent cube flagsFlags
u32 × 0..1(+X, +Y, +Z) child index (only present if ‘has (+X, +Y, +Z) child’ flag is set)
u32 × 0..1(-X, +Y, +Z) child index (only present if ‘has (-X, +Y, +Z) child’ flag is set)
u32 × 0..1(+X, +Y, -Z) child index (only present if ‘has (+X, +Y, -Z) child’ flag is set)
u32 × 0..1(-X, +Y, -Z) child index (only present if ‘has (-X, +Y, -Z) child’ flag is set)
u32 × 0..1(+X, -Y, +Z) child index (only present if ‘has (+X, -Y, +Z) child’ flag is set)
u32 × 0..1(-X, -Y, +Z) child index (only present if ‘has (-X, -Y, +Z) child’ flag is set)
u32 × 0..1(+X, -Y, -Z) child index (only present if ‘has (+X, -Y, -Z) child’ flag is set)
u32 × 0..1(-X, -Y, -Z) child index (only present if ‘has (-X, -Y, -Z) child’ flag is set)
Parent cube flags
Bits (MSB to LSB)Description
7Has (-X, -Y, -Z) child
6Has (+X, -Y, -Z) child
5Has (-X, -Y, +Z) child
4Has (+X, -Y, +Z) child
3Has (-X, +Y, -Z) child
2Has (+X, +Y, -Z) child
1Has (-X, +Y, +Z) child
0Has (+X, +Y, +Z) child

Geometry cube data

TypeDescription
u8Material
u8Physics material

Client-side geometry cube data

TypeValueDescription
u8Lightmap
u8Client-side geometry cube face bits‘Has face’ bits
u32Index of first quad’s first vertex
Client-side geometry cube face bits
Bits (MSB to LSB)ValueDescription
7..60Reserved
5-Z has face
4-Y has face
3-X has face
2+Z has face
1+Y has face
0+X has face

Extended geometry cube data

TypeValueDescription
u8+X material
u8+Y material
u8+Z material
u8-X material
u8-Y material
u8-Z material
u8+X physics material
u8+Y physics material
u8+Z physics material
u8-X physics material
u8-Y physics material
u8-Z physics material
u8Extended geometry cube point bits‘Point moved’ bits
float[3] × 0..1(+X, +Y, +Z) XYZ (only present if ‘(+X, +Y, +Z) point moved’ flag is set)
float[3] × 0..1(-X, +Y, +Z) XYZ (only present if ‘(-X, +Y, +Z) point moved’ flag is set)
float[3] × 0..1(+X, +Y, -Z) XYZ (only present if ‘(+X, +Y, -Z) point moved’ flag is set)
float[3] × 0..1(-X, +Y, -Z) XYZ (only present if ‘(-X, +Y, -Z) point moved’ flag is set)
float[3] × 0..1(+X, -Y, +Z) XYZ (only present if ‘(+X, -Y, +Z) point moved’ flag is set)
float[3] × 0..1(-X, -Y, +Z) XYZ (only present if ‘(-X, -Y, +Z) point moved’ flag is set)
float[3] × 0..1(+X, -Y, -Z) XYZ (only present if ‘(+X, -Y, -Z) point moved’ flag is set)
float[3] × 0..1(-X, -Y, -Z) XYZ (only present if ‘(-X, -Y, -Z) point moved’ flag is set)
Extended geometry cube point bits
Bits (MSB to LSB)Description
7(-X, -Y, -Z) point moved
6(+X, -Y, -Z) point moved
5(-X, -Y, +Z) point moved
4(+X, -Y, +Z) point moved
3(-X, +Y, -Z) point moved
2(+X, +Y, -Z) point moved
1(-X, +Y, +Z) point moved
0(+X, +Y, +Z) point moved

Client-side extended geometry cube data

TypeDescription
u8+X lightmap
u8+Y lightmap
u8+Z lightmap
u8-X lightmap
u8-Y lightmap
u8-Z lightmap
u8+X triangle count
u8+Y triangle count
u8+Z triangle count
u8-X triangle count
u8-Y triangle count
u8-Z triangle count
u32Index of first triangle’s first vertex

Cube chunk data

TypeDescription
u32Other visible cube count
u32 × “Other visible cube count”Visible cube indices
u32Other visible sector count
Cube chunk data visibility data × “Other visible sector count”Cube chunk data visibility data
Cube chunk data visibility data
TypeDescription
Sector indexSector
u32Visible cube count (0 means all)
u32 × “Visible cube count”Cube indices

Cube lighting data

TypeDescription
u8[3]Base light RGB color
u8Dynamic light count
Cube lighting data light reference × “Dynamic light count”Dynamic light references
u8Fast light count
Cube lighting data light reference × “Fast light count”Fast light references
Cube lighting data light reference
TypeDescription
u8Index
u8Amount

Cube pathfinding data

TypeDescription
u8Attribute count
Cube pathfinding data attribute × “Attribute count”Attributes
Cube pathfinding data attribute
TypeDescription
StringName
float[3]XYZ direction to face

String

TypeDescription
u32Offset in respective string table