FGD: Difference between revisions
Notfoundname (talk | contribs) m (→External links) |
Kestrelguy (talk | contribs) m (some formatting and punctuation fixes.) |
||
Line 1: | Line 1: | ||
{{lang|FGD}} | {{lang|FGD}} | ||
[[FGD]] stands for '''F'''orge '''G'''ame '''D'''ata. It is the file extension for [[Hammer]]'s game definition files. They define all of the [[entity|entities]] of a game so mappers can select them from within the editor. It is a key point to understand that an FGD is nothing more than a reference. You cannot create or modify entities by editing a FGD, you merely give [[Hammer]] 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. For Custom FGD files to work in Hammer, they must be added through Tools > Options. | |||
{{note|FGDs are loaded in alphabetical order. If you do not use <code>@include "base.fgd"</code> at the top of your FGD and it is loaded before <code>base.fgd</code>, you will encounter errors.}} | |||
{{todo|{{Source2|2}} adds some extra features to the FGD format. document those.}} | |||
{{note| | |||
{{todo| | |||
==History== | ==History== | ||
While Hammer was originally called [[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. | |||
==File Format== | |||
The FGD file follows a fairly simple format. It is a script file that sets up entity structures and relationships for Hammer. The various parts of the [[Half-Life 2.fgd|''Half-Life 2'' FGD]] (found in your SDK binary directory, for example: <code>(path_to_steam)/SteamApps/common/Source SDK Base 2013 Singleplayer/bin/</code>) are explained below. | |||
==File | |||
The FGD file follows a fairly simple format. | |||
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= | //====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= | ||
Line 25: | Line 20: | ||
@include "base.fgd" | @include "base.fgd" | ||
If the game you are writing your FGD for has a lot in common with another game ( | If the game you are writing your FGD for has a lot in common with another game ({{hl2|2}} and {{css|2}}, for example), you can <code>include</code> a file that has all of the common structures defined in it. The FGDs for ''Half-Life 2'' and ''Counter-Strike: Source'' both <code>include</code> the <code>base.fgd</code> file, and the FGD for {{hl2dm|2}} <code>include</code>s the <code>halflife2.fgd</code> file. | ||
@BaseClass base(BaseNPC) = TalkNPC | @BaseClass base(BaseNPC) = TalkNPC | ||
Line 33: | Line 28: | ||
] | ] | ||
A | A <code>BaseClass</code> is used to setup structures that are used by several different entities. They are referenced in an entity structure by adding <code>base(BaseClassName)</code> to the main definition line of the structure. The <code>BaseClass</code> 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. (We'll discuss the complete entity structure below). | ||
@PointClass base(Targetname, Origin) studio("path/model.mdl") = example_entity : "example" | @PointClass base(Targetname, Origin) studio("path/model.mdl") = example_entity : "example" | ||
Line 39: | Line 34: | ||
spawnflags(flags) = | spawnflags(flags) = | ||
[ | [ | ||
32 : "A flag" : 0 // 0 means the flag | 32 : "A flag" : 0 // 0 means the flag isn't ticked by default | ||
64 : "Another flag" : 1 // 1 means the flag is ticked by default | 64 : "Another flag" : 1 // 1 means the flag is ticked by default | ||
] | ] | ||
Line 62: | Line 57: | ||
] | ] | ||
Above is a generic example of an entity structure as defined in the FGD. | Above is a generic example of an entity structure as defined in the FGD. Let's break it down bit by bit, starting with the first line: | ||
* '''@PointClass''' - The class type of an entity tells Hammer how this entity can be placed. | * '''<code>@PointClass</code>''' - The class type of an entity tells Hammer how this entity can be placed. | ||
<blockquote> | <blockquote> | ||
* | * <code>@PointClass</code> - This entity exists at a certain non-arbitrary point. It is typically referred to as a "[[point entity]]." The entities are placed within Hammer by using the Entity tool (Shift+E). | ||
* | * <code>@NPCClass</code> - This is a special form of point entity tailored for [[NPC]] (non-player character) entities. It is useful in conjunction with the <code>npcclass</code> property type (see below). | ||
* | * <code>@SolidClass</code> - This entity's area is defined by the solid (also referred to as a brush) that it is attached to. It is typically referred to as a "brush entity" or "solid entity." | ||
* | * <code>@KeyFrameClass</code> - Used for {{ent|move_rope}} and {{ent|keyframe_rope}}. This causes the <code>NextKey</code> property to be linked up when the entity is copied. | ||
* | * <code>@MoveClass</code> - Used for {{ent|path_track}} and similar entities. This causes the <code>target</code> property to be linked up when the entity is copied. | ||
* | * <code>@FilterClass</code> - One of the special [[Filter|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 <code>filterclass</code> type. | ||
</blockquote> | </blockquote> | ||
* '''base(Targetname, Origin)''' - Things between the type declaration and the "=" character help to define properties of the entity and how it will act and be displayed in Hammer. | * '''<code>base(Targetname, Origin)</code>''' - Things between the type declaration and the "=" character help to define properties of the entity and how it will act and be displayed in Hammer. There are a number of different things that can used here. (More than one of these can be used, each separated by a space.) | ||
<blockquote> | <blockquote> | ||
* | * <code>base( ''BaseClass1, BaseClass2, …'' )</code> - This lets you attach previously defined <code>BaseClass</code>es (see above) to an entity. You can specify multiple <code>BaseClass</code>es, each separated by a comma. | ||
* | * <code>bbox( ''min,max'' )</code> - Sets the size of the entity's bounding box. | ||
* | * <code>obb( ''min,max'' )</code> - Identical to <code>bbox</code> but oriented to the entity's angles. | ||
* | * <code>color( ''red grn blu'' )</code> - This setting will change the color of the wireframe box in the Hammer 2D views. 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. | ||
* | * <code>iconsprite( "''path/sprite.vmt''" )</code> - If this is used, the specified sprite will be shown in the Hammer 3D view instead of a flat-shaded colored box. This will work along-side the <code>studio()</code> or <code>studioprop()</code> commands. If no sprite name is set, it uses the <code>model</code> property. <code>scale</code>, <code>rendermode</code>, <code>_light</code> and <code>angles</code> properties affect the sprite. | ||
* | * <code>sidelist( ''sides'' )</code> - Highlight brush faces listed in the given property (as a space-seperated ID list). If not specified, the property used is <code>sides</code>. | ||
* | * <code>sphere( ''propertyname'' )</code> - 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 <code>radius</code> property. | ||
* | * <code>studioprop( "''path/model.mdl''" )</code> - 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 <code>model</code> property will be used, if available. Multiple models can be defined. | ||
{{note|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.}} | {{note|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.}} | ||
{{note|The appearance is affected by the | {{note|The appearance is affected by the <code>skin</code> and <code>rendercolor</code> properties, similar to {{ent|prop_dynamic}}.}} | ||
* | * <code>studio( "''path/model.mdl''" )</code> - Identical to <code>studioprop()</code>, but the bounding box around the entity will ignore this model. This is useful for entities that don't render the model ingame. | ||
* | * <code>lightprop( "''path/model.mdl''" )</code> - Identical to <code>studioprop()</code>, except that the pitch of the model is inverted. | ||
* | * <code>line( ''color, start_key, start_value, end_key, end_value'' )</code> - Draws a line between two entities. The ''<code>value</code>'' properties in this entity give the names to look for in the ''<code>key</code>'' property on other entities. ''<code>key</code>'' is usually set to <code>targetname</code>. The color sets the color of the line when the entity is not selected. The second entity defaults to this one if not set. | ||
* | * <code>cylinder( ''color, start_key, start_name, start_radius, end_key, end_value, end_radius'' )</code> - Draw a cylinder between two entities. This is similar to <code>line()</code>, but with the addition of two ''<code>radius</code>'' properties that are looked up on the target entities. These define the size of the start and end of the cylinder. | ||
* | * <code>lightcone( ''inner_fov, outer_fov, color, pitch_scale'' )</code> - Renders the cone used on {{ent|light_spot}} entities. ''<code>inner_fov</code>'' is the key for the innermost cone section, ''<code>outer_fov</code>'' is the outermost. ''<code>pitch_scale</code>'' allows inverting the pitch angle when rendering the cone. Values are taken from <code>_inner_cone</code>, <code>_cone</code>, and <code>_light</code>, respectively, if they aren't specified. This reads many other values corresponding to light_spot properties. | ||
* | * <code>frustum( ''fov,near,far,color, pitch_scale'' )</code> - 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 <code>_fov</code>, <code>_nearplane</code>, <code>_farplane</code>, and <code>_light</code>, respectively. ''<code>pitch_scale</code>'' is set to -1. | ||
* | * <code>halfgridsnap</code> - When moving this entity, it will snap to half the current grid size. This is somewhat special as it takes no arguments or parentheses. | ||
* | * <code>wirebox( ''min,max'' )</code> - Draws a bounding box for two properties. <code>origin()</code> helpers should be defined as well to allow moving the points. | ||
* | * <code>size( ''-x,-y,-z,+x,+y,+z'' )</code> - Defines the size of the default cube used when no model or sprite is specified. | ||
* | * <code>origin( ''property'' )</code> - Allows positioning a vector property in the map. | ||
* | * <code>vecline( ''property'' )</code> - Allows positioning a vector property in the map. This also draws a line from the entity to the position. | ||
* | * <code>axis( ''property'' )</code> - 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. | ||
* | * <code>worldtext()</code> {{csgobranch|only}} - Displays the contents of the <code>message</code> keyvalue in the 3D viewport. | ||
The following helpers take no arguments | The following helpers take no arguments and are special-cased for specific entity types: | ||
* | * <code>decal()</code> - Renders decals on nearby surfaces. This uses the '''texture''' property to set the material to use. | ||
* | * <code>overlay()</code> - Renders overlays on a surface. (For {{ent|info_overlay}}) | ||
* | * <code>overlay_transition()</code> - Renders overlays on the intersections between water and the shore. (For {{ent|info_overlay_transition}}) | ||
* | * <code>light()</code> - Present on {{ent|light}}; its use is unknown. {{todo|Figure out what this does.}} | ||
* | * <code>sprite()</code> - Renders the sprite material specified in the <code>model</code> keyvalue ({{ent|env_sprite}} and variants). For entity icons, use <code>iconsprite</code>. | ||
* | * <code>sweptplayerhull()</code> - 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 <code>origin()</code> helpers for those properties. | ||
* | * <code>instance()</code> - Renders the [[func_instance|instance]] in the map. It also generates additional properties dynamically corresponding to the instance parameters. | ||
* | * <code>quadbounds()</code> - Used for {{ent|func_breakable_surf}}. Automatically sets the 4 corners of the textured face on save. {{todo|Does this also control the "error" keyvalue?}} | ||
</blockquote> | </blockquote> | ||
* '''example_entity : "example"''' - This is the entity's name followed by a description. | * '''<code>example_entity : "example"</code>''' - This is the entity's name, followed by a description. The description is displayed in Hammer when you click on the Help button inside the entity property dialog. For visual ease, the description can span multiple lines by joining "blocks of text" with the plus (+) character. For example: | ||
< | <pre> | ||
@PointClass = example_entity : | @PointClass = example_entity : | ||
"This is an example description for"+ | |||
"this example entity. It will appear"+ | |||
" in the help dialog for this entity" | |||
[ | [ | ||
(entity properties go here) | |||
] | ] | ||
</ | </pre> | ||
* ''' | * '''Entity properties''' - Everything between the main set of [ / ] brackets is used to define the entity's properties, including their inputs and outputs. Individual property structures consist of a name, a type declaration, a display name, a default value, and a description. The most common properties are: | ||
<blockquote> | <blockquote> | ||
* | * <code>string</code> - This creates a property of the string type. | ||
: | :<code>name(string) : "Display name" : "Default" : "Description"</code> | ||
* | * <code>integer</code> - This creates a property of the integer type. | ||
: | :<code>name(integer) : "Display name" : 1 : "Description"</code> | ||
* | * <code>float</code> - This creates a property of the float type. Although it deals with numbers, the structure of it is similar to the string type. The default value must have quotes around it. | ||
: | :<code>name(float) : "Display name" : "1.5" : "Description"</code> | ||
* | * <code>boolean</code> {{as|since}}{{Gmod|also}} - This creates a property of the boolean type, with a dropdown for yes/no. For older versions of Hammer, use choices instead. | ||
: | :<code>name(boolean) : "Display name" : 1 : "Description"</code> | ||
</blockquote> | </blockquote> | ||
:There are also two common special case property types, choices and flags, that follow a slightly different format. They do not function as input/output types. | :There are also two common special-case property types, <code>choices</code> and <code>flags</code>, that follow a slightly different format. They do not function as input/output types. | ||
<blockquote> | <blockquote> | ||
* | * <code>choices</code> - A property of this type lets you setup a number of distinct choices. Their format is similar to the other types: | ||
< | <pre> | ||
name(choices) : "Display name" : "1" = | name(choices) : "Display name" : "1" = | ||
[ | [ | ||
0 : "something" | |||
1 : "something else (default)" | |||
2 : "something completely different" | |||
] | ] | ||
</ | </pre> | ||
:You can also use strings (or floats) as values, instead of integers, like this: | :You can also use strings (or floats) as values, instead of integers, like this: | ||
< | <pre> | ||
name(choices) : "Display name" : "models/something02.mdl" = | name(choices) : "Display name" : "models/something02.mdl" = | ||
[ | [ | ||
"models/something01.mdl" : "something" | |||
"models/something02.mdl" : "something else (default)" | |||
"models/something03.mdl" : "something completely different" | |||
] | ] | ||
</ | </pre> | ||
* | * <code>flags</code> - The <code>flags</code> property type lets you setup what will appear in the Flags portion of the entity property dialog. It is set up similar to the <code>choices</code> property type. The flags are all powers of 2 (2⁰=1, 2¹=2, 2²=4, etc.), and their values are either 0 (off) or 1 (on). If no default is specified for a flag, it is considered to be off. | ||
< | <pre> | ||
spawnflags(flags) = | spawnflags(flags) = | ||
[ | [ | ||
1 : "something clever" : 1 | |||
2 : "something else" : 0 | |||
4 : "you said what now?" : 0 | |||
8 : "nothing" : 1 | |||
] | ] | ||
</ | </pre> | ||
{{note|"spawnflags" is always the name of this property. Creating a flags-type property with any other name will result in it appearing as a normal integer keyvalue.}} | |||
</blockquote> | </blockquote> | ||
:There are also a number of special purpose property types that modify the entity properties dialog UI to allow for easy browsing for files or easier manipulation of complex properties (like colors or angles). | :There are also a number of special purpose property types that modify the entity properties dialog UI to allow for easy browsing for files or easier manipulation of complex properties (like colors or angles). | ||
<blockquote> | <blockquote> | ||
* | * <code>axis</code> - Adds a relative 2-point axis helper. | ||
* | * <code>angle</code> - Adds an angle widget for this property to the entity dialog UI. | ||
* | * <code>angle_negative_pitch</code> - Identical to <code>angle</code>, except the pitch is inverted. | ||
* | * {{ent|color255}} - 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). | ||
* | * <code>color1</code> - Adds a color button, but uses a float [0,1] instead of an integer (0,255). Allows extra parameters (e.g., brightness). | ||
* | * <code>filterclass</code> - Marks property as being the name of the filter to use. | ||
* | * <code>instance_file</code> - Adds a button that brings up the file browser, letting you browse for instance files. | ||
* | * <code>instance_parm</code> - Used in {{ent|func_instance_parms}} to define fixup variables. | ||
* | * <code>instance_variable</code> - Used in {{ent|func_instance}} to set fixup variables. | ||
* | * <code>material</code> - Adds a button that brings up the material browser. | ||
* | * <code>node_dest</code> - adds an eyedropper to select a node in the 3d view | ||
* | * <code>node_id</code> {{as|since}} - On [[node]]s, 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. | ||
* | * <code>npcclass</code> - Adds a drop-down selection list populated by entities of the NPCClass type. | ||
* | * <code>origin</code> - origin | ||
* | * <code>particlesystem</code> {{as|since}} - Adds a button that brings up the particle browser, letting you browse for particle systems.{{bugfix|The particle browser cannot read files from [[VPK]]s!|You will need to extract the game's [[PCF]] files for anything to appear.}} | ||
* | * <code>pointentityclass</code> - Adds a drop-down selection list populated by entities of the <code>PointClass</code> type. | ||
* | * <code>scene</code> - Adds a button that brings up the sound browser, letting you browse for scene files. | ||
* | * <code>script</code> {{l4d2|since}} - Adds a button that brings up the file browser, letting you browse for [[VScript]]s. | ||
* | * <code>scriptlist</code> {{l4d2|since}} - Adds a button that brings up a list of VScripts with buttons to add/remove scripts and open each file. | ||
* | * <code>sidelist</code> - Adds a side selection eyedropper that allows you to choose sides (multiple with {{key|Ctrl}}). | ||
* | * <code>sound</code> - Adds a button that brings up the sound browser, letting you browse for soundscripts or raw sounds. | ||
* | * <code>{{sprite}}</code> - identical to <code>material</code>, except it will automatically replace your search filter with <code>sprites/</code> when opening the material browser, and it will add <code>.vmt</code> to the end of the material name. | ||
* | * <code>decal</code> - Identical to <code>material</code>, except it will automatically replace your search filter with <code>decals/</code> when opening the material browser.{{note|Sometimes, the material you want will be in <code>overlays/</code> or in another folder entirely.}} | ||
* | * <code>studio</code> - Adds a button that brings up the model browser. | ||
* | * <code>target_destination</code> - Marks property as another entity's <code>targetname</code>. | ||
* | * <code>target_name_or_class</code> - Marks property as another entity's <code>targetname</code> or <code>classname</code>. | ||
* | * <code>target_source</code> - Marks property as being the name that other entities may target. | ||
* | * <code>vecline</code> - Adds an absolute 1-point axis helper, similar to the origin marker. | ||
* | * <code>vector</code> - 3D vector property. | ||
</blockquote> | </blockquote> | ||
== Other | == Other File Sections == | ||
=== Material Exclusion Lists === | === Material Exclusion Lists === | ||
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. | 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. | ||
Line 212: | Line 205: | ||
=== Customizing auto-visgroups === | === Customizing auto-visgroups === | ||
This permits customizing the automatic Visgroups tab of the [[Hammer_Filter_Control_Toolbar|Filter Control]] toolbar. The first title is the name of the | This permits customizing the automatic Visgroups tab of the [[Hammer_Filter_Control_Toolbar|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. | ||
{{Note|You are able to add entities to existing groups. If the "Parent" of the autovisgroup is the name of an existing group, like "World Details" you can have your own entities be listed along "Props" and "Func Detail". For example | {{Note|You are able to add entities to existing groups. If the "Parent" of the autovisgroup is the name of an existing group, like "World Details," you can have your own entities be listed along "Props" and "Func Detail". For example, you could add {{ent|func_brush}} to the list.}} | ||
@AutoVisGroup = "''Parent''" | @AutoVisGroup = "''Parent''" | ||
[ | [ | ||
Line 251: | Line 244: | ||
] | ] | ||
] | ] | ||
[[Category:FGD]][[Category:File formats]][[category:Glossary]][[category:Level Design]] | |||
[[ | == External Links == | ||
[[ | * [https://github.com/Pinsplash/SEFGD SE FGD's] Updated FGD's for some Valve games, made by Pinsplash. | ||
[[ | * [https://github.com/Crowbar-Sledgehammer/forge-game-data-language Forge Game Data Language] <code>.fgd</code> syntax highlighting available in textmate format (SublimeText Compatible) | ||
[[ | |||
== External | |||
* [https://github.com/Pinsplash/SEFGD SE FGD's] Updated FGD's for some Valve games made by Pinsplash | |||
* [https://github.com/Crowbar-Sledgehammer/forge-game-data-language Forge Game Data Language] .fgd syntax highlighting available in textmate format (SublimeText Compatible) |
Revision as of 21:26, 16 May 2022
FGD stands for Forge Game Data. It is the file extension for Hammer's game definition files. They define all of the entities of a game so mappers can select them from within the editor. It is a key point to understand that an FGD is nothing more than a reference. You cannot create or modify entities by editing a FGD, you merely give Hammer 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. For Custom FGD files to work in Hammer, they must be added through Tools > Options.

@include "base.fgd"
at the top of your FGD and it is loaded before base.fgd
, you will encounter errors.
History
While Hammer was originally called 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.
File Format
The FGD file follows a fairly simple format. It is a script file that sets up entity structures and relationships for Hammer. The various parts of the Half-Life 2 FGD (found in your SDK binary directory, for example: (path_to_steam)/SteamApps/common/Source SDK Base 2013 Singleplayer/bin/
) are explained below.
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= // // Purpose: Half-Life 2 game definition file (.fgd) // //=============================================================================
Comments are defined simply by starting a line with //. They can be preceded by spaces or tabs.
@include "base.fgd"
If the game you are writing your FGD for has a lot in common with another game ( Half-Life 2 and
Counter-Strike: Source, for example), you can
include
a file that has all of the common structures defined in it. The FGDs for Half-Life 2 and Counter-Strike: Source both include
the base.fgd
file, and the FGD for Half-Life 2: Deathmatch
include
s the halflife2.fgd
file.
@BaseClass base(BaseNPC) = TalkNPC [ UseSentence(string) : "Use Sentence" UnUseSentence(string) : "Un-Use Sentence" ]
A BaseClass
is used to setup structures that are used by several different entities. They are referenced in an entity structure by adding 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. (We'll discuss the complete entity structure below).
@PointClass base(Targetname, Origin) studio("path/model.mdl") = example_entity : "example" [ spawnflags(flags) = [ 32 : "A flag" : 0 // 0 means the flag isn't ticked by default 64 : "Another flag" : 1 // 1 means the flag is ticked by default ] foobarname(string) : "Name" : : "Name of foobar" foobargroup(string) : "Group" : "Squad1" : "Name of foobar group" foo(float) "Floating point number" : "100.7" : "Decimal points = fun" something(integer) readonly: "first number" : 0 : "This is a number which can't be manually edited" something2(choices) : "second number" : 0 : "Your choice of numbers!" = [ 0 : "Default" 1 : "Something" 2 : "Another Thing" ] // Outputs output OnSomethingHappened(void) : "Fires when something happens" output OnSomethingElse(void) : "Fires when something else happens" // Inputs input DoSomething(void) : "Do something" ]
Above is a generic example of an entity structure as defined in the FGD. Let's break it down bit by bit, starting with the first line:
@PointClass
- The class type of an entity tells Hammer how this entity can be placed.
@PointClass
- This entity exists at a certain non-arbitrary point. It is typically referred to as a "point entity." The entities are placed within Hammer by using the Entity tool (Shift+E).@NPCClass
- This is a special form of point entity tailored for NPC (non-player character) entities. It is useful in conjunction with thenpcclass
property type (see below).@SolidClass
- This entity's area is defined by the solid (also referred to as a brush) that it is attached to. It is typically referred to as a "brush entity" or "solid entity."@KeyFrameClass
- Used for move_rope and keyframe_rope. This causes theNextKey
property to be linked up when the entity is copied.@MoveClass
- Used for path_track and similar entities. This causes thetarget
property to be linked up when the entity is copied.@FilterClass
- 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 thefilterclass
type.
base(Targetname, Origin)
- Things between the type declaration and the "=" character help to define properties of the entity and how it will act and be displayed in Hammer. There are a number of different things that can used here. (More than one of these can be used, each separated by a space.)
base( BaseClass1, BaseClass2, … )
- This lets you attach previously definedBaseClass
es (see above) to an entity. You can specify multipleBaseClass
es, each separated by a comma.bbox( min,max )
- Sets the size of the entity's bounding box.obb( min,max )
- Identical tobbox
but oriented to the entity's angles.color( red grn blu )
- This setting will change the color of the wireframe box in the Hammer 2D views. 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.iconsprite( "path/sprite.vmt" )
- If this is used, the specified sprite will be shown in the Hammer 3D view instead of a flat-shaded colored box. This will work along-side thestudio()
orstudioprop()
commands. If no sprite name is set, it uses themodel
property.scale
,rendermode
,_light
andangles
properties affect the sprite.sidelist( sides )
- Highlight brush faces listed in the given property (as a space-seperated ID list). If not specified, the property used issides
.sphere( propertyname )
- 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 aradius
property.studioprop( "path/model.mdl" )
- 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'smodel
property will be used, if available. Multiple models can be defined.Note: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.
Note:The appearance is affected by the
skin
andrendercolor
properties, similar to prop_dynamic.
studio( "path/model.mdl" )
- Identical tostudioprop()
, but the bounding box around the entity will ignore this model. This is useful for entities that don't render the model ingame.lightprop( "path/model.mdl" )
- Identical tostudioprop()
, except that the pitch of the model is inverted.line( color, start_key, start_value, end_key, end_value )
- Draws a line between two entities. Thevalue
properties in this entity give the names to look for in thekey
property on other entities.key
is usually set totargetname
. The color sets the color of the line when the entity is not selected. The second entity defaults to this one if not set.cylinder( color, start_key, start_name, start_radius, end_key, end_value, end_radius )
- Draw a cylinder between two entities. This is similar toline()
, but with the addition of tworadius
properties that are looked up on the target entities. These define the size of the start and end of the cylinder.lightcone( inner_fov, outer_fov, color, pitch_scale )
- 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.frustum( fov,near,far,color, pitch_scale )
- 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
- When moving this entity, it will snap to half the current grid size. This is somewhat special as it takes no arguments or parentheses.wirebox( min,max )
- Draws a bounding box for two properties.origin()
helpers should be defined as well to allow moving the points.size( -x,-y,-z,+x,+y,+z )
- Defines the size of the default cube used when no model or sprite is specified.origin( property )
- Allows positioning a vector property in the map.vecline( property )
- Allows positioning a vector property in the map. This also draws a line from the entity to the position.axis( property )
- 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.worldtext()
(only in) - Displays the contents of the
message
keyvalue in the 3D viewport.The following helpers take no arguments and are special-cased for specific entity types:
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.Todo: Figure out what this does.sprite()
- Renders the sprite material specified in themodel
keyvalue (env_sprite and variants). For entity icons, useiconsprite
.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 addsorigin()
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.Todo: Does this also control the "error" keyvalue?
example_entity : "example"
- This is the entity's name, followed by a description. The description is displayed in Hammer when you click on the Help button inside the entity property dialog. For visual ease, the description can span multiple lines by joining "blocks of text" with the plus (+) character. For example:
@PointClass = example_entity : "This is an example description for"+ "this example entity. It will appear"+ " in the help dialog for this entity" [ (entity properties go here) ]
- Entity properties - Everything between the main set of [ / ] brackets is used to define the entity's properties, including their inputs and outputs. Individual property structures consist of a name, a type declaration, a display name, a default value, and a description. The most common properties are:
string
- This creates a property of the string type.
name(string) : "Display name" : "Default" : "Description"
integer
- This creates a property of the integer type.
name(integer) : "Display name" : 1 : "Description"
float
- This creates a property of the float type. Although it deals with numbers, the structure of it is similar to the string type. The default value must have quotes around it.
name(float) : "Display name" : "1.5" : "Description"
boolean
(in all games since)(also in
) - This creates a property of the boolean type, with a dropdown for yes/no. For older versions of Hammer, use choices instead.
name(boolean) : "Display name" : 1 : "Description"
- There are also two common special-case property types,
choices
andflags
, that follow a slightly different format. They do not function as input/output types.
choices
- A property of this type lets you setup a number of distinct choices. Their format is similar to the other types:name(choices) : "Display name" : "1" = [ 0 : "something" 1 : "something else (default)" 2 : "something completely different" ]
- You can also use strings (or floats) as values, instead of integers, like this:
name(choices) : "Display name" : "models/something02.mdl" = [ "models/something01.mdl" : "something" "models/something02.mdl" : "something else (default)" "models/something03.mdl" : "something completely different" ]
flags
- Theflags
property type lets you setup what will appear in the Flags portion of the entity property dialog. It is set up similar to thechoices
property type. The flags are all powers of 2 (2⁰=1, 2¹=2, 2²=4, etc.), and their values are either 0 (off) or 1 (on). If no default is specified for a flag, it is considered to be off.spawnflags(flags) = [ 1 : "something clever" : 1 2 : "something else" : 0 4 : "you said what now?" : 0 8 : "nothing" : 1 ]Note:"spawnflags" is always the name of this property. Creating a flags-type property with any other name will result in it appearing as a normal integer keyvalue.
- There are also a number of special purpose property types that modify the entity properties dialog UI to allow for easy browsing for files or easier manipulation of complex properties (like colors or angles).
axis
- Adds a relative 2-point axis helper.angle
- Adds an angle widget for this property to the entity dialog UI.angle_negative_pitch
- Identical toangle
, except the pitch is inverted.- color255 - 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
- Adds a color button, but uses a float [0,1] instead of an integer (0,255). Allows extra parameters (e.g., brightness).filterclass
- Marks property as being the name of the filter to use.instance_file
- Adds a button that brings up the file browser, letting you browse for instance files.instance_parm
- Used in func_instance_parms to define fixup variables.instance_variable
- Used in func_instance to set fixup variables.material
- Adds a button that brings up the material browser.node_dest
- adds an eyedropper to select a node in the 3d viewnode_id
(in all games since) - 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
- Adds a drop-down selection list populated by entities of the NPCClass type.origin
- originparticlesystem
(in all games since) - Adds a button that brings up the particle browser, letting you browse for particle systems.
Fix:You will need to extract the game's PCF files for anything to appear.
pointentityclass
- Adds a drop-down selection list populated by entities of thePointClass
type.scene
- Adds a button that brings up the sound browser, letting you browse for scene files.script
(in all games since) - Adds a button that brings up the file browser, letting you browse for VScripts.
scriptlist
(in all games since) - Adds a button that brings up a list of VScripts with buttons to add/remove scripts and open each file.
sidelist
- Adds a side selection eyedropper that allows you to choose sides (multiple with Ctrl).sound
- Adds a button that brings up the sound browser, letting you browse for soundscripts or raw sounds.sprite
- identical tomaterial
, except it will automatically replace your search filter withsprites/
when opening the material browser, and it will add.vmt
to the end of the material name.decal
- Identical tomaterial
, except it will automatically replace your search filter withdecals/
when opening the material browser.Note:Sometimes, the material you want will be in
overlays/
or in another folder entirely.studio
- Adds a button that brings up the model browser.target_destination
- Marks property as another entity'stargetname
.target_name_or_class
- Marks property as another entity'stargetname
orclassname
.target_source
- Marks property as being the name that other entities may target.vecline
- Adds an absolute 1-point axis helper, similar to the origin marker.vector
- 3D vector property.
Other File Sections
Material Exclusion Lists
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.

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" ]
Customizing auto-visgroups
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.

@AutoVisGroup = "Parent" [ "Child 1" [ "entity name 1" "entity name 2" ] "Child 2" [ "entity name 3" "entity name 4" ] ]
Example:
@AutoVisGroup = "Brushes" [ "Triggers" [ "trigger_once" "trigger_multiple" ] "Tool Brushes" [ "func_areaportal" "func_viscluster" ] ] @AutoVisGroup = "Tool Brushes" [ "Vis Clusters" [ "func_viscluster" ] ]
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)