Is the single best language for a career in game programming C++?

The title pretty much sums up the gist of my question. Basically, I am looking to get into video game programming. I asked ChatGPT and it, summed up, pointed me to C++ as the dominant language to learn.

So, what is your take on that? Thank you in advance! (Also be advised, I am basically a beginner at game design and programming, so “layman answers” are greatly appreciated!)

As you’re seeking an opinion, I moved your thread to In My Humble Opinion from Factual Questions.

C++ is certainly a language used in modern games, but I have no idea if it’s currently the dominant one.

One thing I’ll advise, though, is that learning how to program is much more important than learning any specific language. The basic principles of programming and software design are the same in any language, and any competent programmer should be able to quickly pick up whatever new language comes down the pike.

With the moderator stuff done.

C++ would be a good language to learn but 2 caveats: it is one of the tougher languages, so not the best first language and if your not getting a degree from a top school, you might be better off getting your foot in the door with a more niche language.

Python and Javascript are much simpler languages and popular for game design as examples.

C#, is also a very popular language for games apparently. Make sure your fairly familiar with SQL.

At least look at LUA, my understanding it is a rising language and less likely to be taught at school.

What Exit, retired business programmer, so no expert. Welcome to the Straight Dope and enjoy the board.

C++ would be a challenging language for a programming beginner to learn on their own. You might try learning an easier language like Python first. You might also look into making games in a gaming platform like Roblox. That will allow you to get experience writing games in an environment with tools designed to make it easy.

Also, this really isn’t a place where game programmers hang out. You’d probably get better advice on a forum for game programmers.

Sort of? Almost all the low-level development is done in C++. But nowadays most games studios will not do that low-level development themselves, they use game engines like Unity or Unreal, and making a game in those is not mainly done in C++. Unity uses C#, Unreal uses a custom scripting language (and some C++)

So unless you plan on being specifically a graphics or engine programmer its arguable how good that advice is. I’d say learning Unity or Unreal (or one of the open source game engines) is probably better advice.

Not to detract from the original post, but a couple of you have mentioned that C++ is a challenging first language. I basically know diddly squat about it, so in your own words can you please tell me why that is the case? (Please keep it layman friendly)

It is a tough learning curve compared to every other language I’ve seen. I programmed in about a dozen languages I guess. But I haven’t touched C++ in 30+ years now, so I don’t recall the details.

The only other one almost as hard was Assembler, which I assume is a mostly dead language now?

Disclosure, my first job was half COBOL, speaking of mostly dead languages.

One reason C++ is not suited for beginners is that it gives a lot of power and flexibility to the programmer, but that also means it’s very easy to create bugs in the code. If the coder isn’t experienced enough, it will be very easy to create bugs and very difficult to debug them. Even experienced programmers struggle with C++. For a beginner, it would likely be a frustrating experience with little gains.

For beginners the blocker is usually resources management (particularly memory, but also other resources).

In higher-level languages, you can create an object that uses some memory, and once you stop using it, something running in the background deletes it and reclaims the memory it was using. That “something running in the background” takes some resources to run, which makes your program less efficient, but it is “hard to screw up” which makes programming easier.

In C++ and similar languages, you can create objects that use some memory, but when you’re done with them you need to clean up the memory yourself. If you fail to do that, that memory never gets released and your program eventually runs out. Conversely if you release memory too early, you might end up with some other program wanting to use it after it is no longer available. The fact that there is nothing running in the background to clean up after you means your program can be more efficient, but it also means that there are more ways to make mistakes.

Be forewarned, it’s a difficult career path.

A lot of people want to get into game programming. It’s cool. It’s fun. With so many people trying to get into the business, companies can afford to over-work their employees and pay them basically slave wages. Don’t like it? Leave. They’ll easily find someone to replace you.

If working very long hours for very low pay appeals to you, then you need to start developing a game portfolio. C/C++ is a good language to learn, because it will teach you procedural programming (C) and object oriented programming (C++), and game engines can be built around either. Some use procedural scripting languages, some use more object oriented languages. Some use kind of a mix.

