Version 1 (modified by trac, 16 years ago) ( diff )

--

PMP files store a map's elevation and terrain types for each tile. Each map also has an associated XML file that stores objects on the map (entities and actors) as well as environment information (currently, lighting parameters).

PMP file format (version 4), described in something a bit like C:

Basic types:

  • char = 8-bit character
  • u32 = 32-bit unsigned int
  • u16 = 16-bit unsigned int

All types are stored in little-endian format. Text is always ASCII.

 PMP {
     char magic[4]; // == "PSMP"
     u32 version; // == 4
     u32 data_size; // == filesize-12
     
 
     u32 map_size; // number of patches (16x16 tiles) per side
 
     u16 heightmap[(mapsize*16 + 1)^2]; // (squared, not xor) - vertex heights
 
     u32 num_terrain_textures;
     String terrain_textures[num_terrain_textures]; // filenames (no path), e.g. "cliff1.dds"
 
     Patch patches[mapsize^2];
 }
 
 Patch {
     Tile tiles[16*16];
 }
 
 Tile {
     u16 texture1; // index into terrain_textures[]
     u16 texture2; // index, or 0xFFFF for 'none'
     u32 priority; // ???
 }
 
 String {
     u32 length;
     char data[length]; // not NUL-terminated
 }

Other data is stored in XML format (with a filename matching the PMP's, except with ".pmp" replaced by ".xml"), with the following structure:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <Scenario>
        <Environment>
            <SunColour r="1" g="1" b="1" /> &lt;!-- range 0..1, though out-of-range values are allowed --> 
            <SunElevation angle="0.785398" /> &lt;!-- elevation above horizontal, in radians -->
            <SunRotation angle="4.71239" /> &lt;!-- angle clockwise from positive-z axis (north), in radians -->
            <TerrainAmbientColour r="0" g="0" b="0" />
            <UnitsAmbientColour r="0.4" g="0.4" b="0.4" />
        </Environment>
    
        <Entities>
            <Entity>
                <Template>Name</Template>
                <Player>1</Player> &lt;!-- 0 = gaia, higher numbers for other players -->
                <Position x="1.2" y="3.4" z="5.6" />
                <Orientation angle="1.2" />
            </Entity>
            ...
        </Entities>
    
        <Nonentities>
            <Nonentity>
                <Actor>Name</Actor>
                <Position x="1.2" y="3.4" z="5.6" />
                <Orientation angle="1.2" />
            </Nonentity>
            ...
        </Nonentities>
    </Scenario>

(This structure is not rigidly enforced (e.g. by a DTD) - many elements are optional, to preserve backward compatibility with older map formats. However, it should be generated in this latest version of the format whenever possible.)

Note: See TracWiki for help on using the wiki.