Map

From SRB2 Wiki
(Redirected from Level WAD)
Jump to navigation Jump to search

A map or level is a self-contained area in which the player faces a specific objective. Each act in Single Player mode is a separate map, as are the arenas for Match and Capture the Flag. Maps are laid out on a 2D grid with a map editor such as Zone Builder and then stored in WAD or PK3 files as a series of lumps.

Map components

A simple sector.

SRB2 maps are made up of five main components: vertices, linedefs, sidedefs, sectors and Things. The triangle in the picture to the right is a sector. It is made up of vertices (the blue dots at the edges) which are connected by linedefs (the white lines between the blue dots).

  • Vertices: A vertex is essentially a point in the map where a linedef ends/begins. Therefore, vertices make up the edges of sectors.They have no other properties aside from their location.
  • Linedefs: Linedefs are the lines that connect the vertices, and therefore the boundaries of a sector. In-game, they appear as the walls of sectors.
  • Sidedefs: Each linedef consists of two sidedefs, which are literally the sides of the linedef. The front side of the linedef is covered by the front sidedef; the back side is covered by the back sidedef. The outer linedefs of a map face into empty space and therefore only have a front sidedef, they are called one-sided linedefs. The graphics displayed on the walls – called textures – are specified on the sidedefs.
  • Sectors: A sector is a closed loop of linedefs that forms a section of the map. It includes the properties of the floor and ceiling, which are their heights and the graphics they display – called flats.
  • Things: Things are starting points for Objects that should spawn when the map is loaded. Examples of these include the starting points for players, and spawn points for rings, enemies, monitors, and scenery items such as flowers. Things are independent from the rest of the map structure.

Node building

Main article: Node

For rendering purposes, the linedefs of a map are split into segments (also known as segs) that form sub-sectors, which themselves are part of an existing sector. These sub-sectors are all convex. The segments and sub-sectors are created through a process known as binary space partitioning (BSP). When drawing walls, the game can then use the BSP data to sort the sub-sectors in order of their distance from the camera, drawing the closest sub-sectors first. This vastly improves the performance of the engine on larger maps.

The process of creating these data structures is called node building and must be performed on a map with a nodebuilder before it can be loaded in SRB2. Most map editors include a basic nodebuilder themselves or allow the designer to automatically run a nodebuilder when saving the map. For example, Zone Builder is packaged with ZenNode, the most common nodebuilder, and runs it automatically upon saving a map.

Data structure

A map is stored inside a WAD file as a series of consecutive lumps, all of which contain a specific part of the information that the game needs to create the map. These lumps must have specific names and must be stored in a specific order to work correctly. No other lumps may be in-between the lumps that make up one map. In PK3 files, the WADs containing the maps must be placed in the Maps/ folder.

Binary format

In the original Doom map format, a map must consist of these lumps in the given order:

  • Header: The name of this lump is MAPxx, with xx designating the map number in two-digit form; to use a slot above 99, extended map numbers must be used. Aside from the name, this lump does not normally contain any other data.
  • THINGS: Lists all Things in the map as well as their type, X and Y coordinates and other attributes, including flags, Angle, and Z position.
  • LINEDEFS: Lists all linedefs in the map as well as their type, starting and ending vertices and other attributes, including flags, tag, front and back sidedefs (if applicable).
  • SIDEDEFS: Lists all sidedefs in the map as well as the sector they belong to, the textures they display and the textures' X and Y offsets.
  • VERTEXES: Lists all vertices in the map as well as their X and Y coordinates.
  • SEGS: Lists all segs in the map. Created by a nodebuilder.
  • SSECTORS: Lists all subsectors in the map. Created by a nodebuilder.
  • NODES: The node tree which sorts the subsectors into the correct order for rendering. Created by a nodebuilder.
  • SECTORS: Lists all the sectors in the map as well as their type, tag, floor and ceiling heights and textures, and light value.
  • REJECT: Contains information about which sectors are visible from which other sectors. SRB2 uses this to determine if enemies currently have a target in their line of sight. Optionally created by a nodebuilder.
  • BLOCKMAP: Contains information about collision detection between Objects and the level environment. Optionally created by a nodebuilder.

UDMF

In UDMF, a map must consist of these lumps in the given order:

  • Header: This is the same as the binary format.
  • TEXTMAP: This is a text lump that contains an entry for each Thing, linedef, sidedef, vertex and sector in the map. Replaces THINGS, LINEDEFS, SIDEDEFS, VERTEXES, and SECTORS.
  • ZNODES: Contains all of the BSP information of an UDMF level. Created by a nodebuilder and replaces SEGS, SSECTORS, and NODES.
  • REJECT: Contains information about which sectors are visible from which other sectors. SRB2 uses this to determine if enemies currently have a target in their line of sight. Optionally created by a nodebuilder.
  • BLOCKMAP: Contains information about collision detection between Objects and the level environment. Optionally created by a nodebuilder.
  • ENDMAP: This marks the end of the map.

See also

  Map components [view]

ThingLinedefSidedefVertexNodeSectorRejectBlockmap