GDNative.
As writing custom modules is meant for adding functionality to the engine hence it’s advanced, the most fit way to code game play would be GDNative in the form of a library.
So, here’s the workflow with GDNative:
You write your cpp/h files in an external IDE (like MSVS). The cpp has additionally code for registering classes and methods to be used in Godot.
Build them into dll’s (Windows) / so’s (Linux). To do this you have to download cpp bindings and Godot headers.
In Godot you create a GDNativeLibrary (on disk it has gdnlib extension).
In Godot you create a NativeScript (on disk it has gdns extension). This has to be based on the gdnlib above.
In the node you want the C++ functionality, you create a regular GDScript and you call the registered methods from within there, like you’d call methods from any dll native library.
GDNative is still work in progress and there are no straightforward tutorials on it but Readme.md from cpp bindings is a good start.
Would it be this complicated int he future, as you said GDNative is still work in progress?
Joe0239 | 2017-12-18 09:51
If I’m not mistaken I’ve seen changes on the GDNative C++ part like complicated method calling i.e. gdn.call_native("standard_varcall", "some_test_procedure", []) for calling some_test_procedure(), getting slimmed down to just calling f.i.cppClass.some_test_procedure().
I’m expecting improvements even further but I don’t know how further.
For more info on C++ coding in Godot check these out: https://forum.godotengine.org/16746/will-c-ever-be-built-into-godot?show=16746#q16746
You have a lot of possibilitys to use native Code in Godot Engine!
I’ve made some videos about this topic, and collected the most important once here in my Steam guide