Sector

A sector is an area referenced by sidedefs on the linedefs. Sectors should be closed areas, meaning that all the sidedefs that reference a particular sector should make up a closed shape. Unclosed sectors can be used for a few special effects, but under some circumstances they can lead to undesirable results (including crashes).

A sector does not have to be a single polygon. For instance, two squares can be separate and non-contiguous, but still be part of the same sector.

A sector entry specifies the following:

Ceiling flat - Name of the flat (texture) used on the ceiling of the sector.

Floor flat - Name of the flat used on the floor.

Ceiling height - Height of the ceiling.

Floor height - Height of the floor.

Lighting - How bright the sector is.

Sector tag - A number that makes the sector a target of the action specified by any linedef with the same tag number. Used, for example, to alter the sector's ceiling and/or floor height, lighting level or flats.

Sector type - Special properties of the sector. This is used to give the sector a damaging floor (for things like lava and slime), have the sector's light level change constantly, enable wind or currents or even push the player in a certain direction. See below.

Sector structure
Each sector is 26 bytes large. Sectors are stored in WAD files in the following format:

At level load time, several additional variables are generated for each sector and stored in the internal sector data structure. These include:

linecount - the total number of linedefs associated with the sector.

lines - a list of every linedef associated with the sector.

blockbox - the coordinates defining a rectangular bounding box enclosing the sector, with the bounding box enlarged so that the edges line up with the blockmap.

soundorg - the coordinates for any sound emitted by the sector; automatically set to the center of a precise bounding box surrounding the sector.

PlayStation format
The Sony PlayStation port of Doom uses the following sector format, with 28 bytes per record:

Final Doom for PlayStation format
The PlayStation port of Final Doom uses the following sector format, with 16 bytes per record:

Doom 64 format
The Doom 64 sector format differs from the Doom format in multiple places: textures are represented by indexes into a hash table of texture names, the light level is replaced by five color values, and a flags field is added. Thus each sector is 24 bytes long.

Sector types
The type field of the sector structure is used to specify lighting, damage, and a few other special effects.
 * There are linedef types that can change the sector type field during gameplay, either to zero or to a copy of another sector's type field. This is how, for example, a safe bridge rises out of a pool of nukage.
 * Damage is halved at skill level 1.
 * Damage is split between health and armor (if any).

Doom
In Doom, the sector type values are mutually exclusive.

Boom
Boom (and compatible source ports) support the Doom sector types above, and also provide "generalized" sector types. The latter are based on bit fields, which allows several sector type properties to be independently specified for a sector. Texture change linedef types can be used to switch some or all of these properties dynamically, outside lighting.

Bits 0 through 4 specify the lighting type in the sector, and the same codes that Doom uses are employed (0, 1, 2, 3, 4, 8, 12, 13 and 17 from above).

Heretic
Heretic uses a greater variety of sector types, notably to control its own friction and wind effects. Like in Doom, the values are mutually exclusive.

Hexen
Like Heretic, Hexen uses a large number of mutually-exclusive sector types.

Strife
In Strife, the sector type values are also mutually exclusive.

ZDoom
ZDoom and compatible source ports provide a superset of all sector types based on the Hexen types, including both mutually-exclusive types and generalized flags. The following table is used for maps in the Hexen map format or in UDMF with the ZDoom namespace.

Doom 64
In Doom 64, the sector type values are mutually exclusive like before, but mainly pertain to lighting behavior.

The extra flags field controls further sector characteristics that were defined as sector types in the original Doom.