Hello. My name is Aaron and I want to start working on games.
The only problem I am on is what language to use when making my game. Should I use C or C++?
Thanks
Aaron
Hello. My name is Aaron and I want to start working on games.
The only problem I am on is what language to use when making my game. Should I use C or C++?
Thanks
Aaron
I know both for programming. Just not game programming with OpenGL.
I know C# using the XNA, but it's slow when making a game.
Yeah that's true.
But XNA itself is a slow library and should only be used for X-Box and W7 Phones. C is not as slow.
Thanks
Aaron
Last edited by Litarded; 08-28-2011 at 05:18 PM.
I'm learning with Litarded and I've always heard that C is much faster than C# since it doesn't contain unnecessary language constructs and isn't OOP.
Some constructs aren't unnecessary...especially for something as complex as Game Development (If they aren't there, you've to make it yourself...as is often the case in C).Originally Posted by Litarded
Then choose C++ as the middle ground. (It is .. arguably..as fast as C..only uses more memory..(but that isn't much nowadays)).
The real merit of C++ is the Standard Library.
Actually, I have several friends that have a W7 Phone and the phones aren't slow at all.
Thanks
Aaron
There's really nothing wrong with using C#/XNA to program games; the slight performance disadvantages over C/C++ with DirectX/OpenGL will generally not be a problem unless you're doing some really highly performance critical stuff, and if you're just starting out you wont need to worry about that yet. You will learn the fundamental concepts involved in games programming with XNA, and it is easier to do so over DirectX with C++, so it's certainly not a bad place to start.
If you're interested in releasing a game on Xbox, it's certainly easier to get the game on there using XNA and XBLIG, although Indie games are hit with some limitations (such as content size limitations of about 150-250MB, no achievements, and no Xbox LIVE leaderboards). Microsoft only really let experienced, renowned, and trusted development companies develop games for Xbox/XBLA using C++ libraries.
If you want to get a job in the games industry then C++ is definitely the way to go, but you can learn the specifics of C++/DirectX/OpenGL after learning the fundamentals of game programming with XNA. While some low level programmers will use Assembly or C for some performance improvements, the vast majority of work is done in C++. C++ is also the primary language supported by the PS3, which you may end up developing for if you become a professional developer.
I would not learn C at all and look at C++.
Trouble is that C# with the XNA framework does MOST of the background work for you, while C++ does nothing.
C++ has no garbage collection, no framework running a game timer, loading resources, drawing or init events etc.
Expect to spend a considerable amount of time (probably years) learning C++ before you can to code any game complex enough to notice the difference in speed between C++ and C# / XNA.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
If you buy any indie games in particular on Steam or equivalent digital download provider these days, you'll find that more and more are being developed with C#/XNA. The distribution sizes usually make me hurl somewhat (~500MB for a "retro platformer"?!? ) but for what they do they are quite fast on an average/modern PC.
The only time you're likely to notice creaking is when trying to do something with considerable 3D poke, "hyper realism" blah blah blah. Manipulating more than about 10,000 objects per frame. This is simply because of the amount of checking within the runtime that goes on with each function call, if you're doing this millions of times per frame then it adds up.
C++ has less of this, but conversely some things you have to develop a way of doing yourself. This isn't a bad thing really, as the one thing you'll learn is that a general case is a general case; you can make better for your particular application.
C++ runtimes also allow you to customize how much "help" you want. You can turn 99% of it off if you want, but don't think that the compiler will implicitly do a bad job; Only turn things off if you notice an improvement and nothing breaks.
C is about as simple as it gets. No help. You can do fun things like multiple inheritance but you will have to make ALL the handling yourself (and it's a lot of messy work, I've done it ).
As others have said, C++ is probably the best bet in terms of flexibility, but it's not easy to get to grips with. Why not learn C# and move on to C++ when you're ready?
I would go with C++. Check out SFML for graphics, sound, network and input. The combination of them both is really easy to learn, and once you learn it, it's really powerfull.