From reading the documentation, it looks like you have to go to a lot of trouble to be able to use C or C++ in the scripts that are attached to nodes. But there's a C# edition of Godot already provided.

Is that just a matter of supply and demand, i.e. more people want to use C# than C/C++?

Yes and no, most people who are inclined to use C/C++ probably do so on engine/module level rather than via GDnative/as a scripting solution.

Many of them might even be using gdscript to do the scripting and when they hit gdscript limits say performance wise they then build a source/c-level module or plugin for specific functionality perhaps.

I.e. do the mundane and simple logic in gdscript and any heavy lifting in C/C++.

My intent is to stick with GDScript unless I run into performance issues. Then I would use C/C++/C# where needed.

I was just wondering if there are any reasons to prefer C# over C or C++ in that situation. (I'm not asking for a general comparison of the three languages. My question is only within the context of Godot.)

If performance is your goal then C/C++ is going to do better, but in terms of the hassle of having to setup linkers and dependencies and compile to test every change, well... that is something you will have to determine for yourself.

@Megalomaniak said: the hassle of having to setup linkers and dependencies and compile to test every change

That's not necessary with C#?

Performance is not my primary goal. I'll use GDScript unless the product's performance is low enough to adversely affect its quality.

Dependencies sure, but no where near as complex in my admittedly very rusty experience. You don't really need to compile it per se. It gets compiled but to JIT bytecode similar to java.

I have used gdscript/gdnative/native-module. I've used C# with unity. I will say this, C++ has lower 'portability' issues than C# because it is in essence the game's binary. If the game is running on a platform, C++ will. You get all the power and annoyance of C++ and all the choice of IDE for it. If you use C# you are still dealing with the godot engine which is implemented in C++.

I ended up preferring the module route over gd-native in my case.

One down side of C++ modules is the lack of documentation binding as a GDScript class. I resorted to the game's own code as a reference. GDNative and C++ differ slightly defining methods, properties etc, but you can use the gd-native tutorials to get up and running and building the engine.

If you have speed dependent functionality which can be substantially developed and tested independent of a game engine, I'd simply implement it in C++, pound out bugs and design there and then bind it in Godot as a module.

It helps massively to have a good C++ IDE to search the engine's files to overcome the lack of documentation.

2 years later