Declarations

Illustration depicting the relationship between various declarations and media assets Illustration depicting the relationship between various declarations and media assets

The general purpose of a declaration is to define a name for a reuseable asset that shares a common set of properties. A few examples would be…

  • A material shader declaration defines a material name which when referenced by brushes in a level, model, skin, or particle dictate what images to use and how they should be rendered.
  • A sound shader declaration defines a sound name which when referenced by a speaker entity, AI script or effect dictates what sounds to use and how loud they should be played.
  • A skin declaration defines a skin name which when referenced by models or entities dictates what material shaders to replace and what material shaders to replace them with.
  • An entity declaration defines an entity name which when referenced by the game itself dictates what key/value pairs should be used by default.

Declarations often times reference other declarations. A key example would be entity declarations which can reference nearly every declaration type including other entity declarations.

When a declaration references another declaration, it inherits those properties. Case in point, an entity references a given model declaration. The entity is assigned a model based on that model declaration rather than explicitly specifiying which file to use in the entity declaration itself.

The same is true of key/value pairs (a.k.a. spawn arguments). Case in point, monster_demon_imp does not explicitly define a bleed key/value pair. But because it inherits properties from monster_default , it has a bleed key/value pair.

This inheritance is useful because it allows you to create a declaration that is nearly identical to another without the need to copy and paste it or modify the original. You simply reference the original declaration and add whatever unique properties you wish.

Syntax

A single declaration consists of a header and body. The header is composed of a name and sometimes a descriptor that defines the type of declaration (descriptors are not needed if the declaration is put in its respective file format ; for example you wouldn’t need to put “material” before your material decls in an . MTR file). The body of a definition is enclosed in curly brackets.

Note: Enemy Territory: Quake Wars only:
Declaration descriptors are always needed

. DEF files are the standard container for declarations.

A few examples of headers would be…

textures/common/npc_pda

articulatedFigure char_campbell_bfg

entityDef aas_types

The purpose of a declaration is to define the properties and behavior of game content. More than one type of decl can be included in a single file however, for organizational purposes it’s recommended that they are kept separate. Alternatively you can also put just one decl in a single file, allowing you to use the operating system’s own file system to navigate the declarations.

Universal declaration types

These declarations are handled by the engine:

D3 Declaration types

The information in this section is specific to Doom 3 .

Along with the universal decls Doom 3 provides the following:

Q4 Q4 Declaration types

The information in this section is specific to Quake 4 .

Along with the universal decls Quake 4 provides the following:

Editing tools

Since declarations are plain-text files, a simple text editor can be used to edit or create declarations.