I've decided what I really want is to do game programming. So the question is, as a 18 years old who wants to learn self taught programming, what is the most suited programming language between C# and C++? (I should state that I don't care about Unix because I believe windows will be still the most used OS)

I know the basics of C++, but none about C#. I know that C++ has more tutorials guides, dlls and stuff like that, while C# doesn't, but it's far easier to learn and to use for a single person to develop a program, but I've read even if the program is obfuscated it's easy to get the source of it.

Well, I kinda want to focus on basic a lot first, I must say that I have a preference for C++ just because it feels more suitable to me, but I must consider that I work alone. So even if I like it, it may not be the best thing to do.

I am really not sure of which one to go for, I've read a lot of threads on various websites and it looks like C# is becoming more popular than C++. But yeah, that said, I also specified I want to do game programming. So I need to know some better points than just "C# is easier because of .net memory handling while C++ isn't" because I couldn't just find it.

closed as not constructive by Thomas Owens Feb 22 '13 at 10:49

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

locked by World Engineer Oct 16 '13 at 23:41

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. See the help center for guidance on writing a good question.

Read more about locked posts here.


I learn C++ by programming a game. That was a very enjoyable experience. I highly encourage you to do the same!

However now I'm a C# programmer, I know I would have been a lot more productive if C# was available at the time.

C# is the perfect choice for learning game development. It has everything you need to start from frameworks to books and the language is amazing.

I've seen dozens of books specifically wrote on C# Game Programming and Microsoft is putting lot of efforts to improve his frameworks including DirectX and XNA.

UPDATE: you may be interested by this as well. It's a recent blog post from Miguel de Icaza.

UPDATE 2013-02-22 Microsoft is planing to cease XNA support.

  • 1
    So maybe I should start getting around SDL or something like that with C++ then move on to C# in future.. it just looks like C++ is kinda getting replaced by C# except for the engine creation.. Why is it so hard to make a choice! – Chronix Mar 5 '11 at 18:01
  • 2
    Understand that C# is excellent for experiencing game developpement, not for portability on some gaming platform or other concerns. The best case scenario is when you know enough game dev using both and you choose C++ or C# depending on the target platform. – Klaim Mar 8 '11 at 12:55
  • Other than that, +1 obviously. I personnally still prefer C++ but that's only because most of my project require some lowlevel access for some project-specific reasons. – Klaim Mar 8 '11 at 12:56

