|
|
||
|---|---|---|
| coronation | ||
| docs | ||
| gdext | ||
| src | ||
| testproject | ||
| tests | ||
| .gitignore | ||
| config.nims | ||
| docker-compose.yml | ||
| gdext.nimble | ||
| LICENSE | ||
| nimble.svg | ||
| README.md | ||
| tasks.nims | ||
Nim for GDExtension — a pure library and CLI tool.
Quick start
nimble install gdext
mkdir testproject && cd $_
touch project.godot
gdextwiz new-extension MyExtension
gdextwiz run
Features
- Access all classes and methods provided by the engine directly from Nim.
- Define new extension classes that inherit from engine classes and expose them to the editor and GDScript.
- Add new methods, signals, properties, and enums to your extension classes and expose them as needed.
- Define and expose virtual functions, which can be overridden in both Nim and GDScript.
- Reload recompiled GDExtensions without restarting the editor (Hot Reloading).
- More expressive arithmetic operations (e.g., vectors) than Godot’s defaults — GLSLang-style swizzling is also supported.
- Includes a CLI tool for creating new extensions, compiling, running projects, and more — all from a single interface (see wiki - gdextwiz).
- Generate class references from comments and annotations in the code.
- Web platform support via Emscripten.
Limitations
-
Editor plugins cannot be written using pure Nim alone.
To create an editor plugin, your extension class must be properly wrapped in GDScript and integrated via aplugin.cfgfile. This setup is currently not automated. -
Due to engine constraints, Nim code is executed only when called from the engine.
It is not possible to run Nim as a standalone Godot application entry point.
vs. GDScript
Nim and GDScript have very similar syntax, making porting between them relatively straightforward.
|
|
Guntur Sarwohadi (@guntur-ctech) reports that optimizing the build configuration for a simple port can yield performance gains of up to 6×.
https://github.com/guntur-ctech/simulation-performance-comparison
Commands
install
Installs the gdext library and its CLI tool gdextwiz.
nimble install gdext
The gdextwiz tool will be installed to ~/.nimble/bin, which is automatically added to your PATH if you've installed Nim via the official method.
uninstall
Removes the library and CLI tool:
nimble uninstall gdext
CLI Tool: gdextwiz
Use gdextwiz to create, build, and run your GDExtension projects from the command line.
📘 For detailed usage and subcommands, see the gdextwiz manual.
Supported environments
OS
- Linux
- Macos
- Windows
Engine
- godotengine/godot 4.5.0 or higher
Nim compiler
- nim-lang/nim 2.0.12 or higher
Macos
Use Nim installed via Homebrew, notchoosenim. This is because Godot requires a native AArch64/ARM64 binary, while choosenim installs an x86_64 version that runs via Rosetta emulation.
Tested by author and maintainers
Note
Support for other environments depends on community feedback. Please consider contributing your findings!
- OS: Linux (Arch) — Author | Mac M2 — @ArikRahman
- Engine: Godot 4.5.stable.arch_linux | Homebrew Godot 4.4.1 arm64-apple-darwin24.5.0
- Nim: 2.2.0 | 2.2.2 | 2.2.4 | 2.2.6
- CC: gcc version 15.1.1 20250425 (GCC) | clang version 17.0.0
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
godot-nim/gdext