FGD

From Valve Developer Community
< Es
Revision as of 19:46, 14 May 2022 by Kestrelguy (talk | contribs) (began translating into Spanish.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
English (en)Español (es)Português do Brasil (pt-br)中文 (zh)Translate (Translate)
Info content.png
This translated page needs to be updated.
You can help by updating the translation.
Also, please make sure the article complies with the alternate languages guide.(en)
This notice is put here by LanguageBar template and if you want to remove it after updating the translation you can do so on this page.


Template:Translate:es FGD significa "Forge Game Data" (inglés para datos forgja de juego). Es la extensión para los archivos de definición de juego para Hammer. Definen todas entidades de un juego así mapeadores pueden seleccionarlos del editor. Es necesario entender que los FGD son nunca más que una fuente. No puede crear o cambiar entidades por editar los FGD, sólo cambiar lo que busca en el juego. A veces editar revela características o entidades escondidas, pero estos siempre estaba allí y pueden usarse sin FGD actualizados. Para archivos de FGD a medida funcionar en el Hammer, necesitan añadirse en "Tools > Options".

Template:Note:es

Pendiente: Source 2 añade características extras al formato de FGD. Documéntelos.

Historia

Mientras Hammer originalmente se llamaba Worldcraft, se desarrollaba bajo el nombre "The Forge" (la forja, de ahí que el nombre "Forge Game Data"). Por problemas de marca registrada, el nombre no puede usarse para la versión final de Hammer. Sin embargo, la extensión permanece.

Formato de archivo

Un archivo de FGD sigue un formato más o menos sencillo. Es un archivo de script que monta estructuras y relaciones de entidades para Hammer. Las partes diferentes del FGD de Half-Life 2 Half-Life 2 (encontrado en su directorio de binarios de SDK, por ejemplo [ruta a Steam]/Steamapps/common/Source SDK Base 2013 Singleplayer/bin/) se explican a continuación.

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

Comentarios se definen por empezar una línea con //. Pueden precederse por espacios o tabulaciones.

@include "base.fgd"

Si el juego para que escribe su FGD tiene mucho en común con un otro juego (p. ej. Half-Life 2 Half-Life 2 y Counter-Strike: Source Counter-Strike: Source), puede include (incluir) un archivo que tiene todas las estructuras comunes definidas en él. Los FGD para tanto Half-Life 2 como Counter-Strike: Source incluyen el archivo base.fgd y el FGD para Half-Life 2: Deathmatch Half-Life 2: Deathmatch incluye el archivo halflife2.fgd.

@BaseClass base(BaseNPC) = TalkNPC
[
	UseSentence(string) : "Use Sentence"
	UnUseSentence(string) : "Un-Use Sentence"
]

Una BaseClass se usa para montar estructuras que se usan por múltiples entidades diferentes. Se mencionan en una estructura por añadir base(BaseClassName) a la línea de definición principal de la estructura. La estructura BaseClass se define igual que una entidad tradicional en todo sentido. La diferencia sola es que no aparece en las listas de entidades de Hammer. (La estructura de entidad completa le habla a continuación.)

@PointClass base(Targetname, Origin) studio("ruta/modelo.mdl") = entidad_de_ejemplo : "ejemplo"
[
	spawnflags(flags) =
	[
		32 : "Un flag" : 0       // 0 significa el flag no se pone por defecto
		64 : "Otro flag" : 1     // 1 significa el flag se pone por defecto
	]

	foobarname(string) : "Nombre" : : "Nombre de foobar"
	foobargroup(string) : "Grupo" : "Squad1" : "Nombre de grupo de foobar"
	foo(float) "Número de punto flotante" : "100.7" : "Puntos decimales = divertidos"
	algo(integer) readonly: "primer número" : 0 : "Esto es un número que no puede editarse manualmente"
	algo2(choices) : "segundo número" : 0 : "Su elección de números!" =
	[
		0 : "Defecto"
		1 : "Algo"
		2 : "Otra cosa"
	]

	// Outputs
	output OnAlgoPasoo(void) : "Dispara cuando algo pasa"
	output OnOtraCosa(void) : "Dispara cuando otra cosa pasa"

	// Inputs
	input HagaAlgo(void) : "Haga algo"
]


Arriba está un ejemplo genérico de una estructura de entidad como definido en los FGD. Lo analicemos poco a poco, empezando con la primera línea:

  • @PointClass - El tipo de clase de entidad llama a Hammer como esta entidad puede colocarse.
  • @PointClass - Esta entidad existe a un punto en particular no arbitrario. Típicamente se llama un "entidad de punto" (o "point entity" en inglés). Estas entidades se colocan en Hammer por usar la herramienta de entidad ("Entity Tool", Shift+E).
  • @NPCClass - Esto es una forma de entidad de punto de sastre para entidades de NPC. Es útil junto con el tipo de propiedad npcclass, a continuación.
  • @SolidClass - La área de esta entidad se define por el sólido en que se pone. Típicamente se llama un "entidad de sólido" ("brush entity" en inglés).
  • @KeyFrameClass - Usado por move_rope y keyframe_rope. Esto causa la propiedad NextKey conectarse cuando la entidad se copia.
  • @MoveClass - Usado por path_track y entidades similares. Esto causa la propiedad target conectarse cuando la entidad se copia.
  • @FilterClass - Usado por las clases de filtro para definir cuales entidades pueden interactuar uno con el otro por alguna razón. Esto principalmente hace que la entidad muéstrese en propiedades con el tipo filterclass.
  • base(Targetname, Origin) - Cosas entre de la declaración de tipo y el carácter "=" ayudan definir propiedades de una entidad y como va a actuar y mostrarse en Hammer. Hay múltiples cosas que pueden usarse aquí. Más que uno de estos pueden usarse si cada separarse por un espacio).
  • base( 1Base, 2Base, … ) - Esto lo permite pegar BaseClasses definidas previamente a una entidad. Puede especificar múltiples BaseClasses, separadas por una coma.}
  • bbox( min,max ) - Ajusta el tamaño de la [[Bounding box]caja de rodear]] English de la entidad.
  • obb( min,max ) - Idéntico a bbox pero orientado a los ángulos de la entidad.
  • color( roj vrd azl ) - Este configuración cambia el color de la caja de wireframe en las vistas 2D de Hammer. Si no está presente, el color se ajuste a magenta. Los valores aquí son los valores de RVA de un color y cada nombre tiene un rango de 0 a 255.
  • iconsprite( "ruta/sprite.vmt" ) - Si esto se usa, el sprite especificado se muestra en la vista 3D de Hammer en lugar de una caja de color. Esto funciona junto con los comandos studio() o studioprop(). Si no nombre se ajusta, la propiedad model se usa. Las propiedades scale, rendermode, _light y angles afectan el sprite (si existen).
  • sidelist( nombrepropiedad ) - Selecciona superficies de sólidos en la propiedad dada (como una lista de identificaciones separada por espacios). Si no se especifica, la propiedad usada es sides (en español, superficies).
  • sphere( nombredepropiedad ) - Si una entidad tiene un radio de efecto, p. ej. un ruido, una esfera se muestra en las vistas de Hammer. Si no especifica una propiedad, Hammer busca para una propiedad radius (en español, radio).
  • studioprop( "ruta/modelo.mdl" ) - Si esto se usa, la entidad se muestra en la vista 3D como el modelo especificado. Si no especifica un modelo, Hammer busca para una propiedad model. Múltiples modelos pueden definirse. Si existen, las propiedades skin y rendercolor afectan esta propiedad, similar a prop_dynamic.