Most game companies use C++, maybe with python scripts or other languages running in the background. Moreso because the bindings for OpenGL and DirectX are aimed at C++ (altho Im pretty sure you can do just as much Direct3d stuff in C#) but ya for game programming, C++ is the MAIN language.

Im going to give you a fair warning though (and don't let this deter you) but 3D graphics can get extremely complicated. The new Direct3D has made it a good bit easier than it used to be, but It still is a good bit of math (that can get pretty confusing) and just the libraries themselves can be confusing.

I'd start with something very simple first. for 2d stuff SDL (Simple Directmedia Layer) is alot easier to use (for something like a top down game) once you get into 3D I PERSONALLY think OpenGL is easier to learn (but this is all opinion). MS has some nice Tutorials/Samples in their DirectX SDK documentation, so it's worth taking a look at. The Nehe tutorials although a bit outdated are still nice.

but ya to answer your question, they are all done in C++ typically.

  • 1
    SlimDX provides a DirectX wrapper for .NET – Danny Varod Mar 7 '11 at 12:34
  • 1
    "for game programming, C++ is the MAIN language." I'd disagree with that statement. The games market is a lot broader than just AAA console games - that's a much smaller segment of the market than people tend to realise. I'd say far more games are written in languages like ActionScript than C++ – MattDavey Sep 11 '12 at 16:27

First you'll want to set some priorities. Do you just want to make a game first then learn about the more advanced aspects of programming later, or vice versa. Both approaches have their pros and cons, but are both legitimate in my opinion.

If you want to start making games then I would recommend learning C#. If you already know the basics of C++ then you should have no trouble at all picking up C#. Making C# your tool has advantages. It's an easy to learn to language (compared to C++) and is a "managed language", which means that it automatically does the memory plumbing for you (something a lot of C++ beginners, and even not-so-beginners, have trouble with). It also gives you access to Microsoft's XNA Framework that does even more of the tedious plumbing for you. That leaves you to concentrate on things like the game cycle and design, without having to worry (too much) about getting it to work. True, all this insta-plumbing has its overhead, which means you probably won't be making industry grade 3D games, but you are just getting into game programming, so I doubt you'll be making the next Halo on your few first tries. :)

Here's a post mortem by the guy who developed a successful XNA game (Weapon of Choice). He details how using C#/XNA has saved him development time as opposed to having to use C++. http://www.gamasutra.com/view/feature/3899/postmortem_mommys_best_games_.php

That being said, you should invest some time into at least knowing how things work in the background. How a C++ programmer would do it. Learning to make a game in C++ might make it easier to join another game development team (as most of them work in C++), if what you want is to gain footing in the gaming industry. But even if you end up never using C++, knowing how the internals work can only make you a better programmer, no matter what language you use.

  • I agree completely. The memory management issues facing you with c++ are the biggest problem. There hasn't been a game I've worked on that hasn't had memory issues, and I've heard the same thing said by 20 year veterans who have made dozens of games. Even RAII and smart pointers doesn't solve the problem, as you get problems with pointers pointing to old data and issues with ownership. Learning how to find and fix them will make you a much better programmer, but it could have you stumped for months the first time you have a buffer overrun and the game crash in a unrelated part. – Dominique McDonnell Mar 7 '11 at 13:17
  • I would like to add to this question that C# also has XNA (en.wikipedia.org/wiki/Microsoft_XNA) to its advantage. XNA is much easier to pick up than unmanaged DirectX. – Vitor Py Mar 8 '11 at 20:28
  • 1
    @DominicMcDonnell: You can have memory problems by keeping references to stuff hidden somewhere in managed runtimes like C# too and when it hits, you are going to have much harder time hunting it down because you won't be used to thinking about resource lifetimes. – Jan Hudec Feb 22 '13 at 11:00
  • @JanHudec, I didn't know that. I suppose you could say that getting things working is simpler and easier, but the got-yas are much harder to track down and in some ways the habits that the language allows you to build get in the way. – Dominique McDonnell Feb 23 '13 at 10:51

I highly promote C++ for game development. There are a few extra obstacles, with various pros and cons, one of the best reasons is portability.

With C# you can develop for quite a bit more these days, and there are some amazingly great engines out there programmed in it for sure. Both of these are good languages for game programming, if you are targeting only Windows/Xbox platforms then you will especially have reason to lean toward C#.

The language I most think you should learn would be OpenCL or CUDA, some GPGPU language. Personally I prefer OpenCL as it seems likely to outlast and grow further, it is basically just C style. There's OpenTK which is a nice wrapper for either C++ or C#.

I've always wondered what Ruby game programming would be like with hardware acceleration...


Raw game programming is going to leave you pretty cold. Working with low-level graphics calls in either C# or C++ is a minor nightmare and you really don't want to rebuild the wheel of rendering 2D sprites let alone 3D models. Since you're on your own and wanting to learn programming, your best bet is to find a framework that can put you forward a bit.

Since you have some familiarity with C-based language, my suggestion would be to give Unity 3D a look. Not only is it experiencing some serious uptake in adoptation from commercial game dev shops, and has some interesting platform options (including PC, android, iPhone and web runtimes), but it also has a free version that's very easy to use and lots of tutorials to show you how to move from concept to implementation. Best of all (IMO) one of the supported scripting languages is C#.


I made a game for a class two years ago (I was 18 too at the time) and we made it in C#. While I observe that large C# programs usually operate slower than large C++ programs, C# also requires much less work on your end. Memory management is done automatically, and for the scope of a first game, it's plenty fast enough. (Our game is a full-fledged 2D multiplayer Starcraft-like RTS.)

I'd root for C# as it should be easier to manage. However, if you want to become a professional game developer, just remember that it works only on Microsoft platforms. (Still, C# can be a good stepping stone to C++, and if I had to relearn the two languages, I'd try to learn C# first.)

  • C# does run on Mono (cross platform) too, however parts of the framework (e.g. WPF) are not supported. – Danny Varod Mar 7 '11 at 12:33
  • 1
    @Danny Varod, I don't really like to recommend Mono for cross-platform games development because up to now they've always been a little late over Microsoft in terms of features, and I don't expect it to change. Also, a major plus of developing with C# for Microsoft platforms is XNA, and until Mono also provides DirectX, it's not gonna work on non-MS platforms. – zneak Mar 7 '11 at 13:58
  • 1
    Mono will have to provide a compatible OpenGL wrapper, since, as you stated DirectX is Microsoft's. My point was only that C# can be partially ported. – Danny Varod Mar 7 '11 at 16:15
  • 2
    Between Unity, monogame(opensource XNA for mono), and OpenTK there are plenty of good game libraries for mono. – stonemetal Sep 11 '12 at 15:46

I would vote C++ - primarily because it can be cross-platform (depending on how you write your code, of course) and also because I think it gives you more knowledge about memory management - because you need to care about it. But since you don't care about linux/unix, if you want to leave the memory complexity out for the moment, why not focus in C# right now and then learn C++ too?

  • Thanks for answering your first question on Stack Exchange Programmers. – DeveloperDon Sep 30 '12 at 6:28
  • C++ is still the most portable language to this day. Especially mobile platforms some have Java, some have C#, but most don't have both. But all have to have C++; the virtual machines need to be implemented in something that compiles to native machine code and that something is currently always C++. – Jan Hudec Feb 22 '13 at 10:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.