Zig GDExtension prototype

Hello! A while back I put toghether some bits and bobs to automate the boilerplate code required to make a GDExtension for the Godot game engine. I’m probably not going to touch this in a while, so I thought I would share it with the comunity to avoid the work going to waste. It still appears to be functional, but expect to bear the burden of maintenence if you choose to use it. Feel free to fork!

In terms of features, it claims to have full support for custom classes (with custom members, methods, virtual methods, signals) and helper wrappers around Godot’s allocation and logging functions. Not sure if it all still works, but hopefully it isn’t too hard to patch. An example root.zig file is provided that showcases how to use it.

Supported Zig versions

Built with zig 0.17 and godot 4.7

https://codeberg.org/SFN-eu/zig-gdextension-sketch/

5 Likes

Thanks! I’ve actually been looking around for some reference for this, or something pre-built. Have only been finding vibe-coded libraries so this will help get started on an alternative.

Does anyone know if there’s a hand crafted and maintained library for Zig GDExtentions? If not, I may dig in.

2 Likes

Not that I’m aware of, which was one of the reasons for putting this toghether in the first place. The other motivation was automatically generating as much boilerplate as possible, I didn’t want each custom class to need to write what effects to a constructor/destructor pair that just allocates/deallocates itself.

1 Like