This document provides an overview of the primary subsystems that form the foundation of Godot Engine. These systems work together to enable game development, asset management, scripting, and editor functionality. This page focuses on architectural relationships and core responsibilities of each major system.
For detailed information about specific subsystems:
Godot Engine is organized into five major interconnected systems:
| System | Core Classes | Primary Responsibilities |
|---|---|---|
| Scene System | Node, SceneTree, Viewport | Node hierarchy management, lifecycle, processing, scene loading |
| Resource System | Resource, ResourceLoader, ResourceSaver | Asset loading, caching, format handling, dependencies |
| Scripting System | ScriptLanguage, GDScript, CSharpLanguage | Code execution, language integration, bytecode generation |
| Editor System | EditorNode, EditorPlugin, EditorInterface | Development environment, visual editing, plugin architecture |
| Platform Abstraction | OS, DisplayServer, Main | Cross-platform compatibility, window management, initialization |
Sources: scene/main/node.h31-150 core/object/script_language.h1-100 scene/main/scene_tree.h31-100 core/io/resource_loader.h1-50
The scene system provides the fundamental node hierarchy structure that games are built upon. It manages the lifecycle of nodes, processing loops, and viewport rendering.
The hierarchy is rooted at the Window (typically the SceneTree root), which inherits from Viewport. All spatial and UI elements are Node derivatives.
Title: Scene System Core Class Relationships
Sources: scene/main/node.cpp31-60 scene/main/viewport.cpp31-80 scene/main/window.cpp31-60 scene/gui/control.cpp31-60
Nodes follow a strict lifecycle managed by SceneTree and triggered via notifications within Node::_notification:
| Phase | Notification | Method Called | Purpose |
|---|---|---|---|
| Addition | NOTIFICATION_ENTER_TREE | _enter_tree() | Node enters scene tree, setup process modes and groups scene/main/node.cpp107-180 |
| Ready | NOTIFICATION_READY | _ready() | Initialization after entire subtree is added scene/main/node.cpp218-230 |
| Frame processing | NOTIFICATION_PROCESS | _process(delta) | Per-frame logic scene/main/node.cpp99-101 |
| Physics processing | NOTIFICATION_PHYSICS_PROCESS | _physics_process(delta) | Fixed timestep physics scene/main/node.cpp103-105 |
| Removal | NOTIFICATION_EXIT_TREE | _exit_tree() | Cleanup before removal scene/main/node.cpp191-210 |
Sources: scene/main/node.cpp68-250 scene/main/node.h79-135
The SceneTree manages process groups which can run on separate threads based on node process_thread_group settings. Thread-local storage via Node::current_process_thread_group is used to track the current execution context.
Title: Scene Processing Flow
Sources: scene/main/node.cpp66-105 scene/main/scene_tree.cpp31-100
The resource system handles asset loading, caching, and serialization. Resources are reference-counted objects that can be shared across the scene tree.
ResourceFormatLoader implementations for specific file types core/io/resource_loader.h1-100RenderingServer scene/resources/material.cpp45-88Sources: core/io/resource_loader.h1-200 scene/resources/material.cpp1-130 scene/resources/packed_scene.cpp1-100
Godot's scripting system provides an abstraction layer (ScriptLanguage) that allows multiple languages to interface with the engine's Object and ClassDB systems.
GDScript is the primary built-in language, featuring a full compilation pipeline:
Title: GDScript Compilation Pipeline
| Stage | Class | Purpose |
|---|---|---|
| Tokenization | GDScriptTokenizer | Converts source text into a stream of tokens modules/gdscript/gdscript_tokenizer.cpp1-50 |
| Parsing | GDScriptParser | Builds an Abstract Syntax Tree (AST) modules/gdscript/gdscript_parser.cpp52-66 |
| Analysis | GDScriptAnalyzer | Performs type checking and identifier resolution modules/gdscript/gdscript_analyzer.cpp57-130 |
| Compilation | GDScriptCompiler | Generates bytecode for the VM modules/gdscript/gdscript_compiler.cpp1-100 |
| Execution | GDScriptVM | Interprets bytecode at runtime modules/gdscript/gdscript_vm.cpp1-100 |
Sources: modules/gdscript/gdscript.cpp159-196 modules/gdscript/gdscript_parser.cpp1-150 modules/gdscript/gdscript_analyzer.cpp1-165
C# is integrated via the Mono module, using CSharpLanguage to manage the lifecycle of managed scripts and the GDMono runtime.
Sources: modules/mono/csharp_script.cpp90-134 modules/mono/mono_gd/gd_mono.cpp1-100
The rendering system operates via a server-client model. The RenderingServer manages the scene's visual representation.
Godot supports multiple backends including Vulkan, D3D12, and OpenGL (GLES3). The RasterizerSceneGLES3 class handles 3D scene rendering for the OpenGL backend, managing geometry instances and light pairing drivers/gles3/rasterizer_scene_gles3.cpp57-128
Godot uses a custom shader language that is parsed by ShaderLanguage and compiled into backend-specific code (e.g., GLSL) servers/rendering/shader_language.cpp243-265
Title: Rendering Data Flow
Sources: drivers/gles3/rasterizer_scene_gles3.cpp31-168 drivers/gles3/shaders/scene.glsl1-240 servers/rendering/shader_language.cpp1-260
The editor is a Godot application itself, orchestrated by the EditorNode singleton. It provides specialized tools for scene manipulation and script editing.
Sources: editor/editor_node.cpp1-100 modules/gdscript/gdscript_editor.cpp1-160
Godot isolates platform-specific logic through the OS and DisplayServer abstract classes.
setup() and the main iteration loop main/main.cpp180-250Sources: main/main.cpp1-250 platform/windows/os_windows.cpp31-182
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.