Thanks to the new GDExtension functionality in Godot 4, it should be easier to more tightly integrate external programming languages, which is exactly what HxGodot does with the Haxe programming language. There are several Haxe powered game engines available and this extension brings support to one more.
There are a few prerequisites for using HxGodot, including:
- A Commandline shell of your choice. We assume a *nix-based shell for all commands presented here.
- Haxe 4.2+Install Haxe and setup Haxe’s package manager via
- hxcpp 4.2+Install hxcpp by running
haxelib install hxcpp
- Godot 4 beta10+ (best build from master)
The project is described as:
HxGodot combines Haxe’s hxcpp target with Godot 4’s GDExtension mechanism to supercharge the way you build games with Godot. Nodes are written in Haxe, bundled as a GDExtension and behave like any other Node in your scenes(attach scripts, signals, etc).
The GitHub repository contains instructions on configuring your development environment and creating your first project. Additionally there is a complete example showing HxGodot in action in the form of Squash the Creeps, which is probably where you want to start.
There are a few gotchas to be aware of, as this is an alpha release. First, it does not currently work on MacOS with ARM64 chips. This is a known issue and is being worked on. Second, in the Creeps example, it will generate an obj folder in the bin directory. Be sure to erase this (in the file system or within your Godot project) as Godot will treat these obj files as 3D files instead of the intermediate C++ files they are, which will cause Godot to run out of memory and eventually crash.
You can learn more about Haxe development in the Godot 4 game engine using HxGodot in the video below.