Subsector

From DoomWiki.org

Revision as of 17:35, 17 November 2005 by Radius (talk | contribs) (+image; expand a bit)


Subsectors in E1M1: Hangar with implicit edges shown

SSECTORS (an abbreviation for subsectors) is the name of a WAD lump which is a component of a level. It is normally generated automatically from other data for the level using a node builder tool.

A subsector is a range of segs (wall segments) that form part (or all) of a single sector. The subsector is constructed so that when the player is anywhere within it, no part of any one seg will block the view of any other seg in the subsector.

A subsector can be considered to be a convex polygon, but some of its edges may be implicit. That is because segs are generated only where linedefs already exist. (It is not uncommon for a subsector to consist of a single seg.) The Doom engine uses the partition lines in the nodes structure to determine which subsector any particular point lies in.

Subsectors are referenced from the nodes lump.

Subsector structure

Doom level format
Offset Size (bytes) Description
0 2 Seg count
2 2 First seg number

The subsectors and segs are both stored in sequential order. That is, the seg numbers in subsector 0 are 0 through N0 - 1 (where N0 is the subsector 0 seg count), the seg numbers in subsector 1 are N0 through N0 + N1 - 1 (where N1 is the subsector 1 seg count), and so on.

At level load time, the sector that each subsector is a part of is determined by looking at the first seg, and a link to this sector is saved in the internal subsector data structure.

See also

Source