C vs C++ vs Rust vs Zig?
Hello community!
I wanted to ask which of the programming languages above is best suited (in terms of performance) for video game development.
So which one is faster 🙂
Maybe someone here knows about it!
Thank you in advance!
You could also use a combination of it.
Existing game engines are likely to offer a C++ or C interface. In most cases you will use this interface with C++ code.
Rust and C++ can call each other. So you could write your code in Rust and use the game engine with C++ interface.
According to Website the mutual call should not cause any/close performance losses.
If you were using Rust, for example, you would have the safer Storage management or other benefits of Rust. Data exchanged between Rust and C++ will still have to be taken care of.
For example, you could use Unreal Engine with C++ Interface via Rust.
It is not a recommendation to put it into effect, but it would be a possibility.
Okay, thanks, but that’s too complicated.
Thanks anyway!!!
Languages are not fast or slow. All languages mentioned can be compiled directly to the target hardware AOT and come out without a large transit time system, which is usually beneficial for such applications.
For such a purpose, it is useful to find a language that is already established in game development because there are corresponding libraries/engines and documentation.
Of these, this is the most common C++.
Rust is a (moderate growing) niche product and hardly established in game development. Zig falls under experimental anyway and is a tiny niche. Of course, you can also work with naked C, but for large projects C++ is a bit more convenient and more common.
I’ve already learned a lot of C++ and I’m now skeptical about whether that was a good idea because it’s somehow called Rust C and C++.
C is the implementation language of many operating systems and C++ is the implementation language of many GUI frameworks. This fact gives both languages an inventory and usage guarantee for a very long time.
If that should be true (and that is by no means clear): There is a huge amount of existing code in C and C++. It will not be replaced overnight – the best example is the Firefox browser, which is the pioneering project for Rust.
Thus, a slow, glacier-like shift will come to a maximum over the next decades. Rust is not a language that is very easy to learn and does not bring any grandiose immediate productivity benefits. The improvements are more incremental (to C++).
Hello! The choice of programming language depends on different factors, not only on performance. But when it comes to speed:
– **C**: Very fast, but you need to handle many things manually (storage management etc.).
– **C++**: Also fast and offers more features such as classes and templates. Often used in game development.
– **Rust**: Almost as fast as C and C++, but with better storage security. Not so widespread in game development.
– **Zig**: Relatively new and aims to provide C-like performance with more modern features. Less common than Rust.
For game development, C++ is usually the best choice as it offers a good mix of performance and features.
I don’t know Zig now, but C, C++ and Rust will not differ significantly.
I would recommend C++ – this should be the industry standard (not only) for game development, with correspondingly broad support regarding frameworks and community.
C is too insecure – too easy to detect mistakes. C is only interesting for embedded development (hardware proximity).
Rust is significantly safer than C or C++, but probably the support in game development is only rudimentary.
I also hear from all sides Rust would replace C++. Is that bullshit?
No, Rust probably has the stuff. But Rust is 8 years old, C++ almost 40. The ecosystem for Rust and the developer base/community is still not so far.
Ask that again in 10 years, and maybe my answer will be different. :
And even if I can then program my project in Rust so in 5 years if I have not deleted it until then;)
C++ is currently still the common P.Language for games… but C# will replace them.
Performance…
If I need 10 loops to animate 10 sprites on the screen, but it would also go with a loop… it almost doesn’t matter what language you use… It’s just fucking programmed.
Performance is so multi-layered and PCs become so fast that the language is rather secondary. On a Windows PC, for example, there is also a scary hungry operating system in the background, which already attracts so much performance. But the same program would “run” much better on PlayStation.