Should I use GDScript or C# in the Godot game engine?

preview_player
Показать описание
Here, I answer your quick questions about Godot and game development in simple videos.
If you have a question that we can answer in 5 minutes max, ask away!
Рекомендации по теме
Комментарии
Автор

Note that you can use both GDScript and C# in the same project, and they are interoperable. So you can absolutely code some systems in C#, some in GDScript. Though of course, this is something we can't recommend to beginners as you need to deal with two languages, but it might be interesting to professionals.
One consideration I did not include in the video is performance because beginners, whom I think is the main target for this question, can have misconceptions about performance.

C# can be quite a bit faster than GDScript code, but it depends on the context. If most of your code calls functions built into Godot, the difference is very limited because most of the code you run comes from the Godot engine.
The difference gets big for 100% custom systems that you code from scratch in your game. Godot provides many features out of the box so many games never need such custom systems.
We're talking about things built from scratch, especially things where you use many loops like procedural content generation algorithms. In those cases, you may need a language faster than GDScript, and you can use C#, or a lower-level option like C++.
At GDQuest, we chose to use GDScript exclusively for gameplay code and C++ if we need a lot more performance. That's because we can directly reference the engine's source code and tweak it. We also generally code the system once in C++, recompile the engine, and then we keep the very fast iteration times in production with GDScript.
But this isn't an option for everyone: you need to know C++, and while C# is about as feature-full, the learning resources for C++ are unfortunately often less accessible than for C#.
So if you find GDScript too slow for your game, but you don't want to use two different languages, C# is a convenient option. I would also recommend it in this specific case. Just don't forget the tradeoffs: build and iteration times will become slower than with GDScript.

GDQuestQA
Автор

I personally started using c# with godot because it gives you a more "standard" development experience. It makes my workflow more about using godot as a tool and less about endlessly learning the engine. It allows you to carry over your workflow from other engines easily, and has much more to offer (static variables, classes, structs etc...)

phileon
Автор

I've been teaching Game Design to high school students for 2 years. The previous teacher used Unity so I followed in their footsteps. I thought, well it's an industry standard tool, C# is more known etc, but in the end, most of my students are not actually going to work in the industry. I'm really thinking of using Godot and your tutorials next school year. Unity is such a resource hog and runs slow on our computers. Having GD Script more tightly integrated into the engine is a HUGE welcome too. I think what I most need to do with my students is to expose them to the ideas of game development and teach them how to make prototypes, and then if they go on to college and study it more, they could choose to learn Unity et al. In the end, my class is an elective, and I do get students who have no interest in writing code, and the hurdles Unity puts in front of us really breaks some of those kids, then they check out. I think Godot would work better and keep more students engaged and help them be more successful on their projects.

owenpeery
Автор

For me, we use GDScript for prototyping, so that the testing team and the gameplay programming team could have quick fixes and improvements to the game. However, we use C# for production code, and we always use C# for everything that is related to networking. Type hinting is a welcome addition to GDScript, but for C# is a primary function. This way most bugs could be eliminated even without testing.

zedespook
Автор

For a video titled "Should I use GDScript or C# ?", I expected some arguments for both sides (and not only GDScript) apart from "use C# if you're already familiar with it".

Informative, but I'm a little disappointed

morphball
Автор

Another point: C# knowledge will transfer better to other engines and also if you will get into C++ programming eventually.

vast
Автор

The tools feature is working well on C#. But you need to press on "build" button after the changes. Best advantage of C# for me, it works faster than GDScript. But of course, GDScript makes you feel more integrated to the engine.

erayzesen
Автор

Will some flaws with using C# become better with Godot 4?
And thank you so much for this comparison!

MRxRadex
Автор

The speed difference, though it got smaller with GDScript 2, is still a difference at an order of a magnitude. You can still use GDScript, if you prefer it, for parts that don't need the performance, but you should always use C# or GDNative for performance critical parts.

hypnotox
Автор

C# is not technically compiled but hybrid, still faster than GDscript but it doesn't really make a difference of you make a 2d game or a light 3d one as modern devices can run thel both smoothly and almost effortless.

benzenatizineeddine
Автор

I'd prefer c#, since it just feels more robust. Whenever i write c#, i have a programmer mindset, thinking about writing good code, hiding information etc., With gdscript, my brain neglects all of that because it doesnt have a way to mark stuff as public or private, other than relying on conventions.


Its also annoying that when you connect signals to a script, you have to manually type out the parameters of the reciever method, its really tedious compared to gdscript.

BlazertronGames
Автор

thanks for the video!
It came just in time, because I just switched from unity with C# to godot
and I think I will stick to GDScript then.

NudGameDev
Автор

Strange that performance is not mentioned. C# is used almost everywhere(other game engines and apps) and GDScript is only used in Godot.

bexplosion
Автор

The C# version is now officially .NET version, I like learning new languages so I went for the GDscript version :)

Rhovanion
Автор

One thing that confuses me is when 70% of tutorials use simple GDScript, then when I click on the other 30% of tutorials I see scripts including void and < and > and I don't know why some people use one style over the other. It's made learning GDScript confusing for me tbh. It was easier learning C# for Unity.

CoryPelizzari
Автор

There are countless of c# online. GDScript sounds awesome but, as someone who does native mobile, web and desktop applications l, etc, I just cant slow down/pause on C#. Hopefully it improves in the future, I'm just gonna focus on trying to get more into godot.

doge
Автор

As a person who has learned almost full C#, I'll be using C# more like n Godot because I'm comfortable with it as I also learned unity. But I'll use GdScript Too

NatusTree
Автор

GDScript + GDExtension C++ is my to go. GDS is for common code GDEC++ for performance critical process and external shared libraries.

surplusking
Автор

I've been a dotnet developer since 2003 and a C# developer since about 2008, would you still recommend GDScript or would there be any benefit to using C#?

I'm thinking about going the GDScript route just because of the reasons you stated about the reloading. Plus to my Godot Newb Eyes, the GDScript looks cleaner.

Denvercoder
Автор

As usual - great explanation. Thank you!
I work with GDScript and try to type everything to make debugging easier, but also I believe in Godot 4 it provides a slight performance benefit.
- unfa

liblast