Godot Engine
repository·master·Indexed 13 days ago
https://github.com/godotengine/godotA free, open-source, cross-platform 2D and 3D game engine. Documentation covers core systems including the GDScript compilation pipeline (tokenizing, parsing, analyzing, and compiling), the Metal rendering device for Apple platforms, glTF import/export architecture, and C# support via the Mono module.
What's inside Godot
- The Metal rendering device is Godot's implementation of the Metal graphics API. It allows the engine to utilize Apple's Metal framework for high-performance 2D and 3D rendering on supported platforms. The implementation incorporates work derived from the MoltenVK project (a Vulkan-on-Metal translation layer).
Overview of the macOS platform port
masterThe macOS platform port of Godot is implemented using C++, Objective-C, and Objective-C++. It leverages shared Apple code located in
drivers/apple.For packaging and distribution, the platform utilizes specific templates found in
misc/dist/macos:misc/dist/macos_tools.app: An.appbundle template used for packaging the macOS editor.misc/dist/macos_template.app: A template used for packaging macOS export templates.
Overview of the iOS platform port
masterThe iOS platform port in Godot is implemented using C++, Objective-C, and Objective-C++. It is built upon the
drivers/apple_embeddedabstract platform and utilizes shared Apple code found indrivers/apple.For packaging iOS export templates, Godot uses the Xcode project template located in the
misc/dist/apple_embedded_xcodedirectory.Understand the PCRE2 license terms
masterPCRE2 is distributed under the BSD-3-Clause WITH PCRE2-exception license.
Key Licensing Details:
- Basic Library Functions: Distributed under the standard "BSD" license (3-Clause).
- Just-In-Time (JIT) Compiler: This is an optional feature. When included, it is licensed under the 2-clause BSD license.
- Documentation: Distributed under the same terms as the software.
- Test Data: Located in the
testdatadirectory; it is not copyrighted and is in the public domain. - SLJIT: Code in the
deps/sljitdirectory has its own separate LICENSE file.
Redistribution Requirements:
- Source Code: Must retain all copyright notices, the list of conditions, and the disclaimer.
- Binary Form: Must reproduce the copyright notices, conditions, and disclaimer in the documentation and/or other materials provided with the distribution.
- Endorsement: The names of the University of Cambridge or contributors cannot be used to endorse products derived from this software without specific prior written permission.
Exemption for Binary Library-Like Packages
The requirement to include copyright notices in binary redistributions does not propagate through a chain of software. If your software includes a package that itself includes PCRE2, you are not required to include the PCRE2 notices unless you use PCRE2 independently.
Use the apksig library for APK signing and verification
masterThe
apksiglibrary is designed to simplify APK signing and verification, specifically ensuring that signatures are compatible with the Android platform versions supported by the APK. It supports both JAR signing and the APK Signature Scheme v2.The library is intended for use outside of Android devices (e.g., in build pipelines) and handles the complexities of different Android version verification logic by choosing appropriate cryptographic algorithms based on the target platform versions.
Get started with Godot Engine
masterGodot Engine is a cross-platform, feature-packed engine for creating 2D and 3D games from a unified interface. It supports exporting to major desktop platforms (Linux, macOS, Windows), mobile platforms (Android, iOS), Web-based platforms, and various consoles.
To begin using Godot, you can either download pre-built binaries or compile the engine from source.
What is Grisu2?
masterGrisu2 is a C++11 implementation of the Grisu2 algorithm, which is used for converting floating-point numbers to decimal strings quickly and accurately. This specific implementation is a modified version of the code found in
simdjson(by Daniel Lemire), adapted for use within Godot.Key characteristics of the Godot-patched version include:
- A simplified
grisu2namespace. - Unique function names to prevent collisions.
- Support for both
floatanddoubletypes viato_chars. - Removal of trailing
.0logic to maintain consistency with Godot'sString::num_scientificbehavior.
- A simplified
Overview of the Godot glTF module architecture
masterThe glTF module in Godot is responsible for importing and exporting glTF files. It is organized into several layers:
- glTF Structures: Represented as C++ classes in the
structures/directory, these are the fundamental building blocks of a glTF file. - glTF Extensions: Located in the
extensions/directory, these provide optional features that extend the base glTF specification. - GLTFState: A container that holds collections of glTF structures and extensions.
- GLTFDocument: The primary interface that operates on
GLTFStateand its constituent elements to perform transformations. - Editor Integration: The
editor/component utilizesGLTFDocumentto handle the actual import and export of 3D models within the Godot editor.
- glTF Structures: Represented as C++ classes in the
Understand the GDScript compilation pipeline
masterThe GDScript compilation process follows a general order to transform source code into executable bytecode for the virtual machine. This process is used both in the editor and in exported games. The stages are:
- Tokenizing: Converting the source code
Stringinto a sequence of tokens (language constructs, identifiers, literals). - Parsing: Building an Abstract Syntax Tree (AST) from tokens and identifying syntax errors.
- Analyzing: Verifying code logic, performing typechecking, and resolving scopes.
- Compiling: Generating bytecode from the AST and populating runtime class information.
Note that the full compilation must complete before the bytecode can be passed to the virtual machine and run.
// General order of operations: // Tokenizing -> Parsing -> Analyzing -> Compiling- Tokenizing: Converting the source code
Understand OpenXR project licensing and compliance
masterThe OpenXR GitHub projects use multiple licenses. While general practices exist, the data in or adjacent to each file is the authoritative license and copyright data.
To ensure compliance, look for:
- License identifiers in each file.
- Adjacent files with a
.licenseextension. - The
.reuse/dep5copyright description file.
You can use the
reusecommand line tool to generate a software bill of materials (BOM) in SPDX format from this data. Note thatreusetypically excludes generated files; for a complete BOM including API headers and loader source, use theOpenXR-SDKrepository instead.Understand the difference between Full and Shallow scripts
masterGDScript loading involves two levels of preparation managed by
GDScriptCache:Shallow Scripts: Obtained via
get_shallow_script(). These are scripts that have been parsed but not yet analyzed or compiled. They provide information about defined classes and class members. They are useful for checking class interfaces or member existence and are critical because they cannot create cyclic dependency problems.Full Scripts: Obtained via
get_full_script(). These are scripts that have been statically analyzed and fully compiled. They are ready for execution but can create cyclic dependency problems. The analyzer, for example, avoids requesting full scripts to prevent these issues.
In practice, a full script is typically the result of calling
GDScript::reload().Core concepts of linux-dmabuf feedback
masterThe
linux-dmabuffeedback protocol allows Wayland compositors and clients to negotiate optimal buffer allocation parameters to improve performance (e.g., via direct scanout or optimized texturing).Key abstractions:
- Main Device: The primary render device used by the compositor for composition. Clients should prioritize allocating buffers that can be imported and textured from this device to ensure a fallback path exists.
- Tranches: A set of compatible format/modifier pairs for a specific target device.
- Each tranche includes a
tranche_target_device,tranche_flags, andtranche_formats. - Scanout Flag: If a tranche has the
scanoutflag, thetranche_target_deviceis a KMS device, and buffers allocated with its formats/modifiers are eligible for direct scanout.
- Each tranche includes a
Clients should use tranches to select the most optimized format/modifier and avoid cross-device memory operations where possible.