Hi,

I want to use C++ instead of GDscript because I need very high performance.
I just want to know if it's possible to use C++ exactly the same way we use GDscript:

  • Coding C++ inside Godot code editor
  • Having a C++ search help inside Godot

I started to use Godot today and I was very happy to learn about C++ but I cannot go through all those long and boring 30-minute Youtube tutorials to just learn how to install it. It's an unbearable torture.

Have you considered C#? Unlike C++, you can write C# scripts inside the Godot editor, and the performance may be adequate.

Which programming languages are supported in Godot?

The officially supported languages for Godot are GDScript, C#, and C++. See the subcategories for each language in the scripting section.

GDExtension C++ example

Introduction¶

The C++ bindings for GDExtension are built on top of the C GDExtension API and provide a nicer way to "extend" nodes and other built-in classes in Godot using C++. This new system allows the extension of Godot to nearly the same level as statically linked C++ modules.

Note that C# support is still relatively new, and as such, you may encounter some issues along the way.

yes, you can use C++ with godot, but no you can't use it exactly the same as gdscript. What you likely want to do is create custom nodes extending base classes or developing all new nodes with specific performance demanding functionality in them via C++ as GDExtentions and then script them via gdscript in the editor after adding them to the scenetree/node-graph.

No, you can't use C++ as a scripting language. You can use extensions that add features to the game/engine with C++ though. What people usually do is write the game in GDScript and profile to find the slow parts. Then you can move those into C++ functions and keep all the main logic in GDScript. Or you can use C#, which has much better performance. Not quite C++ level but it should be in the ballpark.

    JaydenSu Is it possible to use C++ by compiling Godot entirely from Source?

    No, not really. Not unless you want to wait 3 minutes every time you run a script.

      Because you don't write scripts with C++. You'd have to overhaul the whole engine, and then wait a long time to compile every time you want to test a script.

      Possible, yes? Practical or beneficial, no. I think people should code in GDScript and profile the game. It's not guaranteed that the scripts are the bottleneck.

      For example, if you have a high end 3D game and are GPU limited (which is typically the case) using C++ would provide no benefit as the bottleneck is the GPU.

      Don't assume C++ is automatically faster for everything.

      JaydenSu yes, it's actually possible. The source code is posted on github. Why do you write that this is not real?

      We were answering the original question which asked if you can use it like GDScript, and that is a solid no.

      • Heza replied to this.

        Maybe this topic needs to be split into a separate topic starting with JaydenSu's first post, since he seems to be asking a different question than the OP, and that's causing confusion.

        No, I think @JaydenSu was just confused by the answer because you can use godot via c++ only and even write the game logic via c++ it's just that you wouldn't use it like gdscript. At that point you are very likely going to use godot like any other c++ engine where you do everything via code in an IDE and you will make very little use of the editor if any at all. Might still do some scene composition for an example, but not attach any scripts to any nodes.

        The real downside to going this route is you won't be finding much tutorials or documentation for working with godot this way. But if you are a very experienced c++ developer you can probably manage fine on your own with this.

        So the answer to the question as presented by the OP is still that yes, you can use godot with c++ you just wouldn't use it like gdscript.

        2 years later

        Hi it's now possible with Jenova Framework
        https://github.com/Jenova-Framework

        It provides almost all the features of GDScript + Visual Studio integration which gives you full intellisense
        I tried it myself and I must say it's promising, Specially hot-reloading system is so smooth...

        Megalomaniak Now it's a solid yes 😄

          Heza The presentation video is too hectic 🙂

          • Heza replied to this.

            Heza It provides almost all the features of GDScript + Visual Studio

            Is it possible to use another compiler?

            • Heza replied to this.

              Heza and I must say it's promising

              The real question is; is it production-ready?

                xyz The real question is; is it production-ready?

                Current builds are in Alpha stage, Backup your project files! You may end up with data loss!

                Since I use Linux, this makes it useless for me:

                Jenova Only Supports Godot 4.2+, Windows 7 to 11 x64, Linux and Mac support are not planned for now.

                But it doesn't matter, since I'm not interested in writing games in C++.

                https://github.com/Jenova-Framework/J.E.N.O.V.A#%EF%B8%8F-current-features

                xyz On their server they mentioned this video was prepared for godot showreel submission which had 3 minutes limit, that's why. you can check the features in details on their discord.

                xyz
                It's in alpha build but I'm using it for 2 weeks now and it's quite stable. I only had one crash. If you be targeting Windows it absolutely worth it.
                also they made it for their indie game so i think the answer is yes 🙂

                Tomcat afaik mingw and clang are half implemented at the moment.

                • xyz replied to this.

                  Really cool, but gdscript is plenty fast for my turn based games.