The WMP format

Gamestudio WMP files are similar to Quake® or Half-Life® MAP files. They are plain text files that contain the description of the convex shapes (blocks or brushes) that make up the geometry of a BSP tree based level.

Block format

A block in a WMP file has the following structure:

block 5 {		// sequential number of blocks
	vertices 8	// number of vertices
	faces 6		// number of faces
	5 -5 40   5 -5 -40   5 5 40  // XYZ coordinates of the vertices
	5 5 -40   -5 -5 40   -5 -5 -40
	-5 5 40   -5 5 -40
	4  1 0 2 3 : heavymetal ( 0 1 0 0 ) ( 0 0 -1 0 ) 0 0 0 1 1 : 0000 0 50 ndef  // face 1
	4  0 1 5 4 : heavymetal ( 1 0 0 0 ) ( 0 0 -1 0 ) 0 0 0 1 1 : 0000 0 50 ndef  // face 2
	4  4 5 7 6 : heavymetal ( 0 1 0 0 ) ( 0 0 -1 0 ) 0 0 0 1 1 : 0000 0 50 ndef  // face 3
	4  3 2 6 7 : heavymetal ( 1 0 0 0 ) ( 0 0 -1 0 ) 0 0 0 1 1 : 0000 0 50 ndef  // face 4
	4  2 0 4 6 : heavymetal ( 1 0 0 0 ) ( 0 -1 0 0 ) 0 0 0 1 1 : 0000 0 50 ndef  // face 5
	4  1 3 7 5 : heavymetal ( 1 0 0 0 ) ( 0 -1 0 0 ) 0 0 0 1 1 : 0000 0 50 ndef  // face 6
	{
		0000 // block flags (0000 for unlocked, 00000000000000010000000000000000 for locked textures)
		ndef // block function (normally ndef)
		5    // block index number
	}
}

Structure of a block face:

4  1 0 2 3 : defaulttex ( 1 0 0 -96 ) ( 0 -1 0 -64 ) 0 32 15 1 1 : 00 0 50 ndef


4        // number of vertices for this face
1 0 2 3: // index numbers of the 4 vertices
( 1 0 0 -96 ) ( 0 -1 0 -64 ) // texture vectors t1 and t2
0 32     // x, y offsets in texels
15       // rotation angle in degrees
1 1      // x, y scale factors

Without any transformation, the offset, rotation, and scale values are at 0 0 0 1 1.
WED calculates the texture vectors from them.

After ':' there's a binary 32 bit value of surface flags
bit 0 is set when it's a non-shaded surface
bits 1,2,3 - flat, sky, water flags
bits 13,14 - smooth and mirror flags
bits 16..23 - user flags 1..8

0 50 // ambient and albedo of the texture
ndef // material of the texture (normally ndef) 

The texture vectors t1 and t2 are used for calculating the texture u v coordinates depending on the x y z position of a texel. The following formula is used:

u = t11 * x + t12 * y + t13 * z + t14
v = t21 * x + t22 * y + t23 * z + t24

Therefore with the above example vectors t1 = ( 1 0 0 -96 ) and t2 = ( 0 -1 0 -64 ), the texture formula resolves to:

u = x - 96
v = -y - 64

Entity format

There are 6 types of objects in a WMP file. Objects have sequential numbers. First, the level itself:

level 0 {			// sequential number of objects
 <office.$$w> 	// the WAD file used
 <palette.pcx>	// the level palette
 30				// the sun angles
 45
 35
 <OFFICE.wdl>		// the level script
 100.00 100.00 100.00	// the sun color
 18.82 18.820 100.00	// the ambient color
 100.00 17.64 18.82	// the 4 fog colors
 0.00 0.00 0.00
 31.37 27.45 27.45
 13.72 13.72 13.72
}

A camera position, that only contains a name and possibly an angle:

start 1 {
 pos_001
}

A light source and a sound source:

light 2 {
 78.82 78.82 39.21 300 // the light color and range
}

sound 3 {
 <WATER.WAV>	// sound file, wav or ogg
 0001			// sound flags (normally 1)
 20 0 1 1900	// sound volume, pitch, time, and range
}

