Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am a 2D Game Programmer.Some programming languages which I am good at are C,Java ,C#. I also know Actionscript 2.0,3.0 and some javascript. I'm interested in learning 3D Game programming. So far from the research I have accumulated by googling and reading different game development forums and articles. I've noticed that most programmers tend to prefer C++.Also in an online game programming teaching course I noticed they prefer to teach C++ and Visual C++ as the starting course. The reason I am asking this question since I would like to know the "strength" difference of C++, C# and Java for 3d game programming.

Also include links to good 3d game programming articles for the already 2d game programmer.

P.S : IMHO , I also find C++ to be cryptic.

share|improve this question
    
I also get that a lot. So asked a question in the community as to what skills a professional game programmer should have. Got some nice answers focussing on C++ as better language for developing games. check.. gamedev.stackexchange.com/questions/5552/… –  GamDroid Nov 17 '10 at 10:16
    
@GamDroid: I am not interested in knowing what makes a professional 2d game programmer. I am interested in knowing about Visual C++ and why is it so talked about on. –  Vishnu Nov 17 '10 at 10:34
2  
Btw: Visual C++? Not just plain C++? –  speeder Nov 17 '10 at 12:59
    
The Visual C++ editor is cool, but the language Visual C++ (that is: C++ with Win32 GUI API and stuff like that, both with MS Visual C++ or Borland C++ Builder) is pretty confusing and should not be used for games (it is too bloated, and using GDI is slower than using say, SDL, to control the window) –  speeder Nov 17 '10 at 13:00
1  
@Vish, apologies then, feel free to edit it to be more precise keeping in mind the comments thus far. If you mean Win32 programming is confusing, then say that. –  Tetrad Dec 1 '10 at 6:03
show 7 more comments

3 Answers

up vote 27 down vote accepted

Yes, C++ is the language used most often (though some people do still use C).

There are numerous reasons for this. Sheer momentum is one - it's simply the language that has been used for years, a lot of tech already exists and people are comfortable with it, so changing is not going to happen overnight.

Then there is the issue of control. Game developers are control freaks, and we like to know everything that is going on in our code. C++ gives us that control, C# and Java (to pick on the two alternatives you mention) take control away. In many ways that might be a good thing, but game coders don't like it :)

Finally there's the simple practical issue that the SDKs for various platforms are very C++ centric. Using another language inevitably involves writing wrappers, cross-compiling down to VMs, and possibly (in the case of some console development) it's not allowed by the platform holder (they really don't like people doing JIT compiling, for a start).

share|improve this answer
2  
In the mainstream development industry, yes. –  JasonD Nov 17 '10 at 10:56
2  
In terms of languages, C++, primarily - it's not going anywhere any time soon. I'd suggest it also wouldn't hurt to be familiar with scripting languages - Lua, Python, etc. –  JasonD Nov 17 '10 at 11:05
8  
Visual C++ is not a language, it's an IDE. –  SurvivalMachine Nov 17 '10 at 11:43
2  
Yes, though it's probably the most used IDE, so it's worth getting to know that at the same time as learning C++. –  JasonD Nov 17 '10 at 11:52
1  
@SurvivalMachine Well technically it's a dialect (there are plenty of MSVC++ extensions that don't exist in the standard) –  bobobobo Nov 21 '12 at 20:02
show 3 more comments

C++ is still preferred as you can see on pretty much any publication on the topic of game development. I personally am currently using C for my diving into game development for the simple reason that the C++ code I write abuses templating features, uses RAII extensively, dynamic memory allocation and other things that you just should not do in game code from what I have seen so far.

Sticking to C forces me to be minimalistic and think about what I'm doing. It can be harder at times when you have to reimplement something the STL gives you for free, but on the upside I feel I write cleaner code and have a better time debugging that thing.

