FGD

From Valve Developer Community
Jump to: navigation, search
English (en)português do Brasil (pt-br)español (es)中文 (zh)
Edit
See also: Category:FGD

FGD (Forge Game Data) is a plain-text file format used define to all of the entities of a game for a map editor, allowing mappers can select them from within the editor and configure their properties.

While Hammer was originally called Hammer 3.x Worldcraft, it was developed under the name The Forge (hence the name Forge Game Data). Due to trademark issues, however, the name Forge couldn't be used for the final version of Hammer. Even so, the file extension stayed.

For Custom FGD files to work in Hammer or Jack, they must be added through Tools > Options.

Note.pngNote:In Hammer Hammer, FGDs are loaded in alphabetical order. If you do not use @include "base.fgd" at the top of your FGD and it is loaded before base.fgd, you will encounter errors.
Icon-Important.pngImportant:An FGD is nothing more than a reference for the map editor.
You cannot create or modify entities by editing a FGD, you merely give the map editor different information about what it expects to find within the game. Sometimes editing reveals hidden or unused features or even entities, but they were always there and could be used even without the updated FGD.
Blank image.pngTodo: Make it clearer what features are available in which map editors. The following editors should be documented, at minimum:

Prefer editor-agnostic language when not referring to a specific editor; unless something is specific to Hammer, refer to the program used to create maps as "the map editor". If it is specific to Hammer, specify the major version (3.x, 4.x, 5.x).


File Format

An FGD file consists of keywords that start with an @ character that might be followed by properties or even a body surrounded with square brackets [ ]. This may be the definition of an entity class or any other information that the map editor will use, depending on the keyword. In the following, all the different types of keywords are covered.

Comments can only be added as line comments, starting with //. Block comments or multiline comments are not supported.

//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose: Half-Life 2 game definition file (.fgd) 
//
//=============================================================================

Entities

The syntactic components of an entity structure as defined in the FGD include:

  1. the class type of the entity (@PointClass),
  2. (optional) whitespace delimited class properties (base(...) studio(...)),
  3. an equals sign and the classname of the entity (example_entity_name),
  4. (optional) a colon followed by a description for it ("...") and
  5. a body surrounded by square brackets [ ] containing the entity's keyvalues, flags and Inputs and Outputs.

Explanations of what each of these parameters do will be explained on this page, in order.

PlacementTip.pngExample:
@PointClass base(Targetname, Angles, Origin) studio("path/model.mdl") = example_entity_name : "example entity description, visible in Hammers 'help' Box. 
[

	Property_name_1(string) 	: "Example String Name"		: "Example"	: "Keyvalue Description"
	Property_name_2(integer) 	: "Example Interger Name"	: 15		: "Keyvalue Description"
	Property_name_3(float)		: "Example Float Name" 		: "1.5"		: "Keyvalue Description"
	Property_name_4(boolean)	: "Example Boolean Name"	: 1 		: "Keyvalue Description"
	
	Property_name_5(choices) : "second number" : 0 : "Your choice of numbers!" =
	[
		0 : "Default"
		1 : "Something"
		2 : "Another Thing"
	]

	spawnflags(flags) =
	[
		1 : "A flag"       : 0 // 0 means the flag isn't ticked by default
		2 : "Another flag" : 1 // 1 means the flag is ticked by default
	]
	
	// Inputs
	input DoSomething(void) : "Do something"	
	// Outputs
	output OnSomethingHappened(void) : "Fires when something happens"
	output OnSomethingElse(void) : "Fires when something else happens"

]

Class Types and Properties

The class type of an entity tells Hammer how this entity can be placed.

Class Name Supported Editors Description
@BaseClass Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
Hammer 5.x Hammer 5.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
A set of properties that can be inherited, reducing clutter. See @BaseClass.
@PointClass Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
Hammer 5.x Hammer 5.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
Point Entity: This entity exists at a certain non-arbitrary point. These entities are placed within Hammer by using the Hammer Entity Tool, Shift+E.
@NPCClass Hammer Hammer 4.x
Hammer 5.x Hammer 5.x
This is a special form of point entity tailored for NPC (Non-Player Character) entities. It is useful in conjunction with the npcclass property type (see below).
@SolidClass Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
Hammer 5.x Hammer 5.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
Brush Entity: This entity has a volume that is defined by the solid (also referred to as a brush) that it is attached to. A solid is tied to an entity by selecting it and pressing Ctrl+T. Other solids are world brushes.

This also includes brush entities that get converted to world brushes at compile time, such as func_detail and func_group.

@KeyFrameClass Hammer Hammer 4.x
Hammer 5.x Hammer 5.x
Used for move_rope and keyframe_rope. This causes the NextKeysprite property to be linked up when the entity is copied.
@MoveClass Hammer Hammer 4.x
Hammer 5.x Hammer 5.x
Used for path_track and similar entities. This causes the targetsprite property to be linked up when the entity is copied.
@FilterClass Hammer Hammer 4.x
Hammer 5.x Hammer 5.x
One of the special filter classes used to define what entities will be able to interact with each other in some way. This mainly causes the entity to be shown in properties with the filterclass type.
@ExtendClass Hammer++ Hammer++ Parsed last, after all FGDs have already been loaded and parsed. Appends KeyValues to an existing entity class. This can be useful for when another FGD is @included, and is used by 🖿hammerplusplus_fgd.fgd, which is hardcoded to always loaded by Hammer++ Hammer++.


Things between the class type declaration and the "= <entity_name_here>" help to define properties of the entity, how it will act and be displayed in Hammer.
There are a number of different keywords that can used here. Multiple of these can be used, each separated by a space.