An entity:

model 4 { 
 1 1 1		// scale
 <lift1.wmb>	// file
 lift1_mdl_008	// name
 elevator		// entity action
 0 0 300 0 3 32 0 0	// skills
 0000			// flags
 10			// ambient
 50			// albedo
 ndef
 ndef
}

A path:

path 5 { 
 path_001	// name
 9		// number of nodes
 45		// number of data triplets in the following list
 0 0 0	// xyz positions of the nodes
 -156.000031 -47.000023 -0.000001
 -258.000031 14.999981 -0.000012
 -303.000031 224.000015 -0.000003
 -422.000061 272.999817 -0.000054
 -494.000031 338.999969 -0.000062
 -494.000061 729 -0.000062
 -379.000061 892 -0.00006
 -8.000052 894 -0.00006
 0 0 0 0 0 0	// 6 skill values per node
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 0 0 0 0 0 0
 1 2 1 0 0 0	// list of edges: node number, direction, 3 edge skills
 2 3 1 0 0 0
 3 4 1 0 0 0
 4 5 1 0 0 0
 5 6 1 0 0 0
 6 7 1 0 0 0
 7 8 1 0 0 0
 8 9 1 0 0 0
 9 1 1 0 0 0
}

Group format

All objects belong to groups. Groups contain the position, angle, scale, and a list of their objects or sub-groups:

object 25 {	// sequential number of groups
 (-85 68.00 35.99) (0 0 0) (1 1 1)	// position, angles, scale
 object 26, 27, 33	// sub-groups
 block 13, 17			// blocks belonging to the group
 model 4				// an entity belonging to the group
 light 8, 19			// 2 lights belonging to the group
}

The $$M format

For compiling a map to the lightmapped BSP tree, WED converts the WMP to a temporary $$M format, which is then sent to the level compiler wwmp2wmb.exe. All textures of the level, from WAD files or external folders, are also convertes to a temporary $$W WAD file. $$M and $$W files can be read by WED in order to recover the level (although without groups) in the case that all other level files and textures are lost.

The $$M file has basically the same content as the WMP file, with the exception that the groups are resolved to the final positions, angles, and scales of the objects. A $$M block:

{ // 1		// sequential block number
 vertices 8
 faces 6
 79 -6.99994 47.999981 79 -6.99994 19.999981 79 7.00006 47.999981	// final positions after resolving the group hierarchy
 79 7.00006 19.999981 74 -6.99994 47.999981 74 -6.99994 19.999981
 74 7.00006 47.999981 74 7.00006 19.999981
 4 1 0 2 3 : brownwood ( 0 1 0 0 ) ( 0 0 -1 0 ) : 0000 0 50 ndef // angles, offsets and scale are converted to texture vectors
 4 0 1 5 4 : brownwood ( 1 0 0 0 ) ( 0 0 -1 0 ) : 0000 0 50 ndef
 4 4 5 7 6 : brownwood ( 0 1 0 0 ) ( 0 0 -1 0 ) : 0000 0 50 ndef
 4 3 2 6 7 : brownwood ( 1 0 0 0 ) ( 0 0 -1 0 ) : 0000 0 50 ndef
 4 2 0 4 6 : brownwood ( 1 0 0 0 ) ( 0 -1 0 0 ) : 0000 0 50 ndef
 4 1 3 7 5 : brownwood ( 1 0 0 0 ) ( 0 -1 0 0 ) : 0000 0 50 ndef
 {
 0000
 ndef
 1
 }
}

The block list is followed by a list of objects. The object type is indicated by a number: 1 = position, 2 = light, 3 = static entity (no skills and action), 4 = sound, 5 = sun angles, 6 = path, and 7 = extended entity (with skills and action).

{
 7						// extended entity
 299 288.000061 66.789551	// final position
 260 0 0					// final angles
 1 1 1					// final scale
 guard.mdl				// file name
 guard_mdl_007			// entity name
 patrol_prog				// action name
 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0	// skills
 00000000000001000000000000000000			// flags
 0						// ambient, albedo
 50
 0						// number of target entity and path, if any
 2
}
► latest version online