Rich Map Format

From Valve Developer Community
Jump to: navigation, search

The Rich Map Format (RMF) is a format that stores raw map data, used by the Valve Hammer Editor up to Version 3.5. The format is used as an alternative to the MAP file format for the Goldsource Engine.

Compared with the Map Format, the Rich Map Format saves VisGroups and arbitrary brush shapes.

Primitive Data Types

All values are stored in little-endian format, least significant byte first.

  • int: 32 bit integer
  • float: 32 bit IEEE floating point
  • byte : 8 bit unsigned integer
  • <type>[n]: fixed length array of <type>
  • <type>[]: variable length array of <type>
  • string(n): fixed length null-terminated char string
  • nstring: variable length null-terminated char string prefixed with length byte (length includes '\0' at end)

Structures

VisGroup (140 bytes)

{
   string(128)     name of vis group
   Color           display color
   byte            ?
   int             index of visgroup (other objects refer to visgroups with this number)
   byte            1=visible, 0=not visible
   byte[3]         ?
}

Vector (12 bytes)

{
   float[3]        x, y and z components, respectively
}

Color (3 bytes)

{
   byte[3]         red, green and blue components, respectively
}

Face

{
   string(256)     texture name
   float           ?
   Vector          texture U axis
   float           texture X shift
   Vector          texture V axis
   float           texture Y shift
   float           texture rotation in degrees
   float           texture X scale factor
   float           texture Y scale factor
   byte[16]        ?
   int             number of vertices
   Vector[]        vertex coordinates in clockwise order looking from front of face
   Vector[3]       3 points defining plane of face (VHE simply uses a copy of the first 3 vertices)
}

=== Solid ===
<pre>
{
   nstring        "CMapSolid"
   int            visgroup
   Color          display color (VHE ignores this if the solid is part of an entity or group)
   byte[4]        ?
   int            number of faces
   Face[]         faces in no particular order
}

Entity

{
   nstring        "CMapEntity"
   int            visgroup
   byte[3]        display color (VHE draws all entities purple regardless of this or any other color value)
   int            number of brushes (0 for point entity)
   Solid[]        entity brushes
   nstring        classname (max length is 128)
   byte[4]        ?
   int            entity flags
   int            number of key/value pairs
   nstring[]      entity key/value pairs (array contains key, value, key value, etc.. max length is 32 for keys and 100 for values)
   byte[14]       ?
   Vector         position of entity in world coordinates (only used for point entities)
   byte[4]        ?
}

Group

{
   nstring        "CMapGroup"
   int            visgroup
   Color          display color (overrides color of any contained solids)
   int            number of objects in group
   Object[]       objects (can contain solids, entities or nested groups!)
}

Corner

{
   Vector         position in world coordinates
   int            index for this corner.. used to generate targetnames (corner01, corner02, etc..)
   string(128)    name override (empty string if not overridden)
   int            number of key/value pairs
   nstring[]      key/value pairs (array contains key, value, key value, etc.)
                  NOTE: these are supposed to be entity properties for the corner but VHE doesn't save them correctly
}

Path

{
   string(128)    path name
   string(128)    path class (should be "path_corner" or "path_track")
   int            path type: 0=one way, 1=circular, 2=ping-pong
   int            number of corners
   Corner[]       corners in the order they appear in the path
}

File Structure

{
   byte[7]        start of every file: CD CC 0C 40 52 4D 46 ("????RMF")
   int            number of vis groups
   VisGroup[]     visgroups
   nstring        "CMapWorld"
   byte[7]        ? (probably visgroup and Color fields but not used by VHE)
   int            number of objects
   Object[]       world brushes, entities and groups
   nstring        classname of worldspawn entity (should be "worldspawn")
   byte[4]        ?
   int            worldspawn entity flags (VHE does not allow you to set any flags for the worldspawn so these are probably unused)
   int            number of worldspawn entity key/value pairs
   nstring[]      worldspawn key/value pairs (standard keys are "classname"="worldspawn", "sounds"="#", "MaxRange"="#", "mapversion"="220")
   byte[12]       ?
   int            number of paths
   Path[]         paths
   string(7)      "DOCINFO"
   byte[?]        ? (usually 13 bytes but not always)
}