Godot Intro
Godot is a free, open-source game engine for 2D and 3D games. It is released under the MIT licence: no royalties, no account, no splash-screen requirement, and the whole engine (editor included) is one download of roughly 100 MB that runs without installation. Games built with it ship to Windows, macOS, Linux, Android, iOS and the web, and to consoles through third-party porting companies.
This course targets Godot 4.x and was checked against Godot 4.7. Godot 3 projects, tutorials and answers are still everywhere online, and many of their APIs were renamed in Godot 4 (KinematicBody2D became CharacterBody2D, yield became await, export var became @export var, TileMap was replaced by TileMapLayer). When a search result uses those names, it is about Godot 3.
What you need first
- Basic programming: variables, functions, loops, classes. GDScript looks like Python, so the Python course is a good fit, but any language works.
- The game loop, delta time and fixed timesteps from Game Development Roadmap & Fundamentals. Godot's
_processand_physics_processare those ideas with engine names. - Vectors, dot products and transforms from Math for Games.
- Optional: 2D Games with JavaScript & Canvas shows what an engine does for you, because there you write it all by hand.
How this course works
Most examples are GDScript, Godot's built-in language. Godot can't run inside a web page, so the GDScript playgrounds on this site show the output that was recorded when the script ran in real Godot 4.7 (headless), and every example is re-checked against Godot whenever the course is verified. You can edit the code and copy it into your own project.
There are two kinds of runnable script:
- A script that
extends SceneTreeis a tiny program: the code in_init()runs once andquit()ends it. Language lessons use this form. - Any other script (
extends Node,Node2D,CharacterBody2D, ...) is attached to a node calledMainand added to a running scene tree, so_ready(),_process()and_physics_process()run as they would in a game. Physics, timers, tweens and signals all work. Only rendering and real keyboard input are missing, so input is simulated in code.
Here is the smallest program:
extends SceneTree
func _init():
var engine := "Godot"
var major: int = Engine.get_version_info().major
print("Hello from ", engine, " ", major)
quit()Hello from Godot 4
And here is a node that moves for three frames. The test runner fixes the frame rate at 60 FPS, so delta is always 1/60 of a second and the output is the same on every run:
extends Node2D
# frames: 3
var speed := 90.0 # pixels per second
func _ready():
print("Ready at ", position)
func _process(delta):
position.x += speed * delta
print("x = ", position.x)Ready at (0.0, 0.0)
x = 1.5
x = 3.0
x = 4.5
Editor workflows (clicking through docks, connecting signals in the inspector), scene files (.tscn), shaders, 3D scenes and C# are shown as ordinary code blocks with numbered steps, because they need the editor or a GPU.
Godot in one picture
| Idea | In Godot |
|---|---|
| The building block | a node: Sprite2D, CharacterBody2D, Camera3D, Label, Timer, AudioStreamPlayer ... about 200 types |
| A reusable object | a scene: a tree of nodes saved as a .tscn file. A player, a coin, a level and a menu are all scenes |
| The running game | the scene tree: one root viewport with your current scene (and autoloads) under it |
| Behaviour | a script attached to a node, extending that node's class |
| Communication | signals (events) going up, method calls going down |
| Data | resources: textures, sounds, materials and your own data classes, saved as .tres/.res |
Unity users: a scene is closer to a prefab than to a Unity scene, a node is a GameObject and a component in one, and signals replace most UnityEvent and C# event wiring. Compare with the Unity course if you know it.
Your first project
- Download Godot 4 from godotengine.org (the standard build, unless you want C#; see Godot Builds, VS Code & the Debugger). Unzip and run it.
- In the Project Manager, click Create, give the project a name, choose an empty folder and keep the default renderer (Forward+ for desktop, Mobile or Compatibility for phones and the web).
- In the Scene dock, click 2D Scene. A
Node2Droot appears. Right-click it, choose Attach Script, and acceptnode_2d.gd. - Replace the script with the moving example above and press Ctrl+S to save the scene as
main.tscn. - Press F5 (Run Project). Godot asks for a main scene: choose Select Current. The Output panel shows the prints.
What's in the course
| Section | You learn |
|---|---|
| Getting Started | the editor, nodes and scenes, instancing, the lifecycle, project settings, autoloads |
| GDScript | syntax, collections, static typing, classes, @export, @onready, signals, await, resources |
| 2D | CharacterBody2D, platformer movement, areas and raycasts, TileMapLayer, animation, Camera2D |
| 3D | transforms and Basis, CharacterBody3D, materials and lighting, navigation |
| Systems | the input map, UI, audio buses, saving, groups, timers, tweens, a state machine |
| C#, Shaders & Shipping | C# in Godot, the shading language, exports, GDExtension |
| Toolkit & Field notes | builds, editors, the debugger, addons, testing, hard-won advice |
You finish with Coin Climber, a small platformer whose game logic you can run and test.
Test yourself
What is a Godot scene?
- Only a whole level
- A tree of nodes saved as a reusable file (.tscn)
- A C# class
- A folder in the project
You find a tutorial that uses KinematicBody2D and yield. What does that tell you?
- It is for Godot 4.7
- It is written for Godot 3; Godot 4 uses
CharacterBody2Dandawait - It uses C#
- It is about 3D games only
In the second example, why is x exactly 1.5 after the first frame?
- Godot always moves 1.5 pixels per frame
- speed (90) times delta (1/60 s at a fixed 60 FPS) is 1.5
- position starts at 1.5
_processruns 90 times per second