DWD format

DWD format is the native map format used by Doom's original level editor, DoomEd.

Format
Unlike the binary WAD format, DWD is an ASCII text format.

Header
DWD files open with a line that gives the version number of the file format.

WorldServer version 4

Lines
Following the header is a list of linedefs. The section opens with a count of the number of line definitions that is to follow. For example:

lines:475

Each line then has a format similar to the following:

(1088,-3680) to (1024,-3680) : 1 : 0 : 0 0 (0 : - / - / DOOR3 ) 0 : FLOOR4_8 72 : CEIL3_5 255 1 0

The first line describes the linedef itself - the start and end vertices, linedef special type and sector tag, respectively.

The following lines describe the sidedef data on the front side of the line. The second line is the X and Y offsets for the sidedef, upper, lower and middle textures, respectively. If no texture is present (as seen in the example above), '-' is used. The third line is describes the sector on this side of the line - the floor height, floor texture, ceiling height, ceiling texture, light level, sector special type and linedef tag, respectively.

If a line is two-sided, the sidedef and sector data for the back side of the line must also be specified. The following is an example of a line definition for a two-sided line:

(1344,-3264) to (1344,-3360) : 29 : 0 : 0 0 (0 : STARTAN3 / STARTAN3 / - ) -16 : FLAT14 200 : CEIL3_5 224 0 0 0 (0 : - / - / - )    8 : FLAT5_5 192 : FLAT5_5 255 0 0

Things
The things section opens similarly to the lines section, with a header line giving the number of thing definitions that are to follow. For example:

things:138

A list of things is then given, one per line. The following is an example:

(3440,-3472, 135) :3001, 15

The fields given in the definition are: X coordinate, Y coordinate, angle (in degrees), thing type and flags. These are the same fields used in the THINGS lump used in WAD files.

Discussion
Unlike in the WAD format where sectors and linedefs are declared in separate lists and cross-referenced, in the DWD format, sector data is redeclared for every linedef that is part of the sector. Thus, the concept of a sector does not really exist in the DWD format beyond a property that is attached to linedefs. Sectors are generated automatically by the node builder, by virtue of the fact that many lines all have the same sector properties.

The same is also true of vertices, which are not individually numbered but also declared as part of the line definitions.

The DWD format has some advantages in terms of version control. The ASCII text-based format and lack of cross-referencing mean that DWD format maps can be stored in any standard VCS; if multiple editors independently make changes to a given map, their changes can potentially be merged automatically by standard merge tools that expect ASCII input. Similarly if a merge conflict occurs, the conflict can be resolved by hand with any merge tool, or just using a plain text editor.

Use of a plain text format provides a conceptual separation between the levels and the binary format used for the engine itself. This was potentially useful during Doom's development, as it is known that the binary level format changed during development (earlier alphas such as Doom v0.5 do not even appear to use BSP trees).