share|improve this answer
3  
RAII is perfectly acceptable(and should be encouraged) in game code. –  stonemetal Nov 18 '10 at 15:52
1  
@stonemetal: RAII encourages delayed and therefore unpredictable resource allocation. Whether that should be encouraged or not depends on the size of your game and your target platforms (and the resource in question); on average I would not encourage it. Furthermore, RAII in C++ is most commonly used with heap allocation, because C++'s OO makes stack allocation too hard. –  user744 Nov 19 '10 at 12:05
3  
In what way does RAII encourage delayed resource allocation? When I use GLFW I make a class called GLFWRAII that calls GLFW's init function in the constructor and calls GLFW's clean up routine in the destructor. I allocate it on the stack at the beginning of main, it in no way delays anything nor does anything unpredictable. Other uses might be to allocate at the beginning of a level and clean up at the end of a level. Poorly using a technique doesn't make it a poor technique. Nothing about RAII suggest unpredictable resource allocation other than poor use. –  stonemetal Nov 19 '10 at 14:38
    
You just have to avoid using those features. I use C++ and I never use templates in my code nor have objects throwing exceptions in their constructors. In C you can still use dynamic allocation (and you must for a 3D game). Besides, you should code in a way that also someone else find it easy to understand--a big project in pure C code can be a hell, even if you understand it. If you learn to think about what you're doing even if the language doesn't force you to, you will be able to write clean code in many other languages too. –  Pablo Ariel Sep 3 '11 at 19:49
add comment

I wouldn't specifically use Visual Studio unless I was willing to limit myself to targeting Windows, Windows Mobile or xbox. Visual Studio IDE is nice tho, one of the best I've used but maybe Eclipse with some extensions can do a comparable job.

One of the best things about C++ is flexibility, you can program either at low level or high level, and it's template engine. Most static languages' generics (like Java, C#, and others) are not capable of doing things C++ templates can.

Another thing is portability, good C++ code can be cross-compiled to most platforms, specially using GNU C++ which compiles for lots of different platforms. The drawback of this is that you need to build a specific binary for a specific platform.

But, for 3D game programming, C++'s strength is speed. There's no default graphics library. For most platforms you could use OpenGL which is pretty good and supported, except in those platforms from Microsoft like the xbox. Anyway, the concepts you'll use either in DirectX or OpenGL are basically the same, so you can learn to use the concepts and apply it in OpenGL and then port your knowledge to the DirectX way of doing things.

See this nice OpenGL tutorial from NeHe

Still, I don't get why you find C++ cryptic? It's almost the same base syntax as Java or C#. Are pointers your problem? Template syntax?

God bless

share|improve this answer
    
At least 10 years ago, the M$VC++6.0 Language was still buggy, and the .NET version after that had other bugs. It was not even full compatible to the standard. And the libs from M$ were (probably still are?) extremely catastrophic: You had to circumvent different bugs in the libs, depending on the VC++ version, and to convert between the slow O(n²) implementation of CString and the fast O(n) implementation of std::string, that you wanted to use. –  comonad Nov 18 '10 at 0:15
2  
well, somebody above pointed out that the "cryptic" part of the code i actually found in c++ was not really part of the language and that it was a required coding effort while programming in visual c++ ide with win32 api –  Vishnu Nov 18 '10 at 4:45
    
The VS part was meant as a side note about the original VS mention, sorry if I'm not up to date. But anyway the question is about: 1) why is C++ preferred and 2) 3D programming tutorial. Is my answer wrong on the question's actual topics? –  Trinidad Nov 18 '10 at 16:20
1  
"Visual Studio's C++ was just as fast as C# and GNU C++ was faster" really? Whenever I've tested the performance of C++ on MS vs GNU, i've always seen the MS binaries perform better. Admittedly, the non-release MS code runs slower, is that what you mean? If so, how is that relevant? –  Richard Fabian Nov 18 '10 at 16:53
1  
The 3D programming tutorial you linked is pretty bad. Also, C++ is pretty cryptic - anything with a standard pushing 900 pages is. –  user744 Nov 18 '10 at 19:10
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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