Godot's 5 Scripting Languages: Which Should You Use?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video you will learn which are the five officially supported programming languages to code your games in godot they are gdscript c-sharp visual script and cnc plus plus through the engine's native script technology we will start by talking a bit about programming then go over the pros and cons of each language and we will wrap up with your most common questions like which language should i use why godo has a unique language gdscript and so on this video is part of an incredible free series to get started with godot okay i'm exaggerating a bit but this is the free course i wish we had when i got started with godot there's a lot more to come and so if you don't want to miss out be sure to subscribe right now let's get the lesson started in godot you can create scripts which are files that contain code you can attach them to a node to extend its behavior the code itself can be text as with gdscript or visual with godo's visual scripting language so first programming isn't just typing code even when you create notes and scenes in godot this is part of your code even though it's graphical when we say that a script extends a node's behavior it means that the script inherits all the functions and properties of the node they are attached to for example take a game where a camera to the node follows a ship the camera 2d node makes the view follow the camera's parent node by default here it's the ship imagine you want the view to shake when the player takes damage as this feature is not built into godot you need to attach a new script to the camera and code the shake yourself that's the purpose of scripts a tool you will use all the time to make nodes do useful things the bad news is you really can't make games without coding the good news is it's interesting making and finishing games is deeply rewarding and programming is a skill that will serve you for a lifetime godot offers you five gameplay programming languages g script c sharp visual script nc and c plus plus but yeah it's gt negative technology there are more community support languages but these are the official ones notes you can use multiple of them in a single project in a team you could code gameplay logic and gd script as it's fast to write let level designers script quests in the graphical language visual script and use c-sharp or c plus plus to implement complex algorithms and maximize their performance or you can write everything in gd script or c-sharp it's your call really goto offers this flexibility to answer the needs of different game projects and developers now let's go over every option starting with gdscript gdscript is an object oriented and imperative programming language built for godot it's made by and for game developers to save you time coding games it has a simple syntax that leads to short files it compiles and loads blazingly fast it's tightly integrated into the editor with code completion for nodes signals and the scene it's part of with gdscript you can code your entire game inside godot it has built-in vector and transform types making it efficient for heavy use of linear algebra a must for games it supports multiple threads as efficiently as statically typed language this is one of the features the devs could not provide easily with a third party language like lua or python gd script has no garbage collection as this feature eventually gets in the way when creating games instead the engine counts references and manages the memory for you in most cases by default but you can also control memory if you need to gd script is a gradually typed language this means that variables have dynamic types by default but you can also use type hint for strong type checks which helps you prevent errors finally the language looks a bit like python at the gallons as you structure your code using indentations that is to say tabs or spaces at the start of code lines but gd script really doesn't work the same way in practice it's inspired by multiple languages including squirrel lua and python but again built specifically for game developers as microsoft c-sharp is a favorite among games developers goto officially supports it c-sharp is a matter and flexible language with tons of libraries written for it c-sharp offers a good trade-off between performance and ease of use although you should be aware of its garbage collector you must use the mono edition of the goto editor to script in c-sharp which you can download on the godo's website since godot uses the mono.net runtime in theory you can use any thirdparty.net library or framework in godot as well as any common language infrastructure compliant programming language such as f-sharp boo or closure clr however c-sharp is the only officially supported.net option the main advantage of c-sharp is its ecosystem which is really large this is also a general programming language we especially recommend it to c-sharp developers visual script is a graph based visual programming language where you connect blocks it can be a great tool for non-programmers like game designers and artists you can use other languages to create custom blocks that are specific to your game for example to script ai's quests or dialogues that's where the strength of visual script lies while it provides all the basic building blocks you need to code complete games i would not recommend to use visual script this way it still lacks some features to make programming efficient with it compared to using other programming languages godot ships with a technology called gdnative that allows you to write game code in c or c without needing to recompile or even restart godot you can use any version of the language or mix compiler brands and versions for the generated shared libraries thanks to the use of an internal c api bridge c and c plus plus are the best choices for performance you don't need to use it throughout an entire game as you can write other parts in gd script c sharp or visual script which will be more productive when working with gd native the available types functions and properties closely resembles godo's actual c plus apis so it feels a bit more like programming inside the engine but this is an advanced feature and right now you need to be a bit tech savvy to use it it's really for developers who are used to compiling that code that's a quick run through the various available options now we're going to answer some of your most common questions which is maybe the more interesting part first is which language should i use if you're new to programming or you don't know c-sharp already i really recommend you start with gdscript the guru team made this language specifically for godot and game developers gdscript syntax is lightweight and straightforward and it provides the tightest integration with the engine for c-sharp you will need an external code editor like vs code or visual studio while c-sharp support is now mature you will also find fewer learning resources for it compared to gd script that's why i'd recommend c sharp only to people who already use c sharp another common question is why did the developers make a new language gscript instead of using python or lua directly actually years ago godo used python then lua both languages integration took a lot of work and had severe limitations for example threading support was a big challenge with python and it's something game developers really need to make complex commercial games in the end developing a dedicated language doesn't take the developers more work than maintaining an external languages integration and they can tailor it to our needs they're now working on performance optimizations and features that would have been difficult to offer with third-party languages how do gdscript and c-sharp performance compare gd script code itself doesn't execute as fast as compiled c sharp or c plus plus however most of your code calls functions written with fast algorithms and c plus plus inside the engine in many cases writing gameplay logic and gd script c sharp or c plus plus won't have a significant impact on performance and when it does well you can write that bit of code in c sharp or c plus should i learn c sharp as it's widely used this is a question for people getting started and a common concern you want to learn one language and be able to use it everywhere well this is a bad idea and programmers don't do that first learning a game engine's functions and features will take you like 100 more times than learning the language syntax and that is true of all game engines more importantly once you learn one programming language it becomes much easier and faster to learn the next one it's not like natural languages where it'll take you years to learn chinese or russian most programming languages are very similar and it's always the surrounding technologies that take time to learn now if you're new to programming and godot you will find more resources for gdscript the language is simpler than c-sharp and it's really efficient to use in the engine so it will make up for the invested learning time later so much of what you learned using gd script like the ability to think like a programmer and do creative problem solving will translate to other languages and these are the important skills there are so many language options well the developers drop any the number of options sometimes scares people that one could be dropped in the future as it happened with unity's boo when that happens and you're actively using the language it really sucks because you have to translate all your code to another language drop the libraries you were using and find new ones the good news is it's extremely unlikely to happen with godot first because it's a very active open source community driven project and there will always be people to use and maintain those languages second because the good developers created a technology native script or gd native that makes supporting those languages efficient to maintain and that does it for the questions if you have any more please ask them in the comments below and i'll try to get back to them there are many more videos coming in this series and so if you don't want to miss out you have to subscribe if you want more good content and insights right now i wrote a 7 day getting started course that extends this video series a bit like a script extends a note you can get it now for free on our website the link should be on the screen and in the video description in the next video you will get to code your first moving little character using the gd script programming language this is also the language we'll use in the rest of this series see you in the next one
Info
Channel: GDQuest
Views: 38,351
Rating: undefined out of 5
Keywords: godot scripting, godot programming languages, godot getting started, godot scripting languages, which programming language to learn first
Id: FmDgLyyEEYs
Channel Id: undefined
Length: 10min 42sec (642 seconds)
Published: Thu Mar 25 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.