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
@@ -13,212 +13,30 @@ 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
-
# Intro to Entities
16
+
# Index of Subpages
17
17
18
-
There are three main types of entities:
19
-
- Point Classes
20
-
- Solid Classes
21
-
- Base Classes
18
+
-[Intro to Entities](intro.md)
19
+
-[Creating Entities](creating-entities.md)
20
+
-[FGDs](fgd.md)
21
+
-[Game Definitions](cfg.md)
22
+
-[Scripting Entities](scripting-entities.md)
22
23
23
-
## Point Classes
24
+
#Old Tutorials
24
25
25
-
A point class is a single position in 3D space. Often referred to as Point Entities.
26
+
The headers below will eventually be moved/edited to another page.
26
27
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
-
29
-
Point classes work well when placing objects that won't change in size.
30
-
31
-
## Solid Classes
32
-
33
-
Solid classes are brushes separated from the static world. Often referred to as Brush Entities.
34
-
35
-
Solid classes can behave as any kind of CollisionObject. This includes `Area`, `StaticBody`, `RigidBody`, and `KinematicBody`.
36
-
37
-
By default, they are given a CollisionShape child with a ConcaveShape resource matching their brush vertices.
38
-
39
-
## Base Classes
40
-
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.
42
-
43
-
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
-
45
-
# Creating Entity Resources
46
-
47
-
In Qodot, you define new types of entities by creating a new .tres resource file. Qodot provides 3 resource presets for this:
48
-
49
-
- QodotFGDPointClass
50
-
- QodotFGDSolidClass
51
-
- QodotFGDBaseClass
52
-
53
-
Click the "New Resource" icon in the Inspector:
54
-
55
-

56
-
57
-
Or right-click the FileSystem and click "Create New Resource":
58
-
59
-

