This page introduces the Godot Engine repository at a high level: what it contains, how it is structured, and how its major subsystems relate to each other. It is intended as a starting point for navigating the codebase.
For build system details, see Build System. For individual subsystem deep-dives, see Major Systems and the linked sub-pages.
The repository is a monorepo containing the engine runtime, the editor, platform backends, optional modules, third-party libraries, and documentation.
| Directory | Contents |
|---|---|
core/ | Fundamental types, object model, OS abstraction, I/O, configuration |
scene/ | Scene graph, nodes, GUI controls, animation, resources |
servers/ | Rendering, physics, audio, navigation, display, text servers |
modules/ | Optional compiled-in modules (GDScript, C#/Mono, etc.) |
editor/ | Full editor UI and tools (compiled only when TOOLS_ENABLED) |
platform/ | Platform-specific OS and display implementations |
drivers/ | Low-level hardware drivers (Vulkan, D3D12, GLES3, file I/O, audio) |
main/ | Engine entry point and initialization sequence |
thirdparty/ | Bundled third-party libraries |
doc/ | Class reference documentation in XML format |
tests/ | Unit and integration test suite |
Sources: main/main.cpp1-200 editor/editor_node.cpp31-202
The same source tree produces three distinct binary types, selected at compile time:
| Build Type | Compile Flag | Contents |
|---|---|---|
| Editor | TOOLS_ENABLED | Runtime + full editor UI + import pipeline |
| Debug export template | DEBUG_ENABLED | Runtime + debug helpers, no editor |
| Release export template | (neither) | Minimal runtime only |
The editor/ directory is guarded throughout by #ifdef TOOLS_ENABLED. The main/main.cpp file checks for the editor or project_manager flags at runtime to decide which MainLoop to start.
Sources: main/main.cpp209-231 main/main.cpp526-543
The engine is organized into layers. The diagram below maps system names to the primary C++ classes that implement them.
Diagram: Engine Layered Architecture (Code Entities)
Sources: main/main.cpp155-195 scene/main/node.h51-75 scene/main/scene_tree.h1-61 editor/editor_node.h118-125 core/os/os.h1-50
The Main class in main/main.cpp is responsible for bootstrapping the engine. It proceeds in three phases before handing off to a MainLoop.
Diagram: Main Startup Sequence
Sources: main/main.cpp352-412 main/main.cpp155-195
Singleton instances initialized during setup():
| Singleton | Class | Header |
|---|---|---|
engine | Engine | core/version.h area |
globals | ProjectSettings | core/config/project_settings.h |
input | Input | core/input/input.h |
input_map | InputMap | core/input/input_map.h |
translation_server | TranslationServer | core/string/translation_server.h |
message_queue | MessageQueue | core/object/message_queue.h |
Singleton instances initialized during setup2():
| Singleton | Class | Header |
|---|---|---|
display_server | DisplayServer | servers/display/display_server.h |
rendering_server | RenderingServer | servers/rendering/rendering_server.h |
audio_server | AudioServer | servers/audio/audio_server.h |
physics_server_2d | PhysicsServer2D | servers/physics_2d/physics_server_2d.h |
physics_server_3d | PhysicsServer3D | servers/physics_3d/physics_server_3d.h |
tsman | TextServerManager | servers/text/text_server.h |
theme_db | ThemeDB | scene/theme/theme_db.h |
Sources: main/main.cpp156-193
All engine objects inherit from Object (core/object/object.h). The ClassDB singleton maintains a registry of all registered classes, their methods, properties, and signals. This registry is what powers GDScript introspection, the editor Inspector, and the GDExtension API.
Node (scene/main/node.h) extends Object and is the base for all scene objects. Resource (core/io/resource.h) is the other major Object subclass, representing loadable/saveable data.
Diagram: Core Type Hierarchy
Sources: scene/main/node.h51-75 scene/main/viewport.h1-40 scene/main/window.h1-50 scene/gui/control.h1-50
Scenes are trees of Node objects. The SceneTree (scene/main/scene_tree.h) owns the root Window and drives the per-frame process/physics loop. Nodes notify each other through the notification system and signals.
Key classes:
| Class | File | Role |
|---|---|---|
SceneTree | scene/main/scene_tree.h | Main loop, node tree, groups, timers |
Node | scene/main/node.h | Base for all scene objects |
Viewport | scene/main/viewport.h | Rendering surface, input dispatch |
Window | scene/main/window.h | Top-level OS window or embedded window |
CanvasItem | scene/main/canvas_item.h | 2D rendering base |
Control | scene/gui/control.h | GUI layout and theming base |
For details, see Scene System and Node Hierarchy.
Rendering uses a server pattern. RenderingServer (servers/rendering/rendering_server.h) is a thread-safe API that accepts commands from the main thread and executes them on a rendering thread. Platform-specific graphics APIs (Vulkan, D3D12, Metal, GLES3) are abstracted behind RenderingDevice (servers/rendering/rendering_device.h). DisplayServer (servers/display/display_server.h) handles window creation and OS display management.
For details, see Rendering System.
Scripting languages register themselves as ScriptLanguage (core/object/script_language.h) implementations. The built-in language is GDScript (modules/gdscript/). C# is provided through the mono module (modules/mono/). Both are optional modules that may be compiled out.
For GDScript internals, see GDScript System. For C#, see C# Scripting.
The editor is compiled in when TOOLS_ENABLED is set. EditorNode (editor/editor_node.h) is the central singleton that owns the editor UI, scene management, plugin lifecycle, and export pipeline. It is itself a Node added to the SceneTree.
Editor functionality is extended via EditorPlugin (editor/plugins/editor_plugin.h). Most built-in editor tools (2D editor, 3D editor, script editor, inspector, filesystem dock) are implemented as plugins.
For details, see Editor Core and Editor Plugins.
Two configuration singletons are used at runtime:
| Class | File | Scope | Storage |
|---|---|---|---|
ProjectSettings | core/config/project_settings.h | Project-level settings | project.godot |
EditorSettings | editor/settings/editor_settings.h | Editor-only settings (no project) | OS user data dir |
ProjectSettings is available in all build types. EditorSettings is only compiled in TOOLS_ENABLED builds.
For details, see ProjectSettings & EditorSettings.
Optional compiled-in modules live in modules/. Each module has a SCsub build script and a register_types.cpp that hooks into the engine's type registration. Modules are enabled/disabled at build time. Generated header modules/modules_enabled.gen.h contains the #define flags.
For build system details, see Module System.
Platform-specific code is in platform/. Each platform provides:
OS subclass (e.g., OS_Windows in platform/windows/os_windows.h)DisplayServer subclass for window/input managementMain::setup() / Main::iteration() / Main::cleanup()The abstract OS interface (core/os/os.h) covers process management, file access, environment variables, and timekeeping. DisplayServer covers window creation, input events, and clipboard.
For details, see OS Abstraction Layer and Display Server.
Sources: platform/windows/os_windows.cpp269-345 core/os/os.h1-60
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.