Pt-br/FGD

FGD (Forge Game Data) é um formato de arquivo de texto simples usado para definir todas as de um jogo para um editor de mapas, permitindo que os mapeadores possam selecionar a partir do editor e configure suas propriedades.
Embora Hammer fosse originalmente chamado de , ele foi desenvolvido sob o nome de The Forge (daí o nome Forge Game Data). Devido a questões de marca registrada, entretanto, o nome Forge não pôde ser usado na versão final do Hammer. Mesmo assim, a extensão do arquivo permaneceu.
Para que os arquivos FGD personalizados funcionem no Hammer ou Jack, eles devem ser adicionados em Ferramentas > Opções.
== 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.
== Entities ==
The syntactic components of an entity structure as defined in the FGD include:
# the class type of the entity (@PointClass),
# (optional) whitespace delimited class properties (base(...) studio(...)),
# an equals sign and the classname of the entity (example_entity_name),
# (optional) a colon followed by a description for it ("...") and
# a body surrounded by square brackets [ ] containing the entity's keyvalues, flags and .
Explanations of what each of these parameters do will be explained on this page, in order.
=== Class Types and Properties ===
The class type of an entity tells Hammer how this entity can be placed.
Class Name	Supported Editors	Description
 	 	A set of properties that can be inherited, reducing clutter. See @BaseClass.
 	 	: This entity exists at a certain non-arbitrary point. These entities are placed within Hammer by using the , .
 	 	This is a special form of point entity tailored for (Non-Player Character) entities. It is useful in conjunction with the npcclass property type (see below).
 	 	: 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 . Other solids are es.
 	 	Used for and . This causes the NextKeysprite property to be linked up when the entity is copied.
 	 	Used for and similar entities. This causes the targetsprite property to be linked up when the entity is copied.
 	 	One of the special 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.
Things between the class type declaration and the "" 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
 	 	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.
 	 	This lets you attach previously defined es (see below) to an entity. You can specify multiple BaseClasses, each separated by a comma.
 	 	Sets the size of the entity's bounding box.
 	 	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.
 	 	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.
 	 	Allows for multiple different editor flags, separated by commas:
* - Shows an arrow in the 3D view indicating which direction point entity is angled.
* - If no model is present, shows the entity as a instead of a cube or rectangular prism.
 	 	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.
 	 	When moving this entity, it will snap to half the current grid size. This is somewhat special as it takes no arguments or parentheses.
 	 	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. If no sprite name is set, it uses the model property.
scale, rendermode, _light and angles properties affect the sprite.
Uses in , in , and (QSPR and/or HLSPR) in all other editors.
 	 	Renders the cone used on 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.
 	 	Identical to studioprop(), except that the pitch of the model is inverted.
 	 	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.
 	 	A more verbose alternative to for displaying in-editor models, which supports rescaling the displayed model, displaying a specific , and display a specific frame of a , an , or an . animation s are not yet supported, but are being worked on.
Can also be used instead of for editor sprites, to select a specific frame of an to display. Sprites can also be scaled this way, although editor sprites are usually already designed to be displayed 1 pixel per unit.
 	 	Identical to bbox but oriented to the entity's angles.
 	 	Allows positioning a vector property in the map.
 	 	Highlight brush faces listed in the given property (as a space-seperated ID list). If not specified, the property used is sides.
 	 	Defines the size of the default cube used when no model or sprite is specified.
 	 	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.
 	 	Identical to studioprop(), but the bounding box around the entity will ignore this model. This is useful for entities that don't render the model ingame.
In , and , this parameter also supports other model formats besides , such as , , , ASE, and LWO.
 	 	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 (Unless hardcoded). Multiple models can be defined.
 	 	Allows positioning a vector property in the map. This also draws a line from the entity to the position.
 	 	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
 	Renders decals on nearby surfaces. This uses the texture property to set the material to use.
 	Renders overlays on a surface. (For )
 	Renders overlays on the intersections between water and the shore. (For )
 	Present on ; its use is unknown.
 	Renders the sprite material specified in the model keyvalue ( and variants). For entity icons, use iconsprite.
 	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.
 	Renders the in the map. It also generates additional properties dynamically corresponding to the instance parameters.
 	Used for . Automatically sets the 4 corners of the textured face on save.
 	Displays the contents of the message keyvalue in the 3D viewport.
