MAP Format (Build)

From ModdingWiki
Jump to navigation Jump to search

The MAP Format is used by BUILD games for storing game levels. It is somewhat similar in content (though not structure) to the Doom level format, as both are sector-based. Ken Silverman has written programs to convert Doom maps into BUILD maps.

File format

Version 9

TROR is present in map

Version 8

Limits increased

Limit value
MAXSECTORS 4096
MAXWALLS 16384
MAXSPRITES 16384

Version 7

This is the main map version for commercially released games

Limit value
MAXSECTORS 1024
MAXWALLS 8192
MAXSPRITES 4096
Data type Name Description
INT32LE mapversion File format version number (latest in released games is 7, source ports use 8 and 9)
INT32LE posx Player start point, X coordinate
INT32LE posy Player start point, Y coordinate
INT32LE posz Player start point, Z coordinate
INT16LE ang Player starting angle
INT16LE cursectnum Sector number containing the start point
UINT16LE numsectors Number of sectors in the map
SECTOR[numsectors] sector Information about each sector
UINT16LE numwalls Number of walls in the map
WALL[numwalls] wall Information about each wall
UINT16LE numsprites Number of sprites in the map
SPRITE[numsprites] sprite Information about each sprite

Each SECTOR is defined as the following 40-byte structure:

Data type Name Description
INT16LE wallptr Index to first wall in sector ! Index in what units? count? offset?
INT16LE wallnum Number of walls in sector
INT32LE ceilingz Z-coordinate (height) of ceiling at first point of sector
INT32LE floorz Z-coordinate (height) of floor at first point of sector
INT16LE ceilingstat
  • bit 0: 1 = parallaxing, 0 = not
  • bit 1: 1 = sloped, 0 = not
  • bit 2: 1 = swap x&y, 0 = not
  • bit 3: 1 = double smooshiness
  • bit 4: 1 = x-flip
  • bit 5: 1 = y-flip
  • bit 6: 1 = Align texture to first wall of sector
  • bits 7-15: reserved
INT16LE floorstat
INT16LE ceilingpicnum Ceiling texture (index into ART file)
INT16LE ceilingheinum Slope value (rise/run; 0 = parallel to floor, 4096 = 45 degrees)
INT8 ceilingshade Shade offset
UINT8 ceilingpal Palette lookup table number (0 = standard colours)
UINT8 ceilingxpanning Texture coordinate X-offset for ceiling
UINT8 ceilingypanning Texture coordinate Y-offset for ceiling
INT16LE floorpicnum Floor texture (index into ART file)
INT16LE floorheinum Slope value (rise/run; 0 = parallel to floor, 4096 = 45 degrees)
INT8 floorshade Shade offset
UINT8 floorpal Palette lookup table number (0 = standard colours)
UINT8 floorxpanning Texture coordinate X-offset for floor
UINT8 floorypanning Texture coordinate Y-offset for floor
UINT8 visibility How fast an area changes shade relative to distance
UINT8 filler Padding byte
INT16LE lotag Significance is game-specific (Triggers, etc.)
INT16LE hitag Significance is game-specific (Triggers, etc.)
INT16LE extra Significance is game-specific

The original documents suggest there can be a maximum of 1024 sectors in a map.

Each WALL is defined as the following 32-byte structure:

