Sector

From DoomWiki.org

Revision as of 08:20, 8 September 2024 by MrExcelRosario (talk | contribs) (Boom)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A sector is an area referenced by sidedefs on the linedefs, with variable height determined by its floor and ceiling values. 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[edit]

Doom level format

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

Offset Size (bytes) C99 type Description
0 2 int16_t Floor height
2 2 int16_t Ceiling height
4 8 int8_t[8] Name of floor texture
12 8 int8_t[8] Name of ceiling texture
20 2 int16_t Light level
22 2 int16_t Special Type
24 2 int16_t Tag number

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[edit]

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

Offset Size (bytes) C99 type Description
0 2 int16_t Floor height
2 2 int16_t Ceiling height
4 8 int8_t[8] Name of floor texture
12 8 int8_t[8] Name of ceiling texture
20 1 uint8_t Light level
21 1 uint8_t Color ID
22 2 int16_t Special Type
24 2 int16_t Tag number
26 2 int16_t Flags

Final Doom for PlayStation format[edit]

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

Offset Size (bytes) C99 type Description
0 2 int16_t Floor height
2 2 int16_t Ceiling height
4 2 int16_t Index of floor texture
6 2 int16_t Index of ceiling texture
8 1 uint8_t Light level
9 1 uint8_t Color ID
10 2 int16_t Special Type
12 2 int16_t Tag number
14 2 int16_t Flags

Doom 64 format[edit]

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.

Offset Size (bytes) C99 type Description
0 2 int16_t Floor height
2 2 int16_t Ceiling height
4 2 int16_t Index of floor texture
6 2 int16_t Index of ceiling texture
8 10 int16_t[5] Color indexes (floor, ceiling, thing, wall top, wall bottom)
18 2 int16_t Special Type
20 2 int16_t Tag number
22 2 int16_t Flags

Sector types[edit]

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).
  • All light-related sector types alternate between the initial light value of the sector, and the initial light value of the adjacent sector with the lowest light value. The effect of the sector's lighting being altered by a linedef varies depending on both the linedef type and sector type used. Changing the adjacent sector's light value does not change the lighting effect.

Doom[edit]

In Doom, the sector type values are mutually exclusive.

Type Class Effect
0 Normal
1 Light Blink random
2 Light Blink 0.5 second
3 Light Blink 1.0 second
4 Both 20% damage per second plus light blink 0.5 second
5 Damage 10% damage per second
7 Damage 5% damage per second
8 Light Oscillates
9 Secret Player entering this sector gets credit for finding a secret
10 Door 30 seconds after level start, ceiling closes like a door
11 End 20% damage per second. The level ends when the player's health drops below 11% and is touching the floor. Player health cannot drop below 1% while anywhere in a sector with this sector type. God mode cheat (iddqd), if player has activated it, is nullified when player touches the floor for the first time.
12 Light Blink 1.0 second, synchronized
13 Light Blink 0.5 second, synchronized
14 Door 300 seconds after level start, ceiling opens like a door
16 Damage 20% damage per second
17 Light Flickers randomly

Boom[edit]

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).

Flag Bits Effect
32 5 5% damage per second
64 6 10% damage per second
96 5+6 20% damage per second
128 7 Secret sector
256 8 Enable friction effects
512 9 Enable pusher/puller effects

Heretic[edit]

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.

Type Class Effect
0 Normal
1 Light Blink random
2 Light Blink 0.5 second
3 Light Blink 1.0 second
4 Combo 5% lava damage per second plus scroll east 28 and light blink 0.5 second
5 Damage 5% lava damage per second
7 Damage 4% sludge damage per second
8 Light Oscillates
9 Secret Player entering this sector gets credit for finding a secret
10 Door 30 seconds after level start, ceiling closes like a door
11 No-op Does nothing
12 Light Blink 0.5 second, synchronized
13 Light Blink 1.0 second, synchronized
14 Door 300 seconds after level start, ceiling opens like a door
15 Friction Low friction
16 Damage 8% lava damage per second
20 Scroller Scroll east 5
21 Scroller Scroll east 10
22 Scroller Scroll east 25
23 Scroller Scroll east 30
24 Scroller Scroll east 35
25 Scroller Scroll north 5
26 Scroller Scroll north 10
27 Scroller Scroll north 25
28 Scroller Scroll north 30
29 Scroller Scroll north 35
30 Scroller Scroll south 5
31 Scroller Scroll south 10
32 Scroller Scroll south 25
33 Scroller Scroll south 30
34 Scroller Scroll south 35
35 Scroller Scroll west 5
36 Scroller Scroll west 10
37 Scroller Scroll west 25
38 Scroller Scroll west 30
39 Scroller Scroll west 35
40 Wind Push east 5
41 Wind Push east 10
42 Wind Push east 25
43 Wind Push north 5
44 Wind Push north 10
45 Wind Push north 25
46 Wind Push south 5
47 Wind Push south 10
48 Wind Push south 25
49 Wind Push west 5
50 Wind Push west 10
51 Wind Push west 25

