A common question I receive is, can I use C++ with the Godot game engine. If you are looking to do live game scripting like in Unreal Engine, the short answer is no, you cannot do that with Godot. You can however develop in Godot using C++ in three different ways.
The first option is extremely straight forward. Godot is an open source project, with the vast majority of source code written using C++ (11). You can of course extend or change every aspect of the Godot game engine in this manner, you simply need a C++ compiler, Python and SCONS. You can learn more about the process here or in the Godot documentation available here.
An important detail to note is, even though Godot is open source, it is released under the MIT license, which is very liberal in what it allows you to do. Unlike licenses such as GPL or LGPL, there is no requirement to make your code changes public.
The next and newest option is GDNative. You can think of GDNative as a plugin interface for Godot enabling you to write C or C++ code and is an ideal way to create shared add-ons or extensions. The ideal advantage to GDNative over modules is they are not tightly coupled into the engine itself, so a minor change doesn’t require a complete rebuild.
There are C and C++ templates available here that give you a good idea how to create your own GDNative extension. One major example of a GDNative extension is Godot’s OpenVR implementation. GDNative extensions are the most decoupled from the underlying engine of the 3 methods.
Somewhere between modifying Godot and extending it with GDNative is the use of modules. If you take a look at the Godot Engine source code, you will notice that a large chunk of the engine is implemented as modules. This includes everything for assimp and bullet physics, to GDScript, Mono and even GDNative itself are implemented using modules. Modules are an integral part of the game engine and can integrate tightly, but give you a … more modular, way to extend Godot.
Details on creating your own modules following this tutorial or the official documentation here.
You can learn more about all three options in the video below.
GameDev News Programming