Initially, one seg is created for each one-sided linedef, and two segs are created for each two-sided linedef (one for each side). If the area that a seg borders is later divided into two different subsectors, then a new vertex is created at the division point and the seg is split into two at that vertex. The segs are stored in sequential order corresponding to subsector number. The seg entries are referenced from the subsector entries, which are referenced from the nodes lump.
|Doom level format|
|0||2||Starting vertex number|
|2||2||Ending vertex number|
|8||2||Direction: 0 (same as linedef) or 1 (opposite of linedef)|
|10||2||Offset: distance along linedef to start of seg|
The direction field may be interpreted as a "side flag": direction=0 indicates the seg runs along the right side of the linedef; direction=1 indicates it runs along the left side.
While constructing a frame, the segs to be drawn are stored for later rendering. In vanilla Doom, they are kept in a static array 256 elements long, and if a frame requires more segs than this, the excess segs are simply not drawn.