DED Syntax

From Doomsday Wiki
Jump to: navigation, search

This article describes the common syntax elements of the DED (Doomsday Engine Definition) language.

Directives

Directives instruct the DED parser to perform special actions when encountered.

Keyword Description
Include Include the specified .DED file.
IncludeIf Include the specified .DED file if the conditional statement is true.
SkipIf Skip the rest of the current file if the conditional statement is true.
ModelPath Append a new path to the list of model search paths.

Comments

There are two kinds of comment in DED; single-line and multi-line.

Single line comments begin with # and continue until the end of line.

# A single line comment stops here

Multi line comments begin with #> and continue until <# is found.

#> A multi-line comment begins...
And continues
...and ends here <#

Assignment statements

Flag values

Property = flaga | flagb | flagc;  # Version 6 syntax
Property = "flaga flagb flagc";    # Version 5 syntax (still supported).

The special case of 'no flags' is defined as follows:

Property = 0;   # Supported from Doomsday 1.9.9 onwards
Property = "";  # Version 5 syntax
Warning: The following is a syntax error:
Property = ;

String values

Strings begin and end with " (double quotation mark). If newline characters are found inside a string (the string has been divided into multiple lines) the newline and all following whitespace are skipped, and the actual string continues from the first non-whitespace character that follows.

Property = "Some text string";

To include a double quotation mark in the string itself, escape it with \ (backward slash).

Property = "Some \"quoted text\"";

To include a backward slash in the string itself, it must appear twice (to escape the escape sequence).

Property = "path\\to\\something";
Note: For this reason it is generally better to use forward slashes in paths. Doomsday uses forward slashes on all platforms, internally.

URI values

Resource URIs are used throughout Doomsday and use the following form:

Property = "<scheme>:<path>";

Definition scopes

A scope describes the extent of zero or more definition statements which apply to a named definition type.

Syntax example:

<attribute> definitiontype <attribute> <identifier> {
  ... Definition statements ...
}

Attributes

Attributes are optional keywords that either precede or follow a scope. These "derivation" attributes change the behavior of the parser when interpreting definition statements within the scope.

Keyword Description
Copy Use the previous definition of the same type as a base.
Mods Modify an existing definition.
Note: Clever use of attributes in conjunction with directives allows the add-on author to construct multi-part, combinatorial add-ons.


Example

The following snippet (taken from libdoom's libdoom.pk3:defs/doom1/materials.ded) serves as good example of what a .DED file typically looks like:

Header { Version = 6; }

# Allow disabling from the command line.
SkipIf -nodefaultfx;

# Add an animated light glow effect to the NUKAGE1 material.
Material Mods "flats:NUKAGE1" {
  Layer {
      Stage { Glow = .5;  Tics = 24; Rnd = .5; }
      Stage { Glow = .44; Tics = 24; Rnd = .5; }
  }
}

See also