summaryrefslogtreecommitdiff
path: root/doc/tutorial/01 Getting Started.lyx
blob: bdb4c7706d11689073f477a09eca9e66c52330ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
#LyX 1.6.5 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
\textclass article
\use_default_options true
\language english
\inputencoding auto
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\paperfontsize default
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\author "" 
\author "" 
\end_header

\begin_body

\begin_layout Title
01.
 Getting Started with Godot Engine
\end_layout

\begin_layout Section*
Introduction:
\end_layout

\begin_layout Standard
Godot Engine is designed to be useful.
 This may sound rather vague and is difficult to explain without repeating
 the same claims that every other engine does, but, as we progress through
 this (and the next) tutorials, hopefully it will be made clear what 
\begin_inset Quotes eld
\end_inset

useful
\begin_inset Quotes erd
\end_inset

 means.
\end_layout

\begin_layout Standard
Godot Engine has many components, both high and low level, and is usually
 more abstract and complex than most other engines.
 This is, however, to the advantage of the user as complexity is presented
 in a way that it only needs to be discovered when more power needs to be
 untapped.
 This helps to provide an easy learning curve.
\end_layout

\begin_layout Standard
Design wise, the whole API and set of components were created with a clear
 goal in mind, which is to allow for smooth integration of design ideas,
 code and assets.
 This is achieved by defining the following rules:
\end_layout

\begin_layout Itemize
Implementing a game feature should never be too many steps away from an
 existing component.
\end_layout

\begin_layout Itemize
More complex features should be leveraged by combining or extending existing
 components.
\end_layout

\begin_layout Itemize
If the above fails, creating custom components should be extremely simple.
\end_layout

\begin_layout Standard
Ultimately, Godot Engine provides an editor and tools that allows everyone
 to work with it:
\end_layout

\begin_layout Itemize
Programmers can script and extend any component of the project.
\end_layout

\begin_layout Itemize
Designers can tweak and animate any parameter from a friendly user interface.
\end_layout

\begin_layout Itemize
Artists can import their art and models and tweak the look of everything
 in realtime.
\end_layout

\begin_layout Section*
Editor:
\end_layout

\begin_layout Standard
As mentioned before, Godot Engine is very abstract so projects consist of
 just a 
\emph on
path
\emph default
 (ie: C:
\backslash
games
\backslash
mygame5).
 Projects don't have to be specifically created, and many can be placed
 inside the same path (useful for not wasting folders on tests and experiments).
 
\end_layout

\begin_layout Standard
In any case, to ease the management of projects, a graphical util exists.
\end_layout

\begin_layout Subsection*
Running From The Project Manager
\end_layout

\begin_layout Standard
Godot Engine includes a built-in project manager.
 This is installed by default on Windows and OSX and it allows for the creation
 and removal projects that will be remembered at the next startup:
\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename pm.png

\end_inset


\end_layout

\begin_layout Standard
To create a new project, the [Create] button must be pressed and a dialog
 will appear, prompting for a path and project name.
 Afterwards, the [Open] button will close the project manager and open the
 desired project.
\end_layout

\begin_layout Subsection*
Running From the Command Line
\end_layout

\begin_layout Standard
To create and manage projects, it is perfectly possible to use the command
 line.
 Many users prefer this way of working with project data.
\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename pmc.png

\end_inset


\end_layout

\begin_layout Standard
For ease of use, it is recommended that the 
\begin_inset Quotes eld
\end_inset

godot
\begin_inset Quotes erd
\end_inset

 binary exists in the path, so any project can be opened easily aywhere
 just by changing location to the projec and executing the editor.
\end_layout

\begin_layout Subsection*
Godot Editor
\end_layout

\begin_layout Standard
Godot Editor should have been opened by now, if not please check the previous
 steps again.
\end_layout

\begin_layout Standard
Godot has a powerful buit-in editor.
 It uses the graphics toolkint within itself to display the UI, so it runs
 identical on any platform (even consoles or phones!).
\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename editor.png

\end_inset


\end_layout

\begin_layout Standard
In the above screenshots, a few regions are labelled to be explained as
 follows:
\end_layout

\begin_layout Subsubsection*
Viewport
\end_layout

