What is the best programming language to learn for game development
Jun 20, 2020
For those of you that want the TLDR version of this article, the answer to the above question is quite simply, there isn’t one. If this were the 90’s the answer would most likely be C, C++. If it were even earlier or you were working with game cartridges, the answer would have been some flavour of assembly. However, today there are multitudes of languages to choose from, and every one of them is capable of creating games. So with that said let us discuss a subset of the currently available programming languages, and the reasons you may want to choose one over the other for making your games.
What type of game developer are you?
The first thing to do is to figure out what type of game developer you are and what interests you about games development in general. Are you somebody who loves to play games and has always wanted to create your own? Perhaps you have had an idea for a game for quite some time and are finally diving in to make it. If this is the case you are likely a hobbyist or indie developer and the good news is you can choose pretty much any language you like! Alternatively, if you are looking for a career in game development and want to work on the next big-budget triple-A title, you will likely want to learn the industry standard. In this case, it will likely be C++ or to a lesser extend C#. If your goal is to use a specific engine then your choice of language becomes much easier. You will need to learn the language of that engine.
The different types of programming language
So what are the different types of programming language you can learn for games development? Programming languages usually fall under a couple of categories.
General-purpose programming languages
Firstly, you have your general-purpose programming languages. With these languages, you can make games but also many other types of application. These applications could include web servers, mobile apps, or even the software that powers your fridge. Examples in this category include C++, Java, C#, Python, Rust and many more.
Game engine scripting languages
The other category is scripting languages, while the line between a general-purpose language and a scripting language is becoming increasingly blurred, a scripting language in this context refers to a language used to script game functionality on top of a game engine written in one of the all-purpose languages mentioned above. For example, the Godot game engine is written in C++ however you can create the logic for your game in GDScript. Some engines use an all-purpose language for scripting while some do not. Some scripting languages have the disadvantage of being tied to the engine they were designed for. You can't suddenly decide you want to develop in Unreal engine 4 and still use GDScript.
Visual scripting languages
In some game engines there exists another alternative, and that is visual scripting. Visual scripting can be very attractive to beginner game developers and programmers and are good for learning the absolute fundamentals. In general, I don’t recommend going this route as the logic is generally just as complex and hard to learn and has a tendency to become messy quickly. Why not just learn a programming language instead.
C and C++
C and more commonly C++ are the predominant languages for game development, especially in commercial games. The reason for this is that graphics take a lot of computing power and these languages give you the tools to utilize your computer's hardware to its fullest. It's for this reason that C++ is the go-to language for game engine development. Godot is built with C++, Unreal and Unity are built with C++, Panda3D and Blender are built with C++. The power of these languages do come with some caveats, you need to explicitly manage your computer's hardware and memory, this makes them far more complex and harder to learn than other alternatives.
If you are interested in working professionally as a game programmer for a commercial studio, C++ is the choice for you. Commercial studios more often than not create their own in house game engines as opposed to a pre-built alternative. Therefore they are more likely to hire people skilled in C++ and graphics engine development.
You may also want to choose this route if you are more interested in how games and game engines work at a lower level. If you are interested in the theory and application of graphics programming and want to really know how your computer works, C or C++ is the language for you. To get into low-level games and graphics programming you will want to look at libraries such as SDL2, and technologies such as OpenGL or Vulkan. If you want to develop in C but at a slightly higher level, RayLib is well worth checking out. Many games engines and frameworks are extensible with C++, or in the case of Unreal4, use C++ as their main scripting language.
If your interest is more inclined towards game logic, art and the other creative aspects of game development, you may want to use an easier language and pre-built engine.
C# has fast become many game developers go-to language to make games. As a strongly typed object-orientated language, C# is a great choice for structuring your game logic. It is offered as a scripting language in many engines including Unity, Godot and Stride3D. A number of frameworks such as MonoGame also exist for creating games at a lower level.
Many smaller games studios and indie developers utilise Unity as their game engine and C# as their programming language. If you want to learn a solid all-purpose language you cannot really go wrong. Next to Python C# is one of the easier to learn languages and abstracts away a lot of the complexity present in C++.
Java has been the most widely used programming language in application development for well over a decade. While not a standard choice for games development, it is no surprise that Java fans have a number of choices if they want to build games in this language. Some of these choices include LibGDX, LWJGL or jMonkeyEngine. If your interest is in creating games for Android mobile devices then Java is also a good choice. The ever-popular Minecraft is built in the Java programming language.
Python is often the language recommended to new programmers due to its easy to read and understand syntax. Pythons biggest weakness in game development is that it is not a very fast language. Although not impossible, It is not recommended to do intensive graphical work with Python. However, the good news is that many passionate Python developers have written libraries that interact with lower-level C and C++ libraries to make games development in Python possible. These options include Pygame, Pyglet and also full game development frameworks such as Panda3D which uses Python as its scripting language. So if you love Python, there is nothing stopping you from using it to develop your game.
Lua is a lightweight and efficient language that due to its ease of use and flexibility has been adopted as the scripting language of many game development libraries, frameworks and engines. If you want to develop your games in Lua, your options include Love2D an ever-popular 2d games engine or Irrlicht for 3D.
Hopefully, you have now gained a little insight into what each language can do for you and what challenges and benefits they may offer. The list presented here is by no means complete and there are many more languages and game engines for you to play and experiment with. Don't get caught up in what language is best for game development. Try them out and find the one that suits you and your game best.