So, you're fifteen, born and bred on video games and dreaming of building your own someday. What programming language should you learn right now, so you’re ready to strike in a few years?
Many game developers will tell you to learn C++, but this is just one of many possible answers. The best answer is ‘the best language for the platform you choose’ or ‘the language your game studio uses the most.'
While there are thousands of programming languages, game developers use only a handful of them.
Since C++ is a high-level language that will teach you the basics of object-oriented programming, it's a good idea to learn it. It is also the language used to build most big console and Windows games. C++ is complemented by C in these games, and assembly languages for creating low-level engine modules. Scripts like Python, Lua, UnrealScript, or some in-house scripts will thread through the code. Plus, shader code for graphics uses OpenGL, or a similar framework.
But for tackling big games in the larger gaming companies, knowing C++ is critical. It is fast, the compilers and optimizers are solid, and you get a lot of control over memory management. It has extensive libraries, which come in handy for designing and powering complex graphics. There's a lot of literature around for you to teach yourself, as it has been programmer’s language of choice for decades, and you'll find a helpful online community who are ready and willing to answer your queries.
C++ is by no means an easy language to learn. But it can be rewarding, not only because C++ games are easy to distribute across various platforms, but also because you can quickly learn C# and other object-oriented languages if you already know C++.
Both C++ and C# are widely used in popular game engines today, like Unreal, Sony's free PhyreEngine and the indie-favorite Unity Engine - and we all know game engines can take a lot of the grind out of game development.
PlayDead's title Inside is made using the Unity Engine, and it was easier to make than the game company's debut title Limbo, which was a hit on XBox. Limbo was made mostly with Visual Basic, and PlayDead had to create their game engine from scratch, which involved double the work.
You also need to remember that some game engines like Unreal will only take C++ (unless you want to use the engine's scripting language to script from scratch).
So, in a nutshell, learn C++ if you're serious about creating games from scratch. This language contributes to making gems like The Witcher 3 (which, by the way, also used Visual Basic as its IDE, to be able to run on Windows), Dark Souls and Elder Scrolls V: Skyrim.
The benefit of C# lies in its XNA framework. This is a set of tools and runtime environment by Microsoft, which makes it particularly suitable for games on the Xbox, or Windows platforms. But if you were to compare C# with C++, you'd realize that C++ gives you a lot of control over parameters, memory management, etc. This kind of control adds another dimension to the performance and user experience of your game.
C#, on the other hand, is like running a car on automatic. In a game engine like Unity, C# is the language that you code in, but the engine has C++ at its core. In a sense, you have to work within the framework, using the components that have been created for you. So, using a game engine can be limiting in a way, since all games on the engine will look and feel similar.
Game programmers also commonly use Java, because Java supports multithreading and sockets. Multithreading uses less memory and makes the most of available CPU, without blocking the user out when heavy processes are running in the background. Sockets help in building multiplayer games. Plus, Java runs on a virtual machine, so your game will be easier to distribute.
Java was used to make games like Angry Birds Chrome for mobile devices. It also powers the RPG Maker engine that indie companies have used to make RPG games like the Aveyond series, Barkley, and Eternal Eden.
4. Web Languages
If you see yourself making games for browsers, you'll need to know a couple of different codes to be able to offer a complete user experience. You could always specialize in one single language, but you'll probably need to know:
Making games for browsers is very different from making games for consoles. You'll also need to SVG or WebGL if you need 3D graphics, or complex graphics, and a content management system.
Flash animation using the programming language ActionScript has been common in the past for browser games, but the rumor is that Flash is dying, or dead. Google Chrome is already, in the words of many, beating it to death with a shovel.
What About Smaller Games and Mobile Game Development?
For many people, C++ can seem too daunting as an introduction to programming. Some people give up and settle for an easier language.
It's quite possible to make small games in simpler languages like Visual Basic. Small console games can be easily created using Java, VB or C#.
Another language you can start with is Objective C. It is an object-oriented language like C++, but it's easier to get your teeth into. You can see Objective C as a hybrid of Java and C, both of which are usually in the first-year curriculum of programming courses. Objective C is typically used for creating iOS games for the iPad and iPhone, though you may not like the syntax or punctuation.
Java is the best language for Android games. Some people code in C++, but then there’s the hassle of dealing with cross-device compatibility. As mentioned before, since Java runs on virtual machines, you don't have to jump through hoops to make your Java game compatible across different devices.
What About Games on Servers?
Some games need a server component. MMORPGs like World of Warcraft, Guild Wars 2, or Eve Online use Java, PHP, or C# to develop the backend. They make running games on servers faster, though there is a cost to performance, as opposed to using C or C++.
To put all this information in a nutshell, there is no single language you will need for game programming. Knowledge of C++ and Java are valuable assets. But you can get by with languages like C# and Visual Basic in developing some games. Every language has its unique shortcomings and advantages.
You could choose a language you're familiar, or comfortable with and stick with that. You must also think about the platform you want to make the game for. For instance, if online gaming is what interests you, C++ won't help.
Do check out the hundreds of gaming engines that make game development easier. You're bound to find something that fits in with your interests.
What language do you think you're likely to pick up for your first game? Let us know in the comments below.