Template:Note:es

  • studio( "ruta/modelo.mdl" ) - Idéntico a studioprop() pero la caja de rodear alrededor de la entidad ignora este modelo. Esto es útil para entidades que no muestran el modelo en juego.
  • lightprop( "ruta/modelo.mdl" ) - Idéntico a studioprop(), excepto que la inclinación del modelo es revertida.
  • line( color, clave_comienzo, valor_comienzo, clave_fin, valor_fin ) - Dibuja una línea entre de dos entidades. Las propiedades valor aquí dan los nombres para buscar en las propiedades clave en otras entidades. clave generalmente se ajuste a targetname. El color ajusta el color de la línea mientras la entidad no está seleccionada. La segunda entidad se ajusta a esto si no es especificada.
  • cylinder( color, clave_comienzo, valor_comienzo, radio_comienzo, clave_fin, valor_fin, radio_fin ) - Dibuja un cilindro entre de dos entidades. Esto es similar a line(), pero con la incorporación de dos propiedades radio que se buscan en las entidades. Estas definen el tamaño de los comienzo y fin del cilindro.
  • lightcone( cdv_interior, cdv_exterior, color, escala_inclinación ) - Representa el cono usado en entidades light_spot. cdv_interior es la clave para la sección más interior y cdv_exterior es la más exterior. escala_inclinación permite invertir el ángulo de inclinación para representar el cono. Valores se traen de _inner_cone, _cone y _light para cdv_interior, cdv_exterior y escala_inclinación respectivamente si no se especifican. Esto lee muchos valores otros de las propiedades de light_spot.
  • frustum( cdv,cerca,lejos,color,escala_inclinación ) - 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".
  • worldtext() (only in Counter-Strike: Global Offensive) (también en Portal 2: Community Edition) - 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. (info_overlay).
  • overlay_transition() - Renders overlays on the intersections between water and the shore. (info_overlay_transition).
  • light() - Present on light, unknown use.
    Pendiente: 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.
    Pendiente: 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 (en todos juegos desde Alien Swarm)(también en Garry's Mod) - 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 and flags, 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 - The flags property type lets you setup what will appear in the Flags portion of the entity property dialog. It is setup similar to the choices property type. The flags are all powers of 2 - 20, 21, 22, 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 that 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 to angle, 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 (i.e. brightness)
  • color1 - adds a color button, but uses a float [0,1] to represent RGB. Allows extra parameters (i.e. 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 view
  • node_id (en todos juegos desde 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 - adds a drop-down selection list populated by entities of the NPCClass type.
  • origin - origin
  • particlesystem (en todos juegos desde Alien Swarm) - adds a button that brings up the particle browser, letting you browse for particle systems.
    Icon-Bug.pngError:The particle browser cannot read files from VPKs! You will need to extract the game's PCF files for anything to appear.  [todo tested in ?]
  • pointentityclass - adds a drop-down selection list populated by entities of the PointClass type.
  • scene - adds a button that brings up the sound browser, letting you browse for scene files.
  • script (en todos juegos desde Left 4 Dead 2) - adds a button that brings up the file browser, letting you browse for VScripts.
  • scriptlist (en todos juegos desde Left 4 Dead 2) - 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 to material, except it will automatically replace your search filter with sprites/ when opening the material browser, and will add .vmt to the end of the material name.
  • decal - identical to material, except it will automatically replace your search filter with decals/ when opening the material browser.
  • studio - adds a button that brings up the model browser.
  • target_destination - marks property as another entity's targetname.
  • target_name_or_class - marks property as another entity's targetname or classname.
  • 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

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.

Note.pngNota: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"
]

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 (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.pngNota: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 adding func_brush to that 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)