godot-go icon indicating copy to clipboard operation
godot-go copied to clipboard

Go bindings for Godot 4.2 GDExtension API

Actions Build Status


godot-go

Go bindings for the Godot Game Engine cross-platform game engine. godot-go integrates into Godot through the Godot GDNative and NativeScript APIs through cgo.

The project is currently under heavy development. The API should be considered EXPERIMENTAL and is subject to change. The API is expected to become more stable as we get closer to a 1.0 release.

Getting Started

To start using godot-go in your own go project:

go get -u github.com/godot-go/[email protected]

The only real documentation that currently exists is in the test Godot project embedded in the library and the Dodge the Creeps port in the godot-go-demo-projects repository. Referencing the official C/C++ documentation of GDNative will help for the time being.

To run the tests in the project, run the following:

git clone github.com/godot-go/godot-go
cd godot-go
GODOT_BIN=godot go run mage.go -v test

Please adjust GODOT_BIN to point to your godot executable. Changes to godot-go package has a compile time of roughly 4 minutes on my setup; so, please be patient. Once it finishes compiling, the tests will run and the demo app will automatically start.

Please install Go version 1.15.3 or above to get the latest cgo improvements. I encourage everyone to install Go through Go Version Manager

Support

godot-go has been tested to work with Godot 3.2.x in the following platforms and architectures:

Platform Builds Cross-Compile from Linux Builds from native OS Test Pass
linux/amd64 Yes Yes Yes
darwin/amd64 Yes Yes Unknown
windows/amd64 Yes Yes Unknown
windows/386 Yes Unknown Unknown
android/arm Unknown Unknown Unknown
  • The Github Workflow test_windows tests building on a Windows machine. However, tests stall indefinitely and thus the results are unknown.

My development environment is on Ubuntu 20.04; therefore, support for Linux is primary for the project. The project also compiles for Windows and MacOS, but issues may pop up that might not be caught by the continuous integration process. Please feel free to file issues as they come up.

The initial goal is to support Linux, MacOS, and Windows out of the gates. Eventually, we plan to support all platforms where Godot and Go is supported.

Generating Codegen

There is a bit of codegen as part of godot-go. If you've made modifications to the generation, the goimports package will need to be installed to run go generate:

go get golang.org/x/tools/cmd/goimports

To regenerate the codegen files, run the following:

go generate

godot_headers has to be copied into the project because go get does not support git submodules. Currently, I've exported godot_headers from f2122198d5 git hash.

Contact

I'm happy to help out anyone interested in the project. You can add me (surgical#3758) as a friend on the Godot Engine Discord servers. I primarily frequent the gdnative-dev room.

References

Credit

  • Inspiration for the project was taken from ShadowApex's earlier project: godot-go
  • Test project art assets taken from Free RPG Asset Pack