Property Supported Editors Description
axis( property ) Hammer Hammer 4.x Allows positioning two points joined by a line in the map. The property value is set to "x1 y1 z1, x2 y2 z2" by default.
base( BaseClass1, BaseClass2, … ) Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
This lets you attach previously defined BaseClasses (see below) to an entity. You can specify multiple BaseClasses, each separated by a comma.
bbox( min,max ) Hammer Hammer 4.x Sets the size of the entity's bounding box.
color( red green blue ) Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
This setting will change the color of the wireframe box in the Hammer 2D views, as well as the 3D view if no model is present. If this isn't present, the color will default to magenta. The values specified here are the RGB values of a color, and each number has a range from 0 to 255.
cylinder( color, start_key, start_name, start_radius, end_key, end_value, end_radius ) Hammer Hammer 4.x Draw a cylinder between two entities. This is similar to line(), but with the addition of two radius properties that are looked up on the target entities. These define the size of the start and end of the cylinder.
flags(flagname(s)) J.A.C.K. J.A.C.K. Allows for multiple different editor flags, separated by commas:
  • Angle - Shows an arrow in the 3D view indicating which direction point entity is angled.
  • Light - Shows the entity as a Wikipedia icon octahedron instead of a cube or rectangular prism. Also shows in the 3D view if no model or sprite is present.
  • Path - Allow the entity to be hidden using View > Hide Paths, even if its classname is not prefixed with path_.
  • Item - Allow the entity to be hidden using View > Hide Items, even if its classname is not prefixed with item_.
Icon-Bug.pngBug:Item is mentioned in the reference manual but is not implemented properly.
frustum( fov,near,far,color, pitch_scale ) Hammer Hammer 4.x Creates a rectangular cone extending from the entity. FOV defines the spread angle (0-180). Near and far define at what distances will be highlighted. The color value defines what color the cone will be shown with. Pitch_scale allows inverting the pitch angle when rendering the cone. The first four values must be property names, the last is a literal. If not specified, values are taken from _fov, _nearplane, _farplane, and _light, respectively. pitch_scale is set to -1.
halfgridsnap Hammer Hammer 4.x When moving this entity, it will snap to half the current grid size. This is somewhat special as it takes no arguments or parentheses.
iconsprite( "path/sprite.ext" ) Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom (limited support)
If this is used, the specified sprite will be shown in the editor's 3D view instead of a flat-shaded colored box. This will work along-side the studio() or studioprop() commands.

Uses VMT in Hammer Hammer 4.x, VMAT in Hammer 5.x Hammer 5.x, and SPR (QSPR and/or HLSPR) in all other editors.

  • Hammer 3.xHammer 0.25 scale by default. scale, rendermode, _light and angles properties affect the sprite. If no sprite name is set, it uses the model property.
  • J.A.C.K. Scaled up or down to fit size(). _light, _color, rendermode, and renderamt affect the sprite.
  • TrenchBroom 1.0 scale by default; sprites defined using this parameter will be too big. Treated as alias for model() with no special properties.
