You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/entities/index.md
+17-76Lines changed: 17 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,94 +13,36 @@ This page is a WIP, currently in the process of being broken into succinct subpa
13
13
1. TOC
14
14
{:toc}
15
15
16
-
## Introduction to Entity Types
16
+
#Intro to Entities
17
17
18
18
There are three main types of entities:
19
19
- Point Classes
20
20
- Solid Classes
21
21
- Base Classes
22
22
23
-
A point entity is a position in 3D space. They work well for spawn locations, pickups, and instancing Godot scenes.
23
+
## Point Classes
24
24
25
-
Solid classes are pieces of geometry with special properties, like doors and breakable walls. You can use these entities to tie scripts and other functionality to brushes in the world. Collision and meshes are optional as well.
25
+
A point class is a single position in 3D space. Often referred to as Point Entities.
26
26
27
-
Base classes are empty; they only contain properties as a template for other classes. They're handy when needed, but never required.
27
+
A point class can either be a single node with a script attached, or an instantiated scene file (.tscn) placed at the point's location.
28
28
29
-
Keep in mind that "Entities" and "Classes" mean the same thing for this entire page. Qodot calls them classes, Trenchbroom calls them entities. Neither of these systems inherently interact with the classes found in GDscript or C#, they are completely separate.
29
+
Point classes work well when placing objects that won't change in size.
30
30
31
-
#Creating an FGD file
31
+
## Solid Classes
32
32
33
-
This should be your first step before adding any entities for a brand new Godot project.
33
+
Solid classes are brushes separated from the static world. Often referred to as Brush Entities.
34
34
35
-
FGD fles (Forge Game Data) hold definitions for entities. They are required to make Trenchbroom and QodotMap understand custom entities.
35
+
Solid classes can behave as any kind of CollisionObject. This includes `Area`, `StaticBody`, `RigidBody`, and `KinematicBody`.
36
36
37
-
While you can piggyback off of Qodot.fgd included in all installations of Qodot, this puts your custom entities at risk if you choose to update Qodot, since Qodot.fgd will be overwritten with the defaults.
37
+
By default, they are given a CollisionShape child with a ConcaveShape resource matching their brush vertices.
38
38
39
-
It is safer to create a unique FGD file for your game that goes with the custom Trenchbroom game config created earlier in the [Applying Textures](./beginner's-guide-to-qodot/applying-textures) guide.
39
+
## Base Classes
40
40
41
-
Right-click on the Filesystem dock and click Create New Resource. Make a QodotFGDFile:
41
+
Base classes store properties shared by multiple classes. A base class does not function on its own, and it is is never required for any entity definition.
Base classes are helpful at encapsulating repeating properties between multiple entities. You can assure some code safety practices (like duck typing) by ensuring a certain group of entities all share similar properties.
44
44
45
-
I recommend saving this file as your_game_name_fgd.tres so it’s easy to search for “fgd” or just your game’s name the Filesystem dock. Mine is practice_fgd.tres.
46
-
47
-
Change the _Fgd Name_ to your game’s name.
48
-
49
-
Note
50
-
{: .label .label-blue }
51
-
You have to set the Fgd Name so it doesn’t conflict with the “Qodot” namespace, otherwise Trenchbroom will discard your FGD.
52
-
53
-
FGDs by default contain example entity definitions, which we don't need as Qodot.fgd contains all of these already. It helps to start an FGD with a completely clean entity definitions array, so you can focus on adding new entities not covered by Qodot.fgd.
54
-
55
-
## Adding an Entity Definition to an FGD
56
-
57
-
With your FGD open, click on the Entity Definitions array to open it. Drop your new entity definition into any empty slot in the list.
We still need to update the Trenchbroom game config to include our new entity definitions. Later we'll make sure the QodotMap node catches wind of the new entity definitions.
62
-
63
-
## Adding required Entity Definitions to your FGD
64
-
65
-
Before trying to consider your FGD complete, you may want to include worldspawn layer and group functionality in your FGD. These are kept as classes in Qodot.fgd, and are recommended to copy-over into all custom FGDs.
66
-
67
-
These entities are:
68
-
69
-
- worldspawn_solid
70
-
- worldspawn_base
71
-
- group_solid
72
-
73
-
You can expect them to work out of the box and not require changing, so they can be left in the `/addons/qodot` folder and updated as needed.
74
-
75
-
## Adding FGDs to your Trenchbroom game config
76
-
Open the `config_folder.tres` resource and add a new item to the _Fgd Files_ array. Add the FGD you made by dragging and dropping, or by using the folder selection button.
77
-
78
-
Note
79
-
{: .label .label-blue }
80
-
Make sure to save your FGD resource first by clicking the save icon in the top right, or by pressing Ctrl + S with any scene open.
81
-
82
-
Click _Export File_ again.
83
-
84
-
Now you can open Trenchbroom, or go to File → Refresh Entity Definitions if you already have it open.
85
-
86
-
Note
87
-
{: .label .label-blue }
88
-
If you get a Trenchbroom error about incomplete strings, make sure the *Fgd Name* on your own FGD is not “Qodot”.
89
-
90
-
Note
91
-
{: .label .label-blue }
92
-
An error can occur if any entity definitions are missing a classname.
You should be able to see more entity definitions in the entity collections list. This means your FGD made it into Trenchbroom successfully!
97
-
98
-
If you already have entities in your FGD, switching to your FGD should show your list of entities in the entity browser.
99
-
100
-

101
-
102
-
103
-
# Creating new Entities
45
+
# Creating Entity Resources
104
46
105
47
In Qodot, you define new types of entities by creating a new .tres resource file. Qodot provides 3 resource presets for this:
106
48
@@ -122,11 +64,9 @@ Either will take you to the resource search screen. Here you can type in the fol
122
64
- solidclass
123
65
- baseclass
124
66
125
-
What follows is a breakdown of each property in the Inspector when editing one of the three main class types.
67
+
# Point and Class Resource Properties
126
68
127
-
## Base Class Properties
128
-
129
-
These properties are shared by Point and Solid classes. Base Class only exists as a template for other classes, if you're looking for an ECS-like approach to sharing properties.
69
+
These properties are shared by Point and Solid classes.
130
70
131
71
**Classname** - The name for this class in Trenchbroom.
132
72
@@ -229,7 +169,6 @@ Concave allows for concave brush geometry, or if you chose Entity and want a sin
229
169
230
170
Although `QodotFGDSolidClass` is a class you can extend from, this is meant as a Qodot internal to build solid classes. This does not extend QodotEntity, and will not give you access to `properties`.
231
171
232
-
233
172
# Class Property Data Types
234
173
235
174
As shown earlier in this page, you can define properties for entities in the Class Properties dictionary. The "key" for each dictionary entry should be a String. The "value" can only be one of these 8 data types:
@@ -266,6 +205,8 @@ The default value can be the previous data type, or even `null`. It is not read
266
205
267
206
See [Scripting Entities](scripting-entities.md).
268
207
208
+
-----
209
+
269
210
# Models in Trenchbroom
270
211
You can display a model in TrenchBroom over a Point Class definition. You can then set up the equivalent model in Godot.
0 commit comments