Hexen[edit]

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

Type Class Effect
0 Normal
1 Light Phased light (use lightlevel between 0 and 63 for the starting phase)
2 Light Phased light sequence start (use types 3 and 4 in neighboring sectors)
3 Light Light sequence step (to be used alternatively with type 4 for a light sequence)
4 Light Light sequence step (to be used alternatively with type 3 for a light sequence)
9 Secret (Unused) Player entering this sector gets credit for finding a secret — however this is nonfunctional and pointless since Hexen does not have an intermission screen.
26 Stairs Mark sector to be used for building normal stairs
27 Stairs Mark sector to be used for building synchronized stairs
40 Wind Push east 5
41 Wind Push east 10
42 Wind Push east 25
43 Wind Push north 5
44 Wind Push north 10
45 Wind Push north 25
46 Wind Push south 5
47 Wind Push south 10
48 Wind Push south 25
49 Wind Push west 5
50 Wind Push west 10
51 Wind Push west 25
198 Lightning Light level increases by up to 64 units during a lightning flash
199 Lightning Light level increases by up to 32 units during a lightning flash
200 Sky Use the secondary sky texture if the level does not use a double sky
201 Scroller Scroll north 5
202 Scroller Scroll north 10
203 Scroller Scroll north 25
204 Scroller Scroll east 5
205 Scroller Scroll east 10
206 Scroller Scroll east 25
207 Scroller Scroll south 5
208 Scroller Scroll south 10
209 Scroller Scroll south 25
210 Scroller Scroll west 5
211 Scroller Scroll west 10
212 Scroller Scroll west 25
213 Scroller Scroll northwest 5
214 Scroller Scroll northwest 10
215 Scroller Scroll northwest 25
216 Scroller Scroll northeast 5
217 Scroller Scroll northeast 10
218 Scroller Scroll northeast 25
219 Scroller Scroll southeast 5
220 Scroller Scroll southeast 10
221 Scroller Scroll southeast 25
222 Scroller Scroll southwest 5
223 Scroller Scroll southwest 10
224 Scroller Scroll southwest 25

Strife[edit]

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

Type Class Effect
0 Normal
1 Light Blink random
2 Light Blink 0.5 second
3 Light Blink 1.0 second
4 Both 5% damage every 32 tics plus light blink 0.5 second
5 Damage +2 increase to nukagecount
7 Damage 5% damage every 32 tics
8 Light Oscillates
9 Secret Player entering this sector gets credit for finding a secret
10 Door 30 seconds after level start, ceiling closes like a door
11 End 20% damage per second. When player dies, level ends
12 Light Blink 0.5 second, synchronized
13 Light Blink 1.0 second, synchronized
14 Door 300 seconds after level start, ceiling opens like a door
15 Damage Instant death: 999% damage every tic
16 Damage +4 to nukagecount
17 Light Flickers randomly
18 Scroller Water current, angle and strength depend on sector tag value

ZDoom[edit]

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.