lightcone( inner_fov, outer_fov, color, pitch_scale ) Hammer Hammer 4.x Renders the cone used on light_spot entities. inner_fov is the key for the innermost cone section, outer_fov is the outermost. pitch_scale allows inverting the pitch angle when rendering the cone. Values are taken from _inner_cone, _cone, and _light, respectively, if they aren't specified. This reads many other values corresponding to light_spot properties.
lightprop( "path/model.mdl" ) Hammer Hammer 4.x Identical to studioprop(), except that the pitch of the model is inverted.
line( color, start_key, start_value, end_key, end_value ) Hammer Hammer 4.x Draws a line between two entities. The value properties in this entity give the names to look for in the key property on other entities. key is usually set to targetname. The color sets the color of the line when the entity is not selected. The second entity defaults to this one if not set.
model({ "path": "path/file.ext", "frame": #, "skin": #, "scale": # }) TrenchBroom TrenchBroom A more verbose alternative to studio() for displaying in-editor models, which supports rescaling the displayed model, displaying a specific skin, and display a specific frame of a Quake Quake MDL, an Quake II MD2, or an Quake III MD3. GoldSrc Half-Life MDL animation sequences are not yet supported, but are being worked on.

Can also be used instead of iconsprite() for editor sprites, to select a specific frame of an SPR to display. Sprites can also be scaled this way, which may be necessary due to discrepancies between how Trenchbroom handles default scale vs Hammer and Jack.

Tip.pngTip:All parameters except "path" are optional.
Note.pngNote:Can do a lot, including conditional values, more verbose documentation can be found in the Trenchbroom manual.
Warning.pngWarning:model() is only supported by Trenchbroom! If it is not necessary to use the extra features available, then studio() or iconsprite() should be used instead, to retain compatibility with other editors.
obb( min,max ) Hammer Hammer 4.x Identical to bbox but oriented to the entity's angles.
origin( property ) Hammer Hammer 4.x Allows positioning a vector property in the map.
sequence( index ) J.A.C.K. J.A.C.K. Default animation index (Half-Life MDL) or keyframe (Quake MDL, MD2, MD3, SPR, SP2) to display for the entity's model or sprite, if not overridden by the sequence keyvalue.
sidelist( sides ) Hammer Hammer 4.x Highlight brush faces listed in the given property (as a space-seperated ID list). If not specified, the property used is sides.
size( -x,-y,-z,+x,+y,+z ) Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
Defines the size of the default cube used when no model or sprite is specified.
skin( index ) J.A.C.K. J.A.C.K. Default skin to display on the entity's model, if not overridden by the skin keyvalue. Only supported on Quake MDL, Half-Life MDL, MD2, and MD3 models, as LWO and ASE models do not support selectable skins.
sphere( propertyname ) Hammer Hammer 4.x If an entity has a radius of effect, like a sound for example, a sphere will be displayed in Hammer's 2D and 3D views. You need to specify the property that will control the sphere size. If no property is specified, it will look for a radius property.
studio( "path/model.mdl" ) Hammer 3.x Hammer 3.5
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom (limited support)
If this is used, the entity will be displayed in the 3D view as the specified model. If no model is specified, the value of the entity's model property will be used, if available (not in TrenchBroom). Multiple models can be defined.

In J.A.C.K. J.A.C.K., and TrenchBroom TrenchBroom, this parameter also supports other model formats besides MDL, such as BSP, MD2, MD3, ASE, and LWO.

Note.pngNote:In Hammer Hammer and J.A.C.K. J.A.C.K., if no model is specified, the value of the entity's model property will be override which model is displayed, if available. Additional values also are affect the model's appearance:
  • Hammer skin, rendercolor, uniformscale(in all games since Counter-Strike: Global Offensive)
    • Hammer++ Everything in Hammer, plus modelscale
  • J.A.C.K. rendermode(only in GoldSrc), renderamt(only in GoldSrc), body(only in GoldSrc), scale, uniformscale, sequence, alpha(only in Quake)
TrenchBroom TrenchBroom requires using special model() syntax instead.
studioprop( "path/model.mdl" ) Hammer Hammer 4.x Identical to studiop(), but is affected by the model's bounding box[How?].
Note.pngNote:Hammer If you have an entity with the "angles" property that you want to be able to rotate in Hammer using the mouse (as opposed to only through property editing), you may need to add this modifier.
vecline( property ) Hammer Hammer 4.x Allows positioning a vector property in the map. This also draws a line from the entity to the position.
wirebox( min,max ) Hammer Hammer 4.x Draws a bounding box for two properties. origin() helpers should be defined as well to allow moving the points.


The following helpers take no arguments and are special-cased for specific entity types:

Property Description
decal() Renders decals on nearby surfaces. This uses the texture property to set the material to use.
overlay() Renders overlays on a surface. (For info_overlay)
overlay_transition() Renders overlays on the intersections between water and the shore. (For info_overlay_transition)
light() Present on light; its use is unknown.
Blank image.pngTodo: Figure out what this does.
sprite() Renders the sprite material specified in the model keyvalue (env_sprite and variants). For entity icons, use iconsprite.
sweptplayerhull() Draws 32x32x72-sized rectangular prisms at two points (point0 and point1), then links corners to show the space needed for one rectangle to move to the other's position. This also adds origin() helpers for those properties.
instance() Renders the instance in the map. It also generates additional properties dynamically corresponding to the instance parameters.
quadbounds() Used for func_breakable_surf. Automatically sets the 4 corners of the textured face on save.
Blank image.pngTodo: Does this also control the "error" keyvalue?
worldtext() (only in CS:GO engine branchStrata SourceHammer++) Displays the contents of the message keyvalue in the 3D viewport.

Entity Description

The entity help box containing the message written on the left.

The entity description is a very important thing, as it the one single piece of help you can see in Hammer without consulting any website or developer, by pressing the "Help" button.
Each line of a description may not exceed 125 letters, in which case you must terminate the line and append a + at the end to start a new line in the FGD.
You may write \n To insert a line break, where hammer will start writing on a new line. You may also enter \n \n to skip one line entirely.

Warning.pngWarning:Quotation marks " " are not allowed inside the description, as this will terminate the string. Use Apostrophes ' ' instead.
@PointClass = example_entity :
    "This is an example description for this example entity. It will appear in the help dialog for this entity.\n " +
    "Sometimes a description string gets very long, which cause errors. In which case we need to terminate the line and " +
    "append a + to the end, telling Hammer the next line is a continuation of the current line. Like in this example.\n " +
    "Note how the Quotation mark appears after a space at the end of the line. Without it, the words between lines get merged"
[
    // (entity properties go here)
]

Entity Properties

Everything between the main set of square brackets [ ] is used to define the entity's properties, including their keyvalues, inputs and outputs.


Keyvalues

Individual keyvalues consist of

  1. a name of at most 31 characters,
  2. a value type declaration in round brackets,
  3. (optional) a colon followed by a string as the SmartEdit display name,
  4. (optional) a colon followed by either a default value or no value and
  5. (optional) a colon followed by a string as the description.
PlacementTip.pngExample:
health(integer)
health(integer) : "Strength"
health(integer) : "Strength" : 1
health(integer) : "Strength" : 1 : "Number of points of damage to take before breaking. 0 means don't break."
health(integer) : "Strength" :   : "Number of points of damage to take before breaking. 0 means don't break."
Icon-Important.pngImportant:The default value is autofilled by the map editor; if an entity should not have a certain keyvalue by default, then the default value should be left blank!

The most common value types are:

Property Type Supported Editors Description
string Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
A character sequence. The default value must have quotation marks " " around it.
integer Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
A whole number.
Icon-Bug.pngBug:In Hammer Hammer, the default value may not be quoted.
Other editors, like J.A.C.K. J.A.C.K. and TrenchBroom TrenchBroom allow quoted integers.
float Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
A decimal number. The default value must be quoted unless it is a whole number with no decimal point.
Confirm.pngConfirm: Appears to accept scientific notation such as 1.2e-3?
boolean Hammer Hammer 4.x
(in all games since Alien Swarm)

Slammin' Source Map Tools Slammin' Hammer 5.2

(also in Garry's Mod)
A value that is either true (1) or false (0). This type needs a default value and it must be either 0 or 1. This creates a dropdown menu for the values Yes/No. For older versions of Hammer, use choices instead.
Warning.pngRisk of Confusion:For keyvalues it is boolean but for I/O it is bool.
Tip.pngTip:For editors without Boolean, use choices instead, as so:
Property_name_5(choices) : "Display name" : 0 =
[
    0 : "No"
    1 : "Yes"
]
flags Hammer 3.x Hammer 3.x (spawnflags KV only)
Hammer Hammer 4.x (spawnflags KV only)
J.A.C.K. J.A.C.K. (spawnflags KV only)
TrenchBroom TrenchBroom
An integer value that is (supposed to be) read bitwise, making it ideal for multiple boolean values. All editors except TrenchBroom TrenchBroom only actually read it bitwise for the spawnflags property. See below.
choices Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
TrenchBroom TrenchBroom
A value that must be one of a pre-defined set of values. This keyvalue type lets you setup a dropdown menu with a number of distinct choices.
Property_name_5(choices) : "Display name" : 1 =
[
    // <value> : "Display Value"
    0 : "something"
    1 : "something else (default)"
    2 : "something completely different"
]

You can also use strings (or floats) as values, instead of integers, like this:

Property_name_5(choices) : "Model used" : "models/something02.mdl" =
[
    "models/something01.mdl" : "something"
    "models/something02.mdl" : "something else (default)"
    "models/something03.mdl" : "something completely different"
]

Flags and Choices do not function as input/output types.

PlacementTip.pngExample:
Property_name_1(string) 	: "Example String Name"		: "Example"	: "Keyvalue Description"
Property_name_2(integer) 	: "Example Interger Name"	: 15		: "Keyvalue Description"
Property_name_3(float)		: "Example Float Name" 		: "1.5"		: "Keyvalue Description"
Property_name_4(boolean)	: "Example Boolean Name"	: 1 		: "Keyvalue Description"
Note.pngNote:The third value, depicted here as "Example", 15, 1.5 and 1 are the default values. Those will always be there when the entity is being placed. Some string values can also be left empty by using "". in which case there is no default value at all.
Note.pngNote:Unlike entity descriptions, keyvalue descriptions can not make use of \n. Only workaround is to manually find out how many spaces you need to fill up a line in the description window.


There is also a number of special purpose property types that modify the entity properties dialog UI, for example to allow for easy browsing for files or easier manipulation of complex properties like colors or angles.

Blank image.pngTodo: Document supported variable types in Hammer 3.x Hammer 3.x and TrenchBroom TrenchBroom.
Property Supported Editors Description
angle Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
Adds an angle widget for this property to the entity dialog UI.
angle_negative_pitch Hammer Hammer 4.x Identical to angle, except the pitch is inverted.
axis Hammer Hammer 4.x Adds a relative 2-point axis helper.
color255 Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
Adds a button that brings up the color choosing UI, which takes the color you select and translated it into the three-number RGB value. Allows extra parameters (e.g., brightness).
color1 Hammer 3.x Hammer 3.x
Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
Adds a color button, but uses a float [0,1] instead of an integer (0,255). Allows extra parameters (e.g., brightness).
decal Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
  • J.A.C.K. Identical to shader, except it will automatically filter to decals.wad (if loaded). Doesn't allow manually typing the texture name in SmartEdit mode.
  • Hammer Identical to material, except it will automatically replace your search filter with decals/ when opening the material browser.
    Note.pngNote:Sometimes, the material you want will be in overlays/ or in another folder entirely.
effect J.A.C.K. J.A.C.K.
Confirm:Same as shader? Might be a leftover from Volatile3D support.
filterclass Hammer Hammer 4.x Marks property as being the name of the filter to use.
instance J.A.C.K. J.A.C.K.
Confirm:Found in executable; does it work?
instance_file Hammer Hammer 4.x Adds a button that brings up the file browser, letting you browse for instance files.
instance_parm Hammer Hammer 4.x Used in func_instance_parms to define fixup variables.
instance_variable Hammer Hammer 4.x Used in func_instance to set fixup variables.
material Hammer Hammer 4.x Adds a button that brings up the texture browser.
node_dest Hammer Hammer 4.x Adds an eyedropper to select a node in the 3d view
node_id Hammer Hammer 4.x
(in all games since Alien Swarm)
On nodes, this is used for the Node ID keyvalue to automatically increment it with each consecutive node placed. Does not appear to function when used on other entities.
npcclass Hammer Hammer 4.x Adds a drop-down selection list populated by entities of the NPCClass type.
origin Hammer Hammer 4.x The origin of the entity; automatically updates when the entity (and/or its origin) is moved in the 2D or 3D viewports.
particle J.A.C.K. J.A.C.K.
Confirm:Found in executable; what does this do? Might be a leftover from Volatile3D support.
particlesystem Hammer Hammer 4.x
(in all games since Alien Swarm)
Adds a button that brings up the particle browser, letting you browse for particle systems.
Icon-Bug.pngBug:The particle browser cannot read files from VPKs!
Note.pngFix:You will need to extract the game's PCF files for anything to appear.
pointentityclass Hammer Hammer 4.x Adds a drop-down selection list populated by entities of the PointClass type.
scene Hammer Hammer 4.x Adds a button that brings up the sound browser, letting you browse for scene files.
script Hammer Hammer 4.x
(in all games since Left 4 Dead 2)
Adds a button that brings up the file browser, letting you browse for VScripts.
scriptlist Hammer Hammer 4.x
(in all games since Left 4 Dead 2)
Adds a button that brings up a list of VScripts with buttons to add/remove scripts and open each file.
Note.pngNote:Vscript browser is most of the time empty. Instead a Vscript name without extension will work just fine.
shader J.A.C.K. J.A.C.K. Adds a button that brings up the texture browser.
  • J.A.C.K. Doesn't allow manually typing the texture name in SmartEdit mode.
sidelist Hammer Hammer 4.x Adds a side selection eyedropper that allows you to choose sides (multiple with Ctrl).
sky J.A.C.K. J.A.C.K. Displays a drop down list of all available skyboxes, in 🖿./gfx/env in GoldSrc and Quake modes, or in 🖿./env in Quake II mode. No effect in Quake III mode.
sound Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
  • J.A.C.K. - Brings up the file browser, starting in the 🖿sounds directory and narrowing search to WAV files.
  • Hammer - Adds a button that brings up the sound browser, letting you browse for soundscripts or raw sound files.
sprite Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
  • J.A.C.K. - Brings up the file browser, starting in the 🖿sprites/ directory. Narrows search to only SPR files in Quake and Half-Life Half-Life modes, and only SP2 files in Quake II mode (no filter in Quake III mode).
  • Hammer - Identical to material, except it will automatically replace your search filter with sprites/ when opening the material browser, and it will add .vmt to the end of the material name.
studio Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
  • Hammer Adds a button that brings up the model browser.
  • J.A.C.K. - Brings up the file browser, starting in the 🖿models/ directory. Narrows search to:
target_destination Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
Marks property as another entity's targetname.
target_name_or_class Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
Marks property as another entity's targetname or classname.
target_source Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
Marks property as being the name that other entities may target.
vecline Hammer Hammer 4.x Adds an absolute 1-point axis helper, similar to the origin marker.
vector Hammer Hammer 4.x
J.A.C.K. J.A.C.K.
3D vector property. A string consisting of three space delimited numbers.

Inputs and Outputs

Individual inputs and outputs consist of

  1. the keyword input or output,
  2. a name,
  3. a value type declaration in round brackets and
  4. (optional) a colon followed by a string as the description.
PlacementTip.pngExample:
input Enable(void)
input Enable(void)  : "Enable this entity."

output OnTakeDamage(void)
output OnTakeDamage(void) : "Fired each time this breakable takes any damage."

The possible types include void, integer, float, string, bool where void means no value.

Warning.pngRisk of Confusion:For keyvalues it is boolean but for I/O it is bool.


Flags

	spawnflags(flags) =
	[
		         1 : "Flag 01" : 0
		         2 : "Flag 02" : 0
		         4 : "Flag 03" : 0
		         8 : "Flag 04" : 0
		        16 : "Flag 05" : 0
		        32 : "Flag 06" : 0
		        64 : "Flag 07" : 0
		       128 : "Flag 08" : 0
		       256 : "Flag 09" : 0
		       512 : "Flag 10" : 0
		      1024 : "Flag 11" : 0
		      2048 : "Flag 12" : 0
		      4096 : "Flag 13" : 0
		      8192 : "Flag 14" : 0
		     16384 : "Flag 15" : 0
		     32768 : "Flag 16" : 0
		     65536 : "Flag 17" : 0
		    131072 : "Flag 18" : 0
		    262144 : "Flag 19" : 0
		    524288 : "Flag 20" : 0
		   1048576 : "Flag 21" : 0
		   2097152 : "Flag 22" : 0
		   4194304 : "Flag 23" : 0
		   8388608 : "Flag 24" : 0
		  16777216 : "Flag 25" : 0
		  33554432 : "Flag 26" : 0
		  67108864 : "Flag 27" : 0
		 134217728 : "Flag 28" : 0
		 268435456 : "Flag 29" : 0
		 536870912 : "Flag 30" : 0
		1073741824 : "Flag 31" : 0
		2147483648 : "Flag 32" : 0
	]

The flags tab of an entity is configured through its keyvalue named "spawnflags" using the value type "flags". This keyvalue type has a different syntax as seen in the following example:

  • After spawnflags(flags) follows an equals sign and a body surrounded by square brackets [ ] containing a number of flags.
  • Each flag consists of an integer as flag value, a colon, a display string and optionally another colon followed by a default value of 0 or 1.

The flag value should be a power of 2 (20=1, 21=2, 22=4, etc.).
Their default values are either 0 (off) or 1 (on), indicating that the flag's checkbox is either not ticked or ticked. If no default is specified, it is considered off.

PlacementTip.pngExample:
spawnflags(flags) =
[
    // <flag value 2^i> : "Checkbox Display Text" : <is ticked by default?>

    1 : "something clever"   : 1
    2 : "something else"     : 0
    4 : "you said what now?" : 0
    8 : "nothing"            : 1
]

Due to an integer size of 4 bytes, there can be at most 32 disjoint flags. On the right is a template for all possible flag values, namely 20, ..., 231.

Icon-Important.pngImportant:Hammer Hammer and J.A.C.K. J.A.C.K. only support GUI flags selection for the spawnflags KV. TrenchBroom TrenchBroom supports GUI flags selection for any KVs using the flags type.

Other File Sections

Blank image.pngTodo: Hammer++ Hammer++ has @ExtendClass for adding to existing entities; document this.

@mapsize

This value defines how big a map is allowed to be:

  • Hammer Changes the maximum usable area.
  • J.A.C.K. Warns the user if the maximum map size in the application settings is lower than this.
  • TrenchBroom Overrides the default soft map bounds defined in gameconfig.cfg (this can be further overridden on a per-map basis).

This should be used with caution:

  • Source Unless the game has been coded to allow this size, using anything beyond default values will cause VBSP to crash.
  • GoldSrc Unless the game has been coded to allow this size, geometry outside of the soft bounds will have no collision and be clipped off.
  • Source 2 Geometry outside of the soft bounds will have no lighting or collision and be clipped off

Default values per-engine:

Source Source, Source 2 Source 2
@mapsize(-16384, 16384)
GoldSrc GoldSrc, Quake Quake (protocol 666), Quake II Quake II (pre-remaster)
@mapsize(-4096, 4096)
Quake III Quake III
@mapsize(-65536, 65536)

@include

If the game you are writing your FGD for has a lot in common with another game (Half-Life 2 Half-Life 2 and Half-Life 2: Deathmatch Half-Life 2: Deathmatch, for example), you can @include a file that has all of the common structures defined in it. This allows your FGD to read all the data of that FGD.
@Include can be nested. Meaning a game can include another game's FGD, which already includes the base.fgd. For example Half-Life 2: Deathmatch Half-Life 2: Deathmatch has a FGD which @include's halflife2.fgd, which in turn @include's the base.fgd.
The game or mod you are creating must ship with all FGD's that your own mod is including.

@include "base.fgd"

The included FGD should be in the same directory as the FGD it is being called from.

Warning.pngWarning:This will include all entities of the included FGD, making them all appear in your Hammer map editor even if your game does not even have these entities coded.
If you only need a few base classes and entities, it would be recommended to only copy those few into your own FGD.
Icon-Important.pngImportant:Unlike Hammer Hammer and J.A.C.K. J.A.C.K., TrenchBroom TrenchBroom doesn't currently support manually using multiple FGDs at the same time. As such, GoldSrc GoldSrc mappers using TrenchBroom should add the following to the top or bottom in their game's FGD, to allow zhlt.fgd to be loaded:
@include "zhlt.fgd"

@BaseClass

A BaseClass is used to setup structures that are used by several different entities via the base(BaseClassName) to the main definition line of the structure.
The BaseClass structure is defined just like a normal entity in all respects. The only difference is that it doesn't appear in the entity lists in Hammer.

@BaseClass = Angles
[ 
	angles(angle) : "Pitch Yaw Roll (Y Z X)" : "0 0 0" : "This entity's orientation in the world. Pitch is rotation around the Y axis, " +
		"yaw is the rotation around the Z axis, roll is the rotation around the X axis."
]

@BaseClass = Origin
[ 
	origin(origin) : "Origin (X Y Z)" : : "The position of this entity's center in the world. Rotating entities typically rotate around their origin."
]

@MaterialExclusion

(only in Hammer) These lists define paths that Hammer's Material Browser will not use when presenting you with a palette of textures to choose from. It should have no effect on what files are actually available to a custom map.

Note.pngNote:Any folder called models/ will always be excluded, regardless of what is set here.
@MaterialExclusion
[
    // Names of the sub-directories we don't want to load materials from
    "debug"
    "engine"
    "hud"
    "vgui"
]

@AutoVisGroup

(only in Hammer) This permits customizing the automatic Visgroups tab of the Filter Control toolbar. The first title is the name of the "parent," and the next is the "children." Finally comes a list of entity classes that will be placed in the visgroup.
If the parent already exists, the new entry will be merged with the previous ones (including the default list of groups). This permits creating trees with multiple levels of grouping. If a visgroup becomes entirely empty, it will not appear in the list.
You may add entities to existing groups if the "Parent" of the autovisgroup is the name of an existing group, like "World Details". For example, you could add func_brush to the list "World Details".

Warning.pngWarning:Having too many AutoVisGroups can cause hammer to lag on startup and during runtime.
@AutoVisGroup = "Brushes"
[
    "Triggers"
    [
        "trigger_once"
        "trigger_multiple"
    ]
    "Tool Brushes"
    [
        "func_areaportal"
        "func_viscluster"
    ] 
]

@AutoVisGroup = "Tool Brushes"
[
    "Vis Clusters"
    [
        "func_viscluster"
    ]
]

Source 2 Additions

The following things have been found in Source 2 Source 2 FGD files. These will not work in Source 1.

Blank image.pngTodo: Find more things that are not listed here. Explain what these do. So far only occurrences of Half-Life: Alyx FGD's have been pasted here for documenting them.

Classes

Class Name Description
@OverrideClass This can be used to quite literally overwrite data of existing entities, as well as adding new keyvalues and inputs/outputs.
@CableClass
Blank image.pngTodo: Explain what this does.

Half-Life: Alyx Seen in models_gamedata.fgd
@PathClass
Blank image.pngTodo: Explain what this does.

Half-Life: Alyx Seen in base.fgd
Examples of these Classes
@OverrideClass 
// Add an override of player start in order to add it to the ui.
@OverrideClass 
	metadata
	{
		entity_tool_name = "Player Start" 
		entity_tool_group = "Player"
		entity_tool_tip = "Entity which specifies where the player will start."
	}
= info_player_start :
[
]

@OverrideClass = npc_cscanner
[
	//Adds one single input to the npc_cscanner entity, which already existed in HL2 and is in halflife2.fgd
	//Doing this is easier than completely redefining the entire entity.
	input SpawnAsAltScanner(void): "Spawns the Russell skin/bodygroup scanner"
]


@CableClass 
@CableClass = cable_static
[
]
@CableClass base( Targetname, Parentname, Global, RenderFields, Glow, EnableDisable) sphere(fademindist) sphere(fademaxdist) = cable_dynamic
[
	secondary_material(material) : "Secondary Material" : "" : "Optional secondary material, can be selected using Skin(1)"
	lightingorigin(target_destination) : "Lighting Origin" : "" : "Select an entity to specify a location to sample lighting from, instead of using this entity's origin."
	disableshadows(boolean) [ group="Misc" ] : "Disable Shadows" : 0 : "Used to disable dynamic shadows on this entity."

	// Inputs
	input TurnOn(void) : "Make the prop visible."
	input TurnOff(void) : "Make the prop invisible."
	input Skin(integer) : "Changes the model skin to the specified number."
	input EnableCollision(void) : "Enable collision on the prop."
	input DisableCollision(void) : "Disable collision on the prop."
	input SetNavIgnore(boolean) : "Enable and disable NAVIgnore on the prop."
	input DisableShadow(void) : "Turn shadow off."
	input EnableShadow(void) : "Turn shadow on."
	input AlternativeSorting(bool) : "Used to attempt to fix sorting problems when rendering. True activates, false deactivates"
	input SetRenderAttribute(string) : "Set the value of a render attribute used in material dynamic expressions. Examples: $myfloat=0.25 $myfloat4=1.0,0.0,1.0,1.0"
]


@PathClass 
@PathClass base(Targetname) tags( Particles ) particle_rope() 
	metadata
	{
		default_interpolation = "linear"
	}
= path_particle_rope
[
	effect_name(particlesystem) [report] : "Particle System Name" : "particles/entity/path_particle_cable_default.vpcf"
	start_active(boolean) : "Start Active" : 1 : "Will the particle system be visible on spawn"
	max_simulation_time(float) : "Max Time To Simulate" : 0 : "Max number of seconds to run the particle simulation for. A value of 0 means run the simulation indefinitely."
	particle_spacing(float) : "Spacing" : 32 : "Units between the individual partcles in the rope simulation."
	slack(float) : "Slack" : "0.5" : "Controls the amount the rope will drop between path nodes. Generally between 0.0 and 1.0, the value is a multiplier on the distance that particles on path can seperate relative to their initial distance."
	radius(float) : "Radius" : "4.0" : "Radius of the rope."
	static_collision( bool ) : "Create Static Collision" : "0" : "Create a static physics representation of the path. Note the collision is generated based on the path, movement applied by the particle system will not be included."
	surface_properties(surface_properties) : "Surface Properties" : "" : "Surface properties to apply to the static collision if generated"
	color_tint(color255) : "Color Tint" : "255 255 255"
			
	// Inputs
	input Start(void) : "Tell the particle system to start emitting."
	input Stop(void) : "Tell the particle system to stop emitting."
	input StopPlayEndCap(void) : "Tell the particle system to stop emitting and play its End Cap Effect."
	input DestroyImmediately(void) : "Destroy the particle system and remove all particles immediately."
	input SetRadius( float ) : "Set the radius parameter provided the particle system"
	input SetSlack( float ) : "Set the slack parameter which may be used by the particle system to determine how much the rope droops."
	input DisablePin( string ) : "Disable the contraint which pins a particle to the specified path node."
]

Other commands

Class Name Description
@Exclude This can exclude individual entities that are in @include'd FGD's. One entity per line
@EntityGroup
Blank image.pngTodo: Explain what this does.

Half-Life: Alyx Seen in hlvr.fgd
@struct
Blank image.pngTodo: Explain what this does.

Half-Life: Alyx Seen in workshop_addoninfo.fgd
@ModelGameData Custom game-based properties that will be embedded in the model's $keyvalues. These will show up in ModelDoc as GameData nodes.

Half-Life: Alyx Seen in models_gamedata.fgd
@ModelBreakCommand
Blank image.pngTodo: Explain what this does.

Half-Life: Alyx Seen in models_gamedata.fgd
Seems to work simillar to $collisiontext
@ModelAnimEvent
Blank image.pngTodo: Explain what this does.

Half-Life: Alyx Seen in models_base.fgd
Seems to work simillar to Animation_Events in Sequences.
Metadata
{
entity_tool_name = <string>
entity_tool_tip = <string>
entity_tool_group = <string>
}
Blank image.pngTodo: Explain what this does.

Half-Life: Alyx Seen in hlvr.fgd
Deprecated() Marks a property as depracated and no longer in use.
Examples of these commands

Below are expandable examples of the above listed commands.
We currently do not have any more good information on what these commands do, but at least we have examples of how to use them.


@exclude 
// Excluded entities. These are entities that are included from lower level fgd files that aren't 
// functional or useful in this mod. Excluding them removes them from the list of entities aviable 
// in Hammer or any other tool that loads the fgd. If support is added for any of the entities the 
// exclude can simply be removed.

// These entities have been excluded because are deprecated light entities which are
// explictly not supported, don't add these back unless you are working on lighting.
@exclude color_correction_volume
@exclude env_fog_controller
@exclude env_time_of_day
@exclude env_lightglow
@exclude env_particlelight
@exclude env_sun
@exclude fog_volume
@exclude info_lighting
@exclude light_dynamic
@exclude light_irradvolume
@exclude point_spotlight
@exclude postprocess_controller
@exclude shadow_control


@EntityGroup 
// Entity groups. This list specifies which entity groups will show up in the entity tool and in what
// order. If an entity specifies a group that is not in this list it will not be displayed in the tool.
// This allows the mod specific fgd to control the ui.
@EntityGroup "Player" {	start_expanded = true }
@EntityGroup "Lighting" { start_expanded = true }
@EntityGroup "Fog & Sky" { start_expanded = true }
@EntityGroup "NPCs" { start_expanded = true }
@EntityGroup "Items"
@EntityGroup "Ammo"
@EntityGroup "Logic"


@Struct 
@struct = map_extension : [ parent_map(string) : "Parent Map" : "" : "This is the map that you are extending (eg. <font color='cyan'>{{mono|a1_intro_world}}</font>) - when it loads, your extension map will also be loaded." extension_map(string) : "Extension Map" : "" : "Name of a map to overlay on top of the parent map." ]


@ModelGameData 
@ModelGameData = prop_data
[
	base(propdataname) 		: "Base Prop" : : "Base keys (entry from propdata.txt)"
	allowstatic(boolean) 	: "Allow As Static Prop" : 0
	bakelighting(boolean)	: "Bake Lighting As Static Prop" : 1
	damage_table(choices) 	: "Damage Table" : "" : "" =
	[
		""						:	"Inherit Default"
		"player"				:	"Player"
		"player_vehicle"		:	"Player Vehicle"
		"npc"					:	"NPC"
		"glass"					:	"Glass"
		"props"					:	"Props"
		"prevent_impact_damage"	:	"Prevent All Impact Damage"
	]
	dmg.bullets(float) 		: "Damage Bullets" : -1
	dmg.club(float) 		: "Damage Club" : -1
	dmg.explosive(float) 	: "Damage Explosive" : -1
	dmg.fire(float) 		: "Damage Fire" : -1
	health(float) 			: "Health" : -1
	spawn_motion_disabled(boolean) : "Spawn as Motion-Disabled" : 0
]


@ModelBreakCommand 
@ModelBreakCommand base(base_break_force)
= break_uniform_burst : "Applies a radial burst to breakpieces outwards from the influence point (default is the origin of the model)"
[
	burst_scale(float) [ min="0", max="500" ]		: "Burst Scale"					: 0		: "Velocity added to each piece (radially away from the influence point)"
	burst_randomize(float) [ min="0", max="500" ]	: "Burst Randomize"				: 0		: "Magnitude of random vector that will be added to the burst velocity"
]

@ModelBreakCommand base(base_break_force)
= break_flip_pieces : "Applies an angular 'flip' to breakpieces (like objects tipping over from an explosion or flower petals opening) causing them to tip outwards from the influence point (default is the origin of the model)"
[
	burst_scale(float) [ min="-500", max="500" ]	: "Flip Scale"					: 0		: "Angular velocity added to each piece (Positive value will cause pieces to flip 'head-first' away from the influence point, negative is 'feet-first')"
	burst_randomize(float) [ min="0", max="500" ]	: "Flip Randomize"				: 0		: "Largest possible value that will be randomly added/removed to Flip Scale for each piece"
]

@ModelBreakCommand base(base_break_force)
= break_twist_pieces : "Applies an angular 'twist' to breakpieces, causing them to roll around the radial axis outward from the influence point (default is the origin of the model)"
[
	burst_scale(float) [ min="-500", max="500" ]	: "Twist Scale"					: 0		: "Angular velocity added to each piece"
	burst_randomize(float) [ min="0", max="500" ]	: "Twist Randomize"				: 0		: "Largest possible value that will be randomly added/removed to Twist Scale for each piece"
]


@ModelAnimEvent 
@ModelAnimEvent = AE_CL_PLAYSOUND_ATTACHMENT
[
	name(sound) [report] : "Sound"
	attachment(model_attachment) : "Attachment"
	stop_on_seq_change(bool) : "Auto-stop on sequence change or death" : "0"
	use_layer_sequence(bool) : "Use Layer Sequence" : "0"
	tags(string)				: "Tags"
]
@ModelAnimEvent = AE_COMPANION_PRODUCE_FLARE 
[
	attachment(model_attachment) : "Attachment"
]

@ModelAnimEvent = AE_STRIDER_SHOOTMINIGUN 
[
	target(string) : "Target"
]


Metadata 
@PointClass base(BasePropPhysics, Targetname, Parentname ) model( "models/props_combine/health_charger/health_vial.vmdl" )
	metadata
	{
		entity_tool_name = "Health Station Vial"
		entity_tool_tip = "Vial used to power a health station"
		entity_tool_group = "Items"
	}
= item_hlvr_health_station_vial : "Health Vial"
[
	vial_level(float) : "Health Vial Level (0-1)" : "1" : "Amount of health the vial starts with."
]


deprecated() 
@ModelAnimEvent deprecated() = AE_STRIDER_FOOTSTEP_LEFT [ ]
@ModelAnimEvent deprecated() = AE_STRIDER_FOOTSTEP_RIGHT [ ]
@ModelAnimEvent deprecated() = AE_STRIDER_FOOTSTEP_BACK [ ]
@ModelAnimEvent deprecated() = AE_MARINE_FOOTSTEP [ ]
@ModelAnimEvent deprecated() = AE_FOOTSTEP_LEFT [ ]
@ModelAnimEvent deprecated() = AE_FOOTSTEP_RIGHT [ ]
@ModelAnimEvent deprecated() = AE_SV_FOOTSTEP_LEFT [ ]
@ModelAnimEvent deprecated() = AE_SV_FOOTSTEP_RIGHT [ ]
@ModelAnimEvent deprecated() = AE_ANTLION_FOOTSTEP_HEAVY [ ]
@ModelAnimEvent deprecated() = AE_ANTLION_FOOTSTEP_SOFT [ ]

Files

The FGD files of a Source Source 1 game can be found under <steam directory>/steamapps/common/<full game name>/bin/*.fgd, for example .../common/Half-Life 2/bin/halflife2.fgd.

See also

External links

  • SE FGD's Updated FGD's for some Valve games, made by Pinsplash.
  • Forge Game Data Language .fgd syntax highlighting available in textmate format (SublimeText Compatible)


Stub

This article or section is a stub. You can help by adding to it.