60
-
61
-
Either will take you to the resource search screen. Here you can type in the following quick terms to narrow down the type of resource you want to create:
62
-
63
-
- pointclass
64
-
- solidclass
65
-
- baseclass
66
-
67
-
# Point and Class Resource Properties
68
-
69
-
These properties are shared by Point and Solid classes.
70
-
71
-
**Classname** - The name for this class in Trenchbroom.
72
-
73
-
**Description** - A short description that displays in Trenchbroom when this entity is selected.
74
-
75
-
**Qodot Internal** - Hides the entity in Trenchbroom's entity browser.
76
-
77
-
Qodot can still refer to this entity for building other entities (like base entities). Base Entities are already hidden in Trenchbroom by default, for most situations you can leave this off.
78
-
79
-
**Base Classes** - An array of template entities to inherit properties from.
80
-
81
-
This determines the parent entities for this class, where this entity gets all the class properties, meta properties, and property descriptions from its parents.
82
-
83
-
**Class Properties** - A dictionary of properties.
84
-
85
-
Once exported to the Trenchbroom game config, the dictionary values are written by editing entities in Trenchbroom, and read by accessing `properties` on a QodotEntity once the map is built.
86
-
87
-
To add a new class property to an entity:
88
-
89
-
1. Open the dictionary.
90
-
2. Click the first pencil by "New Key: [null]" and select "String" as the key data type.
91
-
3. Name your property in the key text field, no spaces.
92
-
4. Click the second pencil by "New Value: [null]".
93
-
5. Select any valid data type. Read [Class Property Data Types](#class-property-data-types) for more information.
94
-
6. Change the value to your desired default, or leave it blank.
95
-
7. Click "Add new key/value pair".
96
-
8. Re-export your FGD once all class properties are added.
97
-
98
-
You can also set default values for your properties, by repeating this process in Meta Properties, matching the key names and value datatypes from this dictionary.
99
-
100
-
**Class Property Descriptions** - A dictionary of descriptions for each property, visible in Trenchbroom.
101
-
102
-
Follow the same steps as adding class properties to add property descriptions. Ensure the description's key matches the property's key. Description values can only be strings.
103
-
104
-
**Meta Properties** - Editor-specific properties, such as the default color and size used to represent this class.
105
-
106
-
Add an entry with a matching key to an existing property, set the value to the same data type, and whatever value is present will become the default. Only one meta property is read per class property.
107
-
108
-
**Node Class** - The type of Godot node to spawn at this location.
109
-
110
-
This doesn't fully control the type of node that Godot spawns, read on to learn more about using Node Class with Point Classes and Solid Classes.
111
-
112
-
## Point Class properties
113
-
114
-
Point Classes inherit all features from Base Classes, with a few additions. QodotMap reads their position in the map, and places a QodotEntity node in their place. You have the option to replace the QodotEntity node with other node types, or even instance .tscn scenes in their place.
115
-
116
-
**Scene File** - The .tscn Godot scene that spawns in place of QodotEntity. The easiest way to spawn a specific node at a specific point.
117
-
118
-
Scene File takes priority over every other option here, especially if there's already a script attached to the .tscn file.
119
-
120
-
**Script Class** - The script to attach to your entity's root node.
121
-
122
-
This is ideal for spawning nodes without a .tscn file. If you want to access this entities' Class Properties, add a script here that `extends QodotMap` and accesses `properties["key_name"]`.
123
-
124
-
You can extend other Spatial-derived node types too, and add necessary children (CollisionShape, MeshInstance) through code, but you lose out on the ablity to access `properties`. You can fix this by always choosing to extend `QodotEntity` and adding more complex nodes like Area and RigidBody as children through code.
125
-
126
-
Make sure to update Node Class so it matches the the script's `extends`!
127
-
128
-
**Node Class** - The type of node to spawn at this location. This property should match the `extends` of your Script Class. You can ignore this property if you're using a Scene File.
129
-
130
-
With those properties covered, there's a few tricks you can use to get more specific results.
131
-
132
-
If you want to create an RigidBody node without a .tscn using a point entity, extending `RigidBody` in thes script prevents you from accessing the class property values set in Trenchbroom. However, extending `QodotEntity` prevents you from accessing the functions and signals of a RigidBody.
133
-
134
-
You can get around this by extending `QodotEntity` and using `var body = RigidBody.new()` and `add_child(body)` to add more complex nodes as children, while still having access to the `properties` dictionary. This can be repeated for other children like MeshInstance and CollisionShape.
135
-
136
-
## Solid Class Properties
137
-
138
-
Solid classes can have multiple brushes, so these properties apply to the solid class as a single object, not to each brush individually.
139
-
140
-
**Spawn Type** - Changes how the QodotMap arranges these brushes in its node hierarchy.
141
-
142
-
There are 4 settings:
143
-
- Worldspawn
144
-
- Merge Worldspawn
145
-
- Entity
146
-
- Group
147
-
148
-
**Build Visuals** - Makes the solid class visible when checked.
149
-
150
-
You may want to disable this for invisible triggers and other gameplay-related solid classes.
151
-
152
-
**Node Class** - Sets the node type of the solid class root.
153
-
154
-
If you're adding a Script Class, this value should match the `extends` of the script.
155
-
156
-
Setting this to RigidBody and setting Spawn Type to Entity changes these brushes from static geometry into physics objects.
157
-
158
-
**Collision Shape Type** - Changes how collision is built.
159
-
160
-
- None
161
-
- Convex
162
-
- Concave
163
-
164
-
Convex creations a CollisionShape for each brush, depending on the Spawn Type. Entity creates an outer hull, Group creates individual shapes for each brush. Convex is a good bet for most situations.
165
-
166
-
Concave allows for concave brush geometry, or if you chose Entity and want a single concave CollisionShape to make up your solid class. 🚧
167
-
168
-
**Script Class** - The script applied to the entity's root.
169
-
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`.
171
-
172
-
# Class Property Data Types
173
-
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:
175
-
176
-
- Bool
177
-
- Int
178
-
- Float
179
-
- String
180
-
- Vector3
181
-
- Stored as a string in the form X Y Z
182
-
- Color
183
-
- Stored as a string in the form R G B
184
-
- Dictionary
185
-
- Used for defining a set of choice key strings and their associated values
186
-
- Will display a dropdown in compatible editors
187
-
- Available Dictionary value types haven't been thoroughly tested
188
-
- Array
189
-
- Used for bitmask flag properties
190
-
- Will display a grid of checkboxes in Trenchbroom
191
-
- Used in Quake to indicate which entities spawn on different difficulties - easy, medium, hard
192
-
- Each entry in the array should be an array, with three elements: `[name: String, value: bool/float/int/String, default: same type as value]`
193
-
194
-
## Note on Arrays
195
-
196
-
When you add an Array as a class property, it must contain other Arrays, with each Array creating one flag. These flag Arrays must have 3 items: Name, Value, and Default value.
197
-
198
-
Name must be a String.
199
-
200
-
Value is traditionally a bool, but it can also be a float, int, or String. Qodot parses all these data types as Strings in the end, which will change how you will be [Accessing Class Properties in Code](#accessing-class-properties-in-code).
201
-
202
-
The default value can be the previous data type, or even `null`. It is not read by Qodot, just the regular Value.
203
-
204
-
# Accessing Class Properties in Code
205
-
206
-
See [Scripting Entities](scripting-entities.md).
207
-
208
-
-----
209
-
210
-
# Models in Trenchbroom
28
+
## Models in Trenchbroom
211
29
You can display a model in TrenchBroom over a Point Class definition. You can then set up the equivalent model in Godot.
212
30
213
-
## Requirements
31
+
###Requirements
214
32
215
33
- The model has to be an .obj
216
34
- You have to create an entity definition for this model specifically in your game’s FGD.
217
35
- You have to enable `obj_neverball` in your Trenchbroom Game Config with this line: `"modelformats": [ "obj_neverball" ]`.
218
36
- You cannot swap models in and out of Trenchbroom like you can with Source.
219
37
- The support for scaling models in Trenchbroom is coming soon, but know that old Trenchbroom versions don't support scaling models.
220
38
221
-
## Setup
39
+
###Setup
222
40
223
41
You can add a **Meta Properties** in your point entity definition with model as the key and the relative path of your .obj file as the value.
224
42
@@ -230,15 +48,15 @@ Add quotes surrounding your value, or TrenchBroom will crash when placing your e
230
48
231
49
Now that you’ve done this, you also need to update your game config every time your FGD changes. You can repeat the process for exporting a game config from earlier to overwrite the entire folder.
232
50
233
-
# Entity creation examples
51
+
##Entity creation examples
234
52
235
53
After every entity you create, there are 3 steps to ensure that Trenchbroom and QodotMap are aware of its existence. You can do these in a batch, or one-by-one.
236
54
237
55
1. Update your game's FGD to hold a new entity definition, featuring your new .tres file(s).
238
56
2. Re-export your Trenchbroom game config with your updated FGD included.
239
57
3. Add your FGD to a QodotMap's *Entity Fgd*, either directly, or as a *Base Fgd File* inside another FGD.
240
58
241
-
## Placing scenes with point entities
59
+
###Placing scenes with point entities
242
60
243
61
In this example, I’m going to make a point entity that will spawn a Godot scene, containing a tree with collision.
244
62
@@ -270,7 +88,7 @@ Now we can include this entity in a new FGD file. That way, Qodot can parse all
270
88
271
89
To learn more about working with props and entities, read the [Qodot Wiki page on Entities.](https://github.com/Shfty/qodot-plugin/wiki/4.-Entities)
272
90
273
-
## Creating a Brush Entity / Solid Class
91
+
###Creating a Brush Entity / Solid Class
274
92
275
93
Create a new Solid Entity resource by searching for "solid".
276
94
@@ -300,7 +118,7 @@ When loading up a map for your game config, first check that you're using your g
300
118
301
119

302
120
303
-
# Qodot's Demo Entities
121
+
##Qodot's Demo Entities
304
122
305
123
Although you are given some entity definitions through `Qodot.fgd`, such as
0 commit comments