Type Class Effect
0 Normal
1 Light Phased light (use lightlevel between 0 and 63 for the starting phase)
2 Light Phased light sequence start (use types 3 and 4 in neighboring sectors)
3 Light Light sequence step (to be used alternatively with type 4 for a light sequence)
4 Light Light sequence step (to be used alternatively with type 3 for a light sequence)
26 Stairs Mark sector to be used for building normal stairs
27 Stairs Mark sector to be used for building synchronized stairs
40 Wind Push east 5
41 Wind Push east 10
42 Wind Push east 25
43 Wind Push north 5
44 Wind Push north 10
45 Wind Push north 25
46 Wind Push south 5
47 Wind Push south 10
48 Wind Push south 25
49 Wind Push west 5
50 Wind Push west 10
51 Wind Push west 25
65 Light Blink random
66 Light Blink 0.5 second
67 Light Blink 1.0 second
68 Both 20% damage per second plus light blink 0.5 second
69 Damage 10% damage per second
71 Damage 5% damage per second
72 Light Oscillates
74 Door 30 seconds after level start, ceiling closes like a door
75 End 20% damage per second. When player dies, level ends
76 Light Blink 0.5 second, synchronized
77 Light Blink 1.0 second, synchronized
78 Door 300 seconds after level start, ceiling opens like a door
79 Friction Low friction
80 Damage 20% damage per second
81 Light Flickers randomly
82 Damage 5% lava damage per second
83 Damage 8% lava damage per second
84 Combo 5% lava damage per second plus scroll east and light blink 0.5 second
85 Damage 4% sludge damage per second
87 Fog Sector uses outside fog even if the ceiling texture is not the sky texture
105 Damage +2 increase to nukagecount
115 Damage Instant death: 999% damage every tic
116 Damage +4 to nukagecount
118 Scroller Water current, angle and strength depend on sector tag value
195 Automap Hidden: sector texture is not shown on the textured automap
196 Healing Restores 1 hit point every 32 tics
197 Lightning Light level increases as much as outdoor sectors do during a lightning flash
198 Lightning Light level increases by up to 64 units during a lightning flash
199 Lightning Light level increases by up to 32 units during a lightning flash
200 Sky Use the secondary sky texture if the level does not use a double sky
201 Scroller Scroll north 5
202 Scroller Scroll north 10
203 Scroller Scroll north 25
204 Scroller Scroll east 5
205 Scroller Scroll east 10
206 Scroller Scroll east 25
207 Scroller Scroll south 5
208 Scroller Scroll south 10
209 Scroller Scroll south 25
210 Scroller Scroll west 5
211 Scroller Scroll west 10
212 Scroller Scroll west 25
213 Scroller Scroll northwest 5
214 Scroller Scroll northwest 10
215 Scroller Scroll northwest 25
216 Scroller Scroll northeast 5
217 Scroller Scroll northeast 10
218 Scroller Scroll northeast 25
219 Scroller Scroll southeast 5
220 Scroller Scroll southeast 10
221 Scroller Scroll southeast 25
222 Scroller Scroll southwest 5
223 Scroller Scroll southwest 10
224 Scroller Scroll southwest 25
225 Scroller Scroll east 5
226 Scroller Scroll east 10
227 Scroller Scroll east 25
228 Scroller Scroll east 30
229 Scroller Scroll east 35
230 Scroller Scroll north 5
231 Scroller Scroll north 10
232 Scroller Scroll north 25
233 Scroller Scroll north 30
234 Scroller Scroll north 35
235 Scroller Scroll south 5
236 Scroller Scroll south 10
237 Scroller Scroll south 25
238 Scroller Scroll south 30
239 Scroller Scroll south 35
240 Scroller Scroll west 5
241 Scroller Scroll west 10
242 Scroller Scroll west 25
243 Scroller Scroll west 30
244 Scroller Scroll west 35
Flag Bits Effect
0x0100 8 5% damage per second
0x0200 9 10% damage per second
0x0300 8+9 20% damage per second
0x0400 10 Secret sector
0x0800 11 Enable friction effects
0x1000 12 Enable pusher/puller effects

Doom 64[edit]

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

Type Class Effect
0 Normal
1 Light Random flickering light
2 Light Blink light 0.5 seconds
3 Light Blink light 1.0 seconds
8 Light Normal pulsing light
9 Light Slow pulsing light
11 Light Random pulsing light
12 Light Same as type 3
13 Light Same as type 2
17 Light Fire light flickering
202 Light Constant blink light slow
204 Light Blink light rapid
205 Light Start of sequenced light sectors
206 Light Blink light very rapid
208 Light Constant blink light fast
666 Damage Instant kill thing when being crushed

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

Flag Bit Description
0x0001 0 Reverb sounds (echo) played in sector
0x0002 1 Reverb sounds (echo) played in sector and multiply factor by 2
0x0004 2 Water effect (floors only)
0x0008 3 All flagged sectors with same special type will sync all light flickers/strobe across all sectors
0x0010 4 Scrolling floors/ceilings will scroll at twice the speed
0x0020 5 Count as secret on intermission screen when entering this sector
0x0040 6 Damage player x5
0x0080 7 Damage player x10
0x0100 8 Damage player x20
0x0200 9 Hide sector in automap (textured mode)
0x0400 10 Enable ceiling scrolling
0x0800 11 Enable floor scrolling
0x1000 12 Scroll texture west
0x2000 13 Scroll texture east
0x4000 14 Scroll texture north
0x8000 15 Scroll texture south

Sources[edit]