=== Entity Description ===
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.
@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
# a name of at most 31 characters,
# a value type declaration in round brackets,
# (optional) a colon followed by a string as the display name,
# (optional) a colon followed by either a default value or no value and
# (optional) a colon followed by a string as the description.
The most common value types are:
Property Type	Description
 	A character sequence. The default value must have quotation marks around it.
 	A whole number. The default value may not be quoted.
 	A decimal number. The default value must be quoted unless it is a whole number with no decimal point.
: 	A value that is either (= 0) or (not 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 instead.
 	An integer value that is (supposed to be) read bitwise, making it ideal for multiple boolean values. See below.
 	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.
You can also use strings (or floats) as values, instead of integers, like this:
Flags and Choices do not function as input/output types.
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.
Property	Description
 	Adds an angle widget for this property to the entity dialog UI.
 	Identical to angle, except the pitch is inverted.
 	Adds a relative 2-point axis helper.
 	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).
 	Adds a color button, but uses a float [0,1] instead of an integer (0,255). Allows extra parameters (e.g., brightness).
 	Identical to material, except it will automatically replace your search filter with decals/ when opening the material browser.
 	Marks property as being the name of the filter to use.
 	Adds a button that brings up the file browser, letting you browse for instance files.
 	Used in to define fixup variables.
 	Used in to set fixup variables.
 	Adds a button that brings up the material browser.
 	adds an eyedropper to select a node in the 3d view
: 	On 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.
 	Adds a drop-down selection list populated by entities of the NPCClass type.
 	origin
: 	Adds a button that brings up the particle browser, letting you browse for particle systems.
 	Adds a drop-down selection list populated by entities of the PointClass type.
 	Adds a button that brings up the sound browser, letting you browse for scene files.
: 	Adds a button that brings up the file browser, letting you browse for s.
: 	Adds a button that brings up a list of VScripts with buttons to add/remove scripts and open each file.
 	Adds a side selection eyedropper that allows you to choose sides (multiple with ).
 	Adds a button that brings up the sound browser, letting you browse for soundscripts or raw sounds.
 	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.
 	Adds a button that brings up the model browser.
 	Marks property as another entity's targetname.
 	Marks property as another entity's targetname or classname.
 	Marks property as being the name that other entities may target.
 	Adds an absolute 1-point axis helper, similar to the origin marker.
 	3D vector property. A string consisting of three space delimited numbers.
==== Inputs and Outputs ====
Individual inputs and outputs consist of
# the keyword or ,
# a name,
# a value type declaration in round brackets and
# (optional) a colon followed by a string as the description.
The possible types include where means no value.
==== Flags ====
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 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.
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.
== Other File Sections ==
=== @mapsize ===
This value defines the maximum usable area in . This visually changes the area in Hammer, but unless the game has been coded to allow this size, using anything beyond default values causes to crash.
=== @include ===
If the game you are writing your FGD for has a lot in common with another game ( and , 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 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.
=== @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.
=== @MaterialExclusion ===
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.
=== @AutoVisGroup ===
This permits customizing the automatic Visgroups tab of the 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 to the list "World Details".
== Source 2 Additions ==
The following things have been found in FGD files. These will not work in Source 1.
=== Classes ===
Class Name	Description
 	This can be used to quite literally overwrite data of existing entities, as well as adding new keyvalues and inputs/outputs.
 	Seen in models_gamedata.fgd
 	Seen in base.fgd
;Examples of these Classes
=== Other commands ===
Class Name	Description
 	This can exclude individual entities that are in @include'd FGD's. One entity per line
 	Seen in hlvr.fgd
 	Seen in workshop_addoninfo.fgd
 	Seen in models_gamedata.fgdSeems to work simillar to .
 	Seen in models_gamedata.fgdSeems to work simillar to
 	Seen in models_base.fgdSeems to work simillar to in .
} 	Seen in hlvr.fgd
 	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.
== Files ==
The FGD files of a 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)