0 votes

Hi,
Im new in godots engine and i would like know if is possible merge GDSCRIPT and C Code, for example, create a SQL login/register in C and later go to the game scene programed in GDSRIPT.
Another example, create something in GDSCRIPT, that can interact with something created in code C.

If is possible, please tell me how i can do it for a future project.

Thanks and regards

in Engine by (18 points)

1 Answer

0 votes

Yes, you can definitely do that. You can either create a GDNative module, or a normal C++ module.

The API in the C++ side is practically almost the same as in GDScript (actually it is a superset since not all methods are exposed to GDScript), so it is somewhat easy to learn.

Normal C++ modules are the original and stable approach for adding custom C/C++ code to your game. GDNative is still very new.

Go through the whole "Engine development" section to get a good overview for working with the engine code:
http://docs.godotengine.org/en/3.0/development/cpp/index.html

See the "compiling" section so you are able to compile your custom modules:
http://docs.godotengine.org/en/3.0/development/compiling/index.html

Take a look at this for custom C++ module development:
http://docs.godotengine.org/en/3.0/development/cpp/custom_modules_in_cpp.html

Or for GDNative there is this example:
http://docs.godotengine.org/en/3.0/tutorials/plugins/gdnative/gdnative-c-example.html

by (262 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.