Godot Engine Documentation

repository·master·Indexed 26 days ago

https://github.com/godotengine/godot-docs

Source files for the official Godot Engine documentation, written in reStructuredText (reST) and processed with Sphinx. Includes guides on GDExtension, C++ development, physics interpolation, XR/OpenXR features, and version migration (up to Godot 4.6). Provides information on supported platforms, programming languages (GDScript, C#, C++), and installation methods for Windows, macOS, and Linux.

Tokens
205.9K
Snippets
311
Records
1.1K
Agent score
90%

What's inside godot-docs

  1. Overview of Godot Engine capabilities

    master

    Godot is a general-purpose 2D and 3D game engine used to create games and applications for desktop, mobile, and web platforms. It also supports console development, though porting to consoles typically requires advanced programming skills or a dedicated developer.

    Key features include a fully-fledged editor with integrated tools such as:

    • Code editor
    • Animation editor
    • Tilemap editor
    • Shader editor
    • Debugger
    • Profiler
  2. Overview of 3D Navigation objects and classes

    master

    Godot provides several ways to handle 3D navigation depending on your gameplay requirements:

    Pathfinding Methods

    • Astar3D: Best for cell-based gameplay where actors move between predefined, distinct points in a weighted graph.
    • NavigationServer3D: Best for real-time mesh-based navigation. It allows actors to reach any position within a navigation mesh and scales well for large worlds.

    When communicating with the server, RIDs are used to reference:

    • NavMap RID: A specific navigation map containing regions and agents.
    • NavRegion RID: A specific navigation region holding mesh data (can be enabled/disabled or restricted via bitmasks).
    • NavLink RID: Connects two mesh positions over arbitrary distances.
    • NavAgent RID: A specific avoidance agent (defined by a radius).
    • NavObstacle RID: An avoidance obstacle that constrains agent velocity.

    Scene Tree Helper Nodes

    • NavigationRegion3D: Holds a NavigationMesh resource to define a navigable area.
    • NavigationLink3D: Connects two positions on meshes (can be one-way or bidirectional).
    • NavigationAgent3D: A helper node for pathfinding and avoidance calls. Should be a child of a Node3D.
    • NavigationObstacle3D: Affects avoidance velocity but does not affect pathfinding (use navigation meshes for pathfinding changes).
  3. Overview of 3D Graphics Features

    master

    Godot's 3D engine supports high-fidelity rendering with the following core capabilities:

    • Rendering Pipelines: Supports Forward+ (default on desktop) with clustered forward optimizations and depth prepass, Mobile renderer, and Compatibility renderer.
    • PBR Workflow: Follows the Disney PBR model using a roughness-metallic workflow (supports ORM textures). Includes features like normal mapping, parallax/relief mapping, sub-surface scattering, and screen-space refraction.
    • Lighting: Real-time support for Directional, Omni, Spot, and Rectangular area lights. Includes volumetric fog and adjustable light 'size' for soft shadows.
    • Shadows: Supports various shadow mapping techniques including PSSM (for Directional), Dual Paraboloid/Cubemap (for Omni), and PCSS-like soft shadows.
    • Global Illumination: Options include Baked Lightmaps (GPU-based), Voxel-based GI probes, Signed-distance field GI (SDFGI) for large worlds, and Screen-space indirect lighting (SSIL).
    • Post-processing: Includes Tonemapping (ACES, AgX, etc.), Depth of Field, SSAO, Glow/Bloom, and Color Correction.
    • Antialiasing: Supports TAA, FSR2, MSAA, FXAA, and SSAA.
    • Resolution Scaling: Supports rendering 3D at lower resolutions using FSR1 or FSR2 while maintaining 2D scale.
  4. Overview of Godot 2D development features

    master

    Godot provides a specialized suite of tools for 2D game development, including:

    • Rendering Engine: A dedicated 2D rendering pipeline.
    • Physics System: Built-in 2D physics for collisions and movement.
    • TileMap System: Tools for efficient level design using tiles.
    • Animation: Support for 2D Sprites and Cutout animation.
    • Lighting: 2D lighting systems for dynamic scene illumination.
    • Visual Effects: A built-in 2D particle system and support for custom shaders.
  5. Use LightmapGI for baked global illumination

    master

    The LightmapGI node computes and stores baked lightmaps to provide high-quality indirect lighting with minimal light leaking. It is optimized for high run-time performance, making it suitable for low-end hardware, integrated graphics, and mobile devices.

    Key Characteristics:

    • Static Lighting: Lightmaps are fully static and cannot be baked in an exported project. Baking is only available within the editor.
    • Hierarchy Requirement: LightmapGI only bakes light data for child nodes of its parent. Nodes higher in the scene hierarchy are not included in the bake.
    • Mesh Requirements: CSGShape3D and PrimitiveMesh are not supported because they cannot store the required UV2 data.
    • Renderer Support: Without custom lightmappers, baking requires the Forward+ or Mobile renderers.
    • Dynamic Objects: Dynamic objects can receive indirect lighting via light probes. You can automatically place these by setting generate_probes_subdiv to a value other than GENERATE_PROBES_DISABLED.
    • Reflections: If the directional property is enabled, LightmapGI can provide rough reflections using spherical harmonics.
  6. 2D Graphics and Lighting Features

    master

    Godot provides a comprehensive suite of 2D rendering capabilities:

    • Rendering: Support for Sprites, Polygons (Polygon2D), and Lines (Line2D).
    • Animation: AnimatedSprite2D for sprite animations and Parallax layers for pseudo-3D effects.
    • Lighting: 2D lighting with point (omni/spot) and directional lights. Supports hard/soft shadows and normal/specular maps. Custom shaders can access a real-time Signed Distance Field (SDF) representation of the 2D scene via LightOccluder2D nodes for global illumination effects.
    • Font Rendering: Supports TTF, OTF, WOFF1, and WOFF2. Features include MSDF (Multi-channel Signed Distance Field) for resolution-independent scaling, variable fonts, OpenType features (ligatures), and subpixel positioning.
    • Particles: Both GPU-based (with custom shaders) and CPU-based particle systems.
    • Advanced Visuals: Optional 2D HDR rendering, debanding to reduce gradient artifacts, and HDR output on supported platforms.
  7. Understand Global Illumination concepts in 3D

    master

    Global illumination (GI) in Godot refers to a lighting system that combines direct light (from light sources) and indirect light (bounces from surfaces). It is used to achieve realistic lighting by mimicking real-world light behavior, such as light bouncing off colored walls or being emitted from emissive materials.

    Key components include:

    Indirect Diffuse Lighting

    Lighting that does not change based on camera angle. It is derived from:

    • Surface Bouncing: Light hits a surface and reflects onto others. The number of bounces affects realism and performance (typically 1-2 bounces in real-time, or up to 16 when baking lightmaps).
    • Emissive Materials: Materials that act as area lights by emitting light from their surface.

    Specular Lighting (Reflections)

    Lighting that changes intensity based on the camera's angle. It can be either direct or indirect.

    Ambient Occlusion and Reflections

    For small objects, you can enhance visual fidelity using:

    • SSAO (Screen-Space Ambient Occlusion): Provides more accurate ambient occlusion. Enable this in the Environment settings. Note that it has a significant performance cost.
    • SSR (Screen-Space Reflections): Provides more accurate reflections. Enable this in the Environment settings. Note that it has a very high performance cost.
  8. Understand Godot's UI Toolkit

    master

    Godot does not use standard GUI toolkits like GTK, Qt, or wxWidgets. Instead, it uses a custom, hardware-accelerated UI toolkit.

    • Implementation: The toolkit is exposed through Control nodes.
    • Usage: Control nodes are used to render the editor (written in C++) and can be used in any project using any supported scripting language.
    • Benefits: Consistent appearance across all platforms, hardware acceleration, and avoidance of LGPL licensing constraints.
  9. Understand Signals in Godot

    master

    Signals are a delegation mechanism (the observer pattern) that allows nodes to emit messages when specific events occur (e.g., a button being pressed). Other nodes can connect to these signals to react to the event without needing a direct reference to the emitting node. This reduces coupling and increases code flexibility.

    Since Godot 4.0, signals are a first-class type, meaning they can be passed as arguments to methods directly, providing better autocompletion and reducing errors compared to using string names.

  10. Use EditorPaths singleton for editor plugins

    master

    The EditorPaths singleton provides OS-specific paths to various data folders and files. It is intended for use in editor plugins to ensure files are saved in the correct locations across different operating systems.

    CRITICAL: This singleton is not accessible in exported projects. Attempting to use it in an exported game will cause a script error. Always check for the singleton's existence using Engine.has_singleton("EditorPaths") before calling its methods to ensure compatibility.