There are a lot of things to know about the
Godot engine. So here are 12 more things a Godot developer should know. Help us
by commenting your Godot tricks!
Number 1: Emit particles in shapes.
Great news! particle systems can emit in any shape you can imagine.
So here is how it works by using an emission mask:
Add a particle system to your scene and design it as usual.
Draw a mask and import it as a png. Only the pixels that are fully
visible will spawn particles.
To add an emission mask, click on the Particles
button and select ‘Load emission mask’.
You can either let particles emit from the whole
solid area or only along the outer border.
Number 2: Dialogic is a powerful dialog system
It is made by Emilio Coppola
and you can get it at Github.
It’s under active development and the
latest release came out just a week ago.
It works fully within the engine and has this
great editor for different dialog paths.
You can add characters, portraits, script
out interactions and customize the style.
To find out more, check out Emilio’s Channel.
Number 3: Callbacks with inheritance
There are a number of different
prebuild callbacks that every Node receives at different points in its lifetime.
The most important are _ready, _process and _physics_process, but there are many more.
When you have a class that inherits from another class, both of them can implement
that callback. And both will be called, you basically cannot prevent that.
I think this is strange, and so seem to think a lot of people. That is why
this behavior might be changed in Godot 4.
The order of calls differs
- for enter_tree and _ready, the super class is called first, for process
and exit tree, the subclass is called first.
When you have any other function that is
not prebuild, the super classes function is not called automatically. Instead, you can
call them by putting a . in front of the call.
This is helpful when you want to add behavior
to a callback, but delegate the rest.
Number 4: Particle systems can have shaders
There are different kinds of shaders. Particle shaders calculate how a particle moves, and
fragment shaders how an object looks. But there is no reason why you could not apply a fragment
shader to a particle system. This is a really powerful tool to animate your particles. You
can even make the particle animation depend on the particles color or lifetime with a little
trick. We made a cool cross slash effect with this. And these elemental effects. You can
find out how it is done in this video.
Number 5: You can make collision
shapes visible in the game
You can make collision shapes visible for
debugging purposes. This can really save some time debugging collision issues. But be
aware that they still can not be seen when set to be invisible. Collision points
and lines are also drawn. You can even configure the colors in the project settings.
The same is possible for navigation shapes.
Number 6: The ways to access a node
In almost every script you need to access nodes of the scene tree. As
soon as the node is added to the tree, you can get it through the get_node function
like this. You can both use relative paths and absolute paths. However, if the node you request
does not exist, the method will invoke an error. If you expect that case and want to
handle it, you can use get_node_or_null, so if the node is not found you get null.
An abbreviated notation for get_node is the dollar operator. You only need to use quotation
marks if your node’s name has spaces in it.
If you want to access a node whose path you don’t
exactly know, you can use find_node which searches the tree for a node with a name that matches
the mask. But be aware method can be slow.
Number 7: Curves help you
polish your game and do maths.
Curves are so useful. Really,
one of our favorite tools.
We mostly use them for polish,
because they are a very visual way of designing and can be easily tweaked.
And as we all know, faster iteration times, means more iterations, means better polish.
You can add a curve by creating a new resource.
Then, you can preload it in a script.
The curve always is defined from 0 to 1.
If you want larger values, you can just
transform them to to fit the space.
We use curves to describe the size of a
damage number in relation to the damage, the acceleration of the player movement,
the speed of the projectiles on its path.
They are also great for experience
curves and things like that.
It is often just a better solution, than
fiddling around with a very complex formula.
Also, there are curve textures,
which can be passed to shaders.
We made a particle shader to make
particles follow a trajectory.
And this blackhole here, is very easily done
by describing the deformation with a curve, we will link the tutorials
for that when we made one.
Number 8: collision layer/mask changes
are not passed to instances sometimes.
Still debugging area or body collisions? If
you checked that the collision shapes are in the right positions, it may be the
layers or masks causing the problem.
Two objects collide when one of the objects
has a mask that overlaps with the other objects collision layers. You can set the
mask and layer in the node’s properties.
However, when you inherit from the scene,
then instanciate it into another scene and later change the collision mask in the base
scene, it does not change in the instance.
Although it did change in the inherited scene.
This is something to be aware of so you don’t search for that for hours.
Number 9: How to effect process priority
Generally things get processed flat down the tree.
This means that the process and physics_process functions get called in the same order as the
nodes are drawn, from top to bottom. However, there are situations when you want to
have better control over the order of these methods. You can enforce the order of
execution by setting the process priority of one of the nodes. The nodes with lower
process priority value are executed first.
Number 10: Keybinds are useful
Godot offers a massive amount of project settings. In the Input Map tab, you can define
input actions for your project such as walking in four directions, UI navigation or attacks. You can
assign a key, a mouse button, a controller button or analog stick direction to the action.
Now, when you receive an input event, you can check the defined actions.
This allows you to change the input mapping at a central location without looking up the locations
where you process the events in your scripts.
Also, you can easily give players the option to
change the inputs. To do that, you have to erase the previously set event and set it to a new
input by calling the InputMap singleton.
Number 11: You can turn off
editor features you don’t use.
It is possible to disable nodes and tabs that you
do not intend to use. To do that, open the Editor tab and select Manage editor features.
Our own project is purely 2D, so we can just remove everything
3D. This removes a lot of clutter.
It can also be very helpful when
teaching or working in a team.
You can even make profiles for
when you have various projects.
Number 12: hiding the console window.
Another adaption you can make to Godot’s interface is to disable the console window
that automatically opens with Godot. Thank you Bitbirdy for giving us this tip, check
out her contend, she makes great videos!
While there are times when it’s outputs contain
valuable debug information, most of the things it displays are also shown in the output tab in the
engine. And if you close it by accident, you close the engine. To hide it, go to Editor -> Editor
Settings -> Interface -> Hide Console Window.
And just like that, the informative part of the
video is over, but we still keep on talking, just less informative.
We make videos every week, and if liked this one, you will probably like
the other ones as well. We made a video about 10 and 11 things in the past, and who would
have thought: it slowly gets out of hand.
If you are interested in seeing how far we
can push it, subscribe to our channel.
Currently we work on our game Furcifers Fungeon,
which is our first serious attempt at gamedev. It is chaotic and bouncy, check it out!
It turns out, some people want to talk to us. You can do that on twitter and on our discord.
Also, thank you guys so much for all the nice comments under our videos.
We are impressed how kind people on the internet are to us, the Godot
community really is something special.
However, there is one thing that keeps
coming up: it is our german accent, and i think we owe you an answer:
the reason why you hear a german accent is … because we both are from germany and speak
with a german accent. Now that its out we can finally eat a Käsebockwurst on camera without
feeling stupid, which is really freeing.
So, we hope you liked this video, now
go on and have a nice rest of your day!
This post appears to be a direct link to a video.
As a reminder, please note that posting footage of a game in a standalone thread to request feedback or show off your work is against the rules of /r/gamedev. That content would be more appropriate as a comment in the next Screenshot Saturday (or a more fitting weekly thread), where you'll have the opportunity to share 2-way feedback with others.
/r/gamedev puts an emphasis on knowledge sharing. If you want to make a standalone post about your game, make sure it's informative and geared specifically towards other developers.
Please check out the following resources for more information:
Weekly Threads 101: Making Good Use of /r/gamedev
Posting about your projects on /r/gamedev (Guide)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.