Seamlessly use Google Protobuf messages as native Resources in Godot.
gdbuf compiles your .proto files into a high-performance GDExtension (C++), automatically bridging the gap between your network/data layer and the Godot Engine.
Note: This project was developed with the assistance of AI coding tool OpenCode using the Google Gemini 3 model.
Much care and guidance was exercised.
Note: lol. trying to de-slop this so its actually functional
- Native Resources: Your Protobuf messages become first-class Godot
Resourceobjects. Create, edit, and save them (.tres) directly in the Godot Editor. - Inspector Integration: View and modify message fields in the Inspector with full type support.
- Documentation: Comments in your
.protofiles are automatically converted into Godot Editor tooltips and documentation. - Performance: Built on GDExtension and C++ for maximum speed.
- Zero Boilerplate: No manual C++ coding required. Just run the tool.
- Go (1.21+)
- protoc (The Protocol Buffers compiler) installed and in your system PATH.
- C++ Compiler (gcc/clang/msvc) & CMake (for building the extension).
git clone --recursive https://github.com/onion-4-dinner/gdbuf.git
cd gdbuf
make build
# The binary will be in bin/gdbufRun gdbuf pointing to your Protobuf definitions directory. It will handle parsing, code generation, and compiling the GDExtension library for you.
./bin/gdbuf \
--proto ./path/to/your/protos \
--include ./path/to/your/protos/public \
--include ./path/to/your/protos/private \
--out ./path/to/godot_project/addons/my_proto_extension \
--name MyProtoLib-
--proto: Path to the directory containing your.protofiles (Required). -
--include: Additional directories to include for resolving imports. Can be specified multiple times. -
--out: Directory where the compiled GDExtension (library +.gdextensionfile) will be placed (Default:./out). -
--genout: Directory where the intermediate C++ source code will be generated (Default:.). -
--generate-only: Only generate the C++ source code, skipping the GDExtension compilation step (Default:false). -
--name: Name of the GDExtension library (Default:gdbufgen). -
--platform: Target platform(s) to build for. Can be a single platform (linux,windows,web,android), a comma-separated list (linux,web), orall. Default: Host OS. -
--cache: Custom directory for build artifacts and toolchain downloads (Android NDK, Emscripten SDK). Default: System cache directory (~/.cache/gdbufon Linux,~/Library/Caches/gdbufon macOS). -
--debug: Build debug binaries instead (Default: false) -
--threaded: Build multi-threaded binaries for web (Default: false) -
--double: Build with double-precision floating point variables (Default: false)
Once the extension is generated and placed in your project:
- Restart Godot to load the new extension.
- Use in GDScript:
# Create a message var msg = MyMessage.new() msg.health = 100 msg.name = "Player 1" # Serialize var bytes = msg.to_byte_array() # Save to disk ResourceSaver.save(msg, "res://player_data.tres")
- Use in Editor: Right-click in FileSystem -> New Resource -> Search for your message name.
- Features & Supported Types: Detailed list of supported Protobuf features and how they map to Godot.
- GDScript API Reference: Detailed guide on using the generated GDScript API.
- Developer Guide: Architecture overview and guide for contributors.