GDLibrary is a pure GDScript system for building reusable, distributable libraries—similar to DLLs—directly in Godot Engine. It allows you to define, export, load, and package modular .gdl files and convert them into binary .gdlb format for efficient use and distribution.
Note: While Godot already has an existing plugin system, I created GDLibrary to build my own custom library system tailored specifically for modular GDScript code reuse and distribution.
- 📦 Define modular libraries using
.gdlfiles - 🔐 Package them into
.gdlbbinary format with compression and checksums - 🧠 Load libraries dynamically at runtime
- 📁 Compatible with
.pckpackaging - 💡 No C++, GDExtension, or plugins required—just GDScript
-
Clone or download the repository.
-
Add the
GDLibraryfolder to your Godot project. -
In Project Settings → Global, add the
GDL_Core.gdscript as a global singleton namedGDL_Core.Example:
Path Name Enabled res://GDLibrary/GDL_Core.gdGDL_Core✅ -
You're now ready to create and load
.gdllibraries.
To create a new module (library), run the following GDScript commands:
GDL_Core.create_gdl_module("testModule")
GDL_Core.export_module_source("testModule")This creates a new file at res://gdl_modules/testModule.gdl with:
-
Metadata block (name, version, dependencies, exports)
-
Function stubs
-
Ready for editing
You can now open and modify testModule.gdl like any other GDScript file.
Once a .gdlb or .gdlb file is in res://gdl_modules/, you can load it:
var test = GDL_Core.get_module("testModule")
test.some_function()get_module("name") returns the loaded module (as a script instance) or loads it if not already active.
To convert all .gdl source files into .gdlb binaries:
GDL_Core.convert_all_gdl_to_binary()This compresses and saves .gdlb files alongside the originals for shipping in .pck or .zip exports.
-
.gdlb files are fully compatible with .pck exports.
-
As long as the binary is present in res://gdl_modules/, it can be loaded like any other module.
-
Source
.gdlfiles are prioritized in editor, but.gdlbwill be used in release builds if source is missing.
At runtime, you can check if those dependencies are loaded:
check_dependencies()This returns true if all required modules are loaded, otherwise logs which are missing.
func _ready():
var utils = GDL_Core.get_module("Utils")
if utils and utils.check_dependencies():
utils.rainbow_log("Hello from GDLibrary!").gdlb files are compiled containers with:
-
Magic header: GDL\x01
-
File version and timestamp
-
Sections:
-
metadata: Dictionary (name, version, exports, dependencies)
-
source_code: Compressed UTF-8 GDScript string
-
exports: Dictionary or list of callable functions
-
dependencies: Array of required module names
-
resources: Optional embedded resources
-
Checksums to validate integrity
Source modules (.gdl) are editable and good for iteration.
Binary modules (.gdlb) are preferred for release builds and protect source logic.
Both formats can coexist in the same folder—.gdl takes precedence in the editor.
MIT License — use freely in open-source or commercial projects. No credit required, but always appreciated!