Unreal is a very popular game engine. It also has a very low cost of entry. It’s free. You can just download the Unreal Development Kit from Epic and have at it. You can even release games without paying Epic any royalties, up to a point. Once you get enough sales from your game, then the royalties kick in. But as a beginner you’re not likely to run into that any time soon.

Unreal’s AI system is… different. There’s nothing you can really learn that will help you with it. You just need to plod through it and figure it out.

Unity is another popular game engine. It also has a free version, though once you get to a certain income level they also start wanting a cut.

Whichever game engine you pick, you want to get to a point where if you get an interview, you can send them your portfolio of games and say “look, I made these.” Basically, if they like what you’ve done, they’ll hire you. If you don’t have anything decent to show them, they probably won’t hire you.

You will also want to learn how to create game assets, which involves things like 3d modeling, creating textures, and editing sounds. Blender is a free modeling too. Professional 3d modeling tools are ungodly expensive for a newbie with little to no income. GIMP is free for editing textures. Photoshop is more professional, but again, you have to pay out the wazoo for it. Audacity does wonders for editing audio and it’s free.

I probably wouldn’t invest too much into creating assets. Game companies will have artists to do that work, and that is more specialized. But as a programmer, you need to know how those assets are created and how to integrate them into your game engine of choice.

Good luck. Game programming is a tough business.

I program C++ every day.

C was written in the early 1970s. It literally came after the A and B programming languages. C evolved quite a bit over the years, and now has a lot of standard libraries which technically aren’t part of the language but are standard enough that you’ll need to learn them.

C++ was added later. It basically adds object oriented stuff to C, so it still has all of the procedural C stuff underneath it, but it’s an entirely different way of programming. Instead of being fairly close to the hardware as you are with C, you abstract things into objects and build
object behaviors and relationships between objects.

It’s difficult to learn because there is so much to it. It’s also fairly unforgiving. You need to manage a lot of things yourself, and if you don’t manage them properly, your program crashes.

For those who aren’t aware, the Unix operating system was written using the C language. Linux uses strictly C (no C++) in the kernel. C++ is used elsewhere in Linux though.

Mostly dead. There are still some weirdos out there programming in assembly (like me), but we’re getting hard to find. Most graduates from college these days don’t know assembly code at all. Electrical engineering graduates (who need C and assembly code for microcontrollers) are much more likely to know assembly than modern computer science graduates.

I’ll amplify what some of the other posters have said and say that you might want to learn Python first before C++.

Python has a few graphical & game frameworks that you could learn on, and it is a much more forgiving language than C++, where you have to worry a great deal about object lifetimes and ownership. Python handles those tasks for the programmer, and as they are common sources of errors, using Python would allow you to get a working game together much easier than in C++. Basically, Python would allow you to concentrate on the gameplay rather than the programming when you are just starting out.

Lua is used by many games as a scripting tool, allowing end users to automate certain tasks or augment game AIs. I’ve never learned it myself, but from what I understand you wouldn’t generally write an entire game in it. Still, it would be a good thing to learn if you are interested in game programming, and learning some and using it in your favorite game might give you some idea of how the internal structure of the game works.

Rust is becoming a popular language for programming close to the hardware level, such as in operating systems and the like, but it probably isn’t there yet as a language for game programming specifically. You might want to learn some of the concepts for how Rust makes managing memory and resources easier than in C and C++, with a look toward using the same techniques in those languages (though without the compiler assistance) and possibly using it in a future project (as it can interface with the other languages).

When my best friend started looking into game design, he wound up leaning towards Unity, which got him started learning C#, rather than C++.

That said, he also says that Microsoft’s documentation of the language totally sucks, especially for a beginner, and I can’t disagree.

I personally use Python and Panda3d to write games and programs for my own use, but this is strictly amateur stuff. I don’t know that I would recommend it as a jumping off point for a career in game programming.

