What types of games could I develop in C++ using GDExtensions that would be very hard or impossible in GDScript?

Godot Version

4.6.1

Question

What types of games could I develop in C++ using GDExtensions that would be very hard or impossible in GDScript?

1 Like

Probably something like total war or UEBS would be a struggle with GD Script, unless some heavy object pooling was used.

3 Likes

Anything with heavy simulation / raw calculation. However, there is always C# supported natively that you can use, which can achieve almost the same level of performance as C++, and you can mix-and-match it with the GDScript for all these hard calculations.

3 Likes

Minecraft

1 Like

Thanks im looking for pure c++ game , no gdscript and no c#

Why? What are the C++ benefits here?

What are the C++ benefits here?
The large crowd usually uses vertex animation tricks, no?

C++ benefits are always and everywhere the same - performance :smiley:

3 Likes

Why? You should offload as much as possible on GDScript. It plays extremely well in concert with C++. And doing high level logic as an extension doesn’t make much sense when you have the convenience and immediacy of GDScript at your disposal.

The best workflow is to quickly implement/prototype a feature in GDScript first. If it underperforms, consider script threads or compute shaders. If those are not suitable - kick it to C++. In some occasions, when it’s obvious that the thing will demand high performance on the cpu side, go directly to C++.

3 Likes

I wouldn’t know , but those games are notoriously CPU heavy.

I lean on C++ pretty heavily in my current project, but I absolutely use GDScript everywhere/anywhere I can.

The reason is precisely as normalized suggested: performance, specifically the things wchc mentioned earlier: simulation / calculation.

I am not making your typical game though, and for most typical games the engine probably provides all you need (in terms of performance critical code), so in general the answer here is going to be: atypical games.

My particular needs that are delegated to C++:

  1. Pathfinding: 2d and 3d options provided aren’t much good to me, I’m pathfinding on a globe.
  2. Entity count: There are too many ‘things’ in the game, and most the player will never see, so the visual representation for things (godot scenes) are only created for those things that the player can see.
  3. Event queue: my game does not update everything every frame, events are ‘pre-determined’ and inbetween positions are interpolated (if needed, for all those things the player doesn’t see, nothing at all happens until it’s next event is pulled of the queue).
  4. Number crunching: I do a lot of what could be called procedural generation (not of geometry though), which in it’s current state is still too slow (already in C++, but I wrote it in a functional style to get it working, needs reworking to operate on things in place).

So in my case I guess it boils down to a non standard game world (being the world), non standard architecture (event driven) and needing to generate a lot of stuff (procedural generation).

4 Likes

I use GDExtensions for a RISC-V emulator and assembler in game, it is very hard to emulate 32 bit architectures in GDScript given int and float are always 64 bits. I also find writing the parser easier as GDExtension can access each byte in a string as a byte, rather than as a String.

3 Likes

You are not using GODOT build in Event queue? with the signals and all ?
What do you use ?

Are you doing programming type of games? I also managed to embed a JS interpreter into GDExtension.

1 Like

A heap.

Maybe not entirely obvious from my previous post, but I am essentially using Godot for the ‘front-end’ of the game. None of the objects in the simulation proper are derived from godot types, so they can’t emit signals nor listen for them.

1 Like

An MMO.

You can do anything in C++, including every type of game. C++ is used with UE5. The benefits of C++ include efficient memory management.

1 Like

Or massive memory leaks if you are not careful.

3 Likes

oh yeah

1 Like

You must use Valgrind or some other tool to track memory leaks or you are guaranteed to leak memory very efficiently. I have used C++ quite a lot, but the memory management is the reason I nowadays rather use other programming languages.

1 Like