This article's documentation is for the "GoldSrc" engine. Click here for more information.

RMF (Rich Map Format)

From Valve Developer Community
(Redirected from .rmf)
Jump to: navigation, search
English (en)Translate (Translate)

The Rich Map Format (RMF) is a binary file format that stores raw map data, used by the Hammer 3.x Valve Hammer Editor up to Version 3.5. The format is used as an alternative to the MAP file format for the GoldSrc Half-Life Engine. The map must still be converted to MAP to be used by map compilers.

Compared with the MAP Format, the Rich Map Format saves VisGroups and stores brushes as sets of vertices, rather than as sets of planes.

Versions

RMF Version Used by Notes
0.8 Worldcraft 1.0a-1.1
0.9 Worldcraft 1.1a
1.4 Worldcraft 1.3
1.6 Worldcraft 1.5b
1.8 Worldcraft 1.6-2.1 Adds support for Quake II Quake II texture flags.
2.2 Worldcraft/Hammer 3.3-3.5, Jack, Sledge
3.70 Hammer 4 Saving an RMF in this format will render it unopenable by JACK!

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

{
   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
}

Camera

{
   Vector         eye position in world coordinates
   Vector         look position in world coordinates
}

File Structure

{
   float          version (usually 2.2): CD CC 0C 40 52 4D 46 ("????RMF")
   string(4)      "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(8)      "DOCINFO"
   float          appears to be a version number for camera data
   int            active camera index
   int            number of cameras
   Camera[]       cameras
}