Data type Name Description
INT32LE x X-coordinate of left side of wall (right side coordinate is obtained from the next wall's left side)
INT32LE y Y-coordinate of left side of wall (right side coordinate is obtained from the next wall's left side)
INT16LE point2 Index to next wall on the right (always in the same sector)
INT16LE nextwall Index to wall on other side of wall (-1 if there is no sector there)
INT16LE nextsector Index to sector on other side of wall (-1 if there is no sector)
INT16LE cstat
  • bit 0: 1 = Blocking wall (use with clipmove, getzrange)
  • bit 1: 1 = bottoms of invisible walls swapped, 0 = not
  • bit 2: 1 = align picture on bottom (for doors), 0 = top
  • bit 3: 1 = x-flipped, 0 = normal
  • bit 4: 1 = masking wall, 0 = not
  • bit 5: 1 = 1-way wall, 0 = not
  • bit 6: 1 = Blocking wall (use with hitscan / cliptype 1)
  • bit 7: 1 = Transluscence, 0 = not
  • bit 8: 1 = y-flipped, 0 = normal
  • bit 9: 1 = Transluscence reversing, 0 = normal
  • bits 10-15: reserved
INT16LE picnum Texture index into ART file
INT16LE overpicnum Texture index into ART file for masked/one-way walls
INT8 shade Shade offset of wall
UINT8 pal Palette lookup table number (0 = standard colours)
UINT8 xrepeat Change pixel size to stretch/shrink textures
UINT8 yrepeat
UINT8 xpanning Offset for aligning textures
UINT8 ypanning
INT16LE lotag Significance is game-specific (Triggers, etc.)
INT16LE hitag Significance is game-specific (Triggers, etc.)
INT16LE extra Significance is game-specific

The original documents suggest there can be a maximum of 8192 walls in a map.

Each SPRITE is defined as the following 44-byte structure:

Data type Name Description
INT32LE x X-coordinate of sprite
INT32LE y Y-coordinate of sprite
INT32LE z Z-coordinate of sprite
INT16LE cstat
  • bit 0: 1 = Blocking sprite (use with clipmove, getzrange)
  • bit 1: 1 = transluscence, 0 = normal
  • bit 2: 1 = x-flipped, 0 = normal
  • bit 3: 1 = y-flipped, 0 = normal
  • bits 5-4: 00 = FACE sprite (default)
    • 01 = WALL sprite (like masked walls)
    • 10 = FLOOR sprite (parallel to ceilings&floors)
  • bit 6: 1 = 1-sided sprite, 0 = normal
  • bit 7: 1 = Real centered centering, 0 = foot center
  • bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1)
  • bit 9: 1 = Transluscence reversing, 0 = normal
  • bits 10-14: reserved
  • bit 15: 1 = Invisible sprite, 0 = not invisible
INT16LE picnum Texture index into ART file
INT8 shade Shade offset of wall
UINT8 pal Palette lookup table number (0 = standard colours)
UINT8 clipdist Size of the movement clipping square (face sprites only)
UINT8 filler
UINT8 xrepeat Change pixel size to stretch/shrink textures
UINT8 yrepeat
INT8 xoffset Centre sprite animations
INT8 yoffset
INT16LE sectnum Current sector of sprite's position
INT16LE statnum Current status of sprite (inactive, monster, bullet, etc.)
INT16LE ang Angle the sprite is facing
INT16LE owner ! ?
INT16LE xvel ! ?
INT16LE yvel ! ?
INT16LE zvel ! ?
INT16LE lotag Significance is game-specific (Triggers, etc.)
INT16LE hitag Significance is game-specific (Triggers, etc.)
INT16LE extra Significance is game-specific

The original documents suggest there can be a maximum of 4096 sprites in a map.

The significance of the lotag, hitag and extra variables is decided by each particular game and can sometimes be discerned from the editing documents for the game in question, if available. lotag and hitag are frequently used to set up trigger actions, for example a lift moving in response to a switch being thrown, but may have other uses as well (the Witchaven games, for instance, use the hitag on monster sprites internally to store the monster's hit point value, overwriting anything set there during map creation.)

Version 6

Version 6 had differently ordered variables, no filler variables, smaller bit flag variables for floors and ceilings, lower precision for slopes and no reverse translucence bit flag. It appears in Witchaven and William Shatner's TekWar. ! (Possibly also Powerslave/Exhumed, confirm.)

The header variables are arranged just like in version 7, but version number will be 6.

Sectors: There is no "filler" value, floorstat/ceilingstat are 8-bit values, and the order of variables is different.

When converting with CONVMAP7, the program will set ceilingheinum or floorheinum to 0 if bit 1 of the corresponding ceilingstat or floorstat of a sector is 0. Otherwise ceilingheinum/floorheinum will be adjusted for higher precision.

Data type Name Description
UINT16LE wallptr Index to first wall in sector ! Index in what units? count? offset?
UINT16LE wallnum Number of walls in sector
INT16LE ceilingpicnum Ceiling texture (index into ART file)
INT16LE floorpicnum Floor texture (index into ART file)
INT16LE ceilingheinum ! Slope value is treated differently in v6
INT16LE floorheinum ! Slope value is treated differently in v6
INT32LE ceilingz Z-coordinate (height) of ceiling at first point of sector
INT32LE floorz Z-coordinate (height) of floor at first point of sector
INT8 ceilingshade Shade offset
INT8 floorshade Shade offset
UINT8 ceilingxpanning Texture coordinate X-offset for ceiling
UINT8 floorxpanning Texture coordinate X-offset for floor
UINT8 ceilingypanning Texture coordinate Y-offset for ceiling
UINT8 floorypanning Texture coordinate Y-offset for floor
UINT8 ceilingstat
  • bit 0: 1 = parallaxing, 0 = not
  • bit 1: 1 = sloped, 0 = not
  • bit 2: 1 = swap x&y, 0 = not
  • bit 3: 1 = double smooshiness
  • bit 4: 1 = x-flip
  • bit 5: 1 = y-flip
  • bit 6: 1 = Align texture to first wall of sector
  • bit 7: reserved
UINT8 floorstat
UINT8 ceilingpal Palette lookup table number (0 = standard colours)
UINT8 floorpal Palette lookup table number (0 = standard colours)
UINT8 visibility How fast an area changes shade relative to distance
INT16LE lotag Significance is game-specific (Triggers, etc.)
INT16LE hitag Significance is game-specific (Triggers, etc.)
INT16LE extra Significance is game-specific

Walls: The ordering of the variables differs slightly.

Data type Name Description
INT32LE x X-coordinate of left side of wall (right side coordinate is obtained from the next wall's left side)
INT32LE y Y-coordinate of left side of wall (right side coordinate is obtained from the next wall's left side)
INT16LE point2 Index to next wall on the right (always in the same sector)
INT16LE nextsector Index to sector on other side of wall (-1 if there is no sector)
INT16LE nextwall Index to wall on other side of wall (-1 if there is no sector there)
INT16LE picnum Texture index into ART file
INT16LE overpicnum Texture index into ART file for masked/one-way walls
INT8 shade Shade offset of wall
UINT8 pal Palette lookup table number (0 = standard colours)
INT16LE cstat
  • bit 0: 1 = Blocking wall (use with clipmove, getzrange)
  • bit 1: 1 = bottoms of invisible walls swapped, 0 = not
  • bit 2: 1 = align picture on bottom (for doors), 0 = top
  • bit 3: 1 = x-flipped, 0 = normal
  • bit 4: 1 = masking wall, 0 = not
  • bit 5: 1 = 1-way wall, 0 = not
  • bit 6: 1 = Blocking wall (use with hitscan / cliptype 1)
  • bit 7: 1 = Transluscence, 0 = not
  • bit 8: 1 = y-flipped, 0 = normal
  • bits 9-15: reserved
UINT8 xrepeat Change pixel size to stretch/shrink textures
UINT8 yrepeat
UINT8 xpanning Offset for aligning textures
UINT8 ypanning
INT16LE lotag Significance is game-specific (Triggers, etc.)
INT16LE hitag Significance is game-specific (Triggers, etc.)
INT16LE extra Significance is game-specific

Sprites: The order of the variables differs and there is no "filler" value.

Data type Name Description
INT32LE x X-coordinate of sprite
INT32LE y Y-coordinate of sprite
INT32LE z Z-coordinate of sprite
INT16LE cstat
  • bit 0: 1 = Blocking sprite (use with clipmove, getzrange)
  • bit 1: 1 = transluscence, 0 = normal
  • bit 2: 1 = x-flipped, 0 = normal
  • bit 3: 1 = y-flipped, 0 = normal
  • bits 5-4: 00 = FACE sprite (default)
    • 01 = WALL sprite (like masked walls)
    • 10 = FLOOR sprite (parallel to ceilings&floors)
  • bit 6: 1 = 1-sided sprite, 0 = normal
  • bit 7: 1 = Real centered centering, 0 = foot center
  • bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1)
  • bits 9-14: reserved
  • bit 15: 1 = Invisible sprite, 0 = not invisible
INT8 shade Shade offset of wall
UINT8 pal Palette lookup table number (0 = standard colours)
UINT8 clipdist Size of the movement clipping square (face sprites only)
INT8 xrepeat Change pixel size to stretch/shrink textures
INT8 yrepeat
INT8 xoffset Centre sprite animations
INT8 yoffset
INT16LE picnum Texture index into ART file
INT16LE ang Angle the sprite is facing
INT16LE xvel ! ?
INT16LE yvel ! ?
INT16LE zvel ! ?
INT16LE owner ! ?
INT16LE sectnum Current sector of sprite's position
INT16LE statnum Current status of sprite (inactive, monster, bullet, etc.)
INT16LE lotag Significance is game-specific (Triggers, etc.)
INT16LE hitag Significance is game-specific (Triggers, etc.)
INT16LE extra Significance is game-specific

Version 5

Version 4

Version 3

Version 0

Notes

  • All angles are between 0..2047 inclusive. 0 is "north", parallel to the Y-axis, moving away from the X-axis. 512 is "east", parallel to the X-axis moving away from the Y-axis.

Source

  • This information comes from BUILDINF.TXT, BUILD2.TXT and the source code to CONVMAP7 in the Build source files, written by Ken Silverman.