Python is picky about things like indentation, so it forces you to make more readable code. On the other hand, it’s annoying when you’ve made an indent using tab instead of spaces and the compiler won’t accept them as being equal, leaving you a bit puzzled as to why your code isn’t working.

And for what it’s worth, Panda3d has been used to make commercial games, so it is capable of that. Python and Panda3d are free to download, so your cost for development tools is about as low as you can get. On the negative side, the example programs are rather simple and leave you with a lot to figure out on your own.

Personally, I enjoy programming in it, but I don’t know if I would recommend it. Like I said earlier, Unreal and Unity are much more popular, and familiarity with their tools is likely to get you further in your career.

But hey, it’s a lot of fun. And if that is what gets you into programming games, then go for it.

If you’re serious about getting into this industry (and I echo statements above about how difficult and unrewarding it is), I would say that learning game design — the basic process of creating an engaging and addictive game loop — is much more important than the specific language in which you’re programming.

Read the book Blood Sweat and Pixels by Jason Schreier. It’s a behind-the-scenes look at how ten different games were designed, developed, tested, and released. Aside from the constant theme that it’s a lot of unpleasant, grinding work, it’s also eye-opening about how even professional game designers are uncertain whether the games they’re creating are actually fun to play until remarkably late in the process.

Start with that, and then decide if you want to continue.

As well as the memory management aspects other people have discussed there is also the fact that C++ is a hugely bloated language, that is getting more bloated with every release. If you relied on the books I used to learn C++ thirty years ago, then you would be completely flummoxed by modern C++.

Writing assembler is completely dead, compilers just got too clever. There is never any situation, even the most specific isolated edge case where you have loads of knowledge about how the code is going to be used, where a human can write faster assembly code than a compiler. Compilers are just insanely good at producing efficient assembly code.

Reading assembly language is still an important skill if you are doing any kind of low level C/C++ programming you will at some point need to interpret the disassembly from some bit of code that doesn’t have source. That needs understanding of what the assembly means.

Possibly what ChatGPT was getting at is that learning the “C family” of languages is a good step. What I mean by that, is that modern gaming engines, like unreal engine are indeed built on something like C++ and mobile game development is typically in java, which is similar to C++ / C#

So that kind of syntax is what you will become comfortable with.

But it would be a big mistake to try to study C++ in the abstract. Because it’s one of the most bloated languages, and also includes a lot of memory-management stuff which, if it’s not completely out of date now, is probably not touched by the majority of developers.

I think best is to start with tutorials for a specific game engine; do you want to make phone games, console, or PC? Do you ultimately want to make small games that you have high ownership of, or be one of many working on a AAA game? The answers to these will inform which API and development environment to start learning.

And don’t be hesitant to use AI to help with drafting code IMO; I’m an oldskool developer myself who is used to doing everything the hard way, but times change. Going forwards, using AI effectively is as much a skill as other parts of development. Just be sure to look at – and tinker with – the bits the AI helped draft.

Finally, bear in mind that there are many roles in the games industry and you can be involved a lot in game development without any coding, or with just coding a little e.g. artists, game designers, level designers. Don’t get me wrong, most people in these roles at least do some scripting, but I’m just saying how much of a focus coding is varies a lot depending on specific roles.

Indeed it is. I have used C++ professionally for over 30 years, and I still occasionally run across new aspects of the language that I hadn’t known about when I read programs written in modern dialects. In fact, I would say that C++ is about the most difficult language to learn that I’m aware of, apart from jokes like INTERCAL.

Also, C++ has an elaborate “template” system, which is a second, compile-time, language embedded in the main language. To be fluent in template programming essentially requires learning a new language entirely unrelated to the non-template parts of C++. To me, as an programmer highly experienced in C, C++ and similar languages, it is a bizarre and difficult language: “variables” exist but are read-only and cannot be modified, iteration does not exist and recursion must be used in its place, etc.