\begin_layout Standard
The 
\emph on
Viewport
\emph default
 is the main space where the content is displayed.
 Content includes 3D Nodes or Graphical User Interface (GUI) controls.
 Other types of data spawn editors of their own when being edited.
 The default viewport is the 3D viewport, which can be panned, zoomed, etc.
\end_layout

\begin_layout Subsubsection*
Scene Tree
\end_layout

\begin_layout Standard
The 
\emph on
Scene Tree
\emph default
 is a small dock that displays the tree of the current scene being edited.
 A scene is a collection of nodes arranged in a tree-hierarchy (any node
 can have several owned children-nodes).
 The meaning of this ownership depends purely on the 
\emph on
type
\emph default
 of the node, but it will become clear after going through the examples.
 In a 
\emph on
MVC
\emph default
 pattern, the scene tree could be considered the 
\emph on
View
\emph default
.
\end_layout

\begin_layout Subsubsection*
Property Editor
\end_layout

\begin_layout Standard
The 
\emph on
Property Editor
\emph default
 is another small dock.
 Every node contains a finite number of 
\emph on
properties
\emph default
, which can be edited.
 Properties can be of several types, such as integers, strings, images,
 matrices, etc.
 Usually, changes to properties are reflected in the 
\emph on
viewport
\emph default
 in real time.
\end_layout

\begin_layout Section*
Examples:
\end_layout

\begin_layout Standard
From now, a few, simple examples will be presented that will help understand
 a little better how Godot Engine works.
 
\end_layout

\begin_layout Subsubsection*
Hello, World!
\end_layout

\begin_layout Enumerate
Open the editor
\end_layout

\begin_layout Enumerate
Click on 
\begin_inset Quotes eld
\end_inset

Node
\begin_inset Quotes erd
\end_inset

 (Node Menu), then on 
\begin_inset Quotes eld
\end_inset

Create Root
\begin_inset Quotes erd
\end_inset


\end_layout

\begin_deeper
\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_1.png

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Create a node of type 
\emph on
Label, 
\emph default
then instruct the 
\emph on
editor 
\emph default
to switch to GUI editing mode.
 A few red squares will appear on the top left corner, don't mind them yet.
\end_layout

\begin_deeper
\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_2.png

\end_inset


\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_2b.png

\end_inset


\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_3c.png

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Select the 
\emph on
Label 
\emph default
node in the 
\emph on
Scene Tree
\emph default
 (if it's not selected yet), the properties of the selected node will appear
 in the 
\emph on
Property Editor
\end_layout

\begin_deeper
\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_3a.png

\end_inset


\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_3b.png

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Look for the 
\emph on
Text
\emph default
 property in the 
\emph on
Property Editor
\emph default
 and click the right column, so it becomes editable.
 Enter the text 
\begin_inset Quotes eld
\end_inset

Hello, World!
\begin_inset Quotes erd
\end_inset

.
 A red square containing 
\begin_inset Quotes eld
\end_inset

Hello World!
\begin_inset Quotes erd
\end_inset

 will appear at the top left, move it to the center.
\end_layout

\begin_deeper
\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_4a.png

\end_inset


\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_4b.png

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Save the scene.
\end_layout

\begin_deeper
\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_5a.png

\end_inset


\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_5b.png

\end_inset


\end_layout

\end_deeper
\begin_layout Enumerate
Press PLAY.
 A new window will appear running the application.
\end_layout

\begin_deeper
\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_6.png

\end_inset


\end_layout

\begin_layout Standard
\align center
\begin_inset Graphics
	filename tute1_7.png

\end_inset


\end_layout

\end_deeper
\begin_layout Subsubsection*
Hello World 2 (a little more complex)
\end_layout

\begin_layout Subsubsection*
A 3D Cube in Space
\end_layout

\begin_layout Standard

\end_layout

\begin_layout Standard
In many cases, nodes and other types of engine objects need to express changes
 in their state, such as a button being pressed, a scroll being dragged,
 or a projectile colliding against a tank.
 Godot Engine utilizes the concept of signals for this.
 Different types of nodes and objects can emit signals, and any other node
 or object can connect to them.
 
\end_layout

\end_body
\end_document