Godot Scenes and Nodes

Errol Hassall
Partly Functional
Published in
3 min readJul 21, 2019

Godot uses a very object-orientated approach to its game design process. They use a technique dubbed “Scenes and Nodes”, wow pretty fancy. This technique makes game creation super simple because the theory behind this is very simple. In essence, everything is a node and a group of nodes is a scene. That’s about it.

Nodes

Nodes are everything in Godot, from sound to characters, everything is a node. Every single node will have the following attributes:
- A name
- Editable properties
- Can receive callbacks to process every frame
- Can be extended
- Can be added to other nodes as a child.

The node tree structure is what makes Godot “Godot”. It allows you to create say a player, then give them things like a kinematic body as a child node. This easily shows you that this character has a kinematic body just from looking at your scene structure. It plays very nicely with the mental model that all programmers already use, the file folder structure. Instead of files think of each node as a folder. Inside the folder is properties then each sub-folder contains more properties. This structure makes game development feel much less foreign when you first get into it.

Scenes
Scenes are just groups of nodes. In following the philosophy of code reuse Godot uses scenes to group node trees. This allows you to create a “player scene” for instance which houses all the nodes related to a player. This “player scene” is then put in the node tree of a level for instance. This level contains enemies perhaps or a tilemap as well as the player. When you look at that level scene you don’t get overblown with all the child nodes of that player node, you simply get the player. This is great because it keeps the clutter down allowing you to focus on what the scene is supposed to do.
What makes a good scene:
- It has to have one root node
- It can be saved to disk and loaded again
- It can be instanced (treated as a node and added to a higher-order tree)

As you can see here the root node is the player, it contains child nodes and together this makes up a scene. This one scene sums up the entire node and scene flow. Best yet you can then add this player scene to another scene. You can then import those scenes into another scene called instancing.

How cool is that?

You can then put that world scene inside yet another scene just like you would a node, just like we have done with this player scene. Nodes are everything and a collection of everything is a scene.

Workflow
Godot uses nodes and scenes as its building blocks. To create a level you make a scene by adding a root node and then adding child nodes to it. To create a player you first create a player scene and then you add child nodes to it. This scene can then be instanced by putting it in a level. Your workflow will look very similar. There will be a lot of scene creation and then node additions.

Thanks for reading I hope this helps in your understanding of nodes and scenes in the Godot game engine.

--

--