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
Printable View
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
It doesn't really matter.
C++ makes it easier in some cases. (In that logic, C# would possibly be even better(..used with XNA or something similar)).
but (though many would disagree)...There aren't good reasons to choose C if you are just wondering which to learn.
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
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).Quote:
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.
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"?!? :o) 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.
Long before you choose the language you need to think about your game and what it is you want it to do. I cannot make a suggestion relating to language until I know more about your game. Not all games are performance critical and not all games require super fancy engines.
So what type of game are you making?
Litarded is learning C# now apparently. I'm still using C because I find it a lot easier than any other language I've tried to learn. The reason I like C is because it's cross-platform and apparently fast.
We have a friend who is an amazing C programmer (he's making a Multiplayer RPG engine at the moment) and he's the one who convinced us to use C instead of any other language. He's developing a new library for it and everything. He also uses Linux, which would probably explain why he hates C# so much.
The problem is that I have no idea what my dream game would be. I've always envisioned a creative or God-like game like Civilization (obviously I won't be able to make something on that scale), Sims, or Minecraft (such a cliche). Creative games where you need to gain resources and create always fascinate me, but that doesn't necessarily mean that the game I end up developing will have those features. I don't like complex games, but rather games that are simple yet extremely enjoyable (thus indie games).
My programming background isn't large, but I know the game development industry quite well. I used to play around with stupid scripting engines that mimic C, so C came as easy for me. I'm learning Java at my high school right now (we are both 15), although I absolutely loath Java because of how slow it is. I want to avoid OOP because it's apparently slow, which puts C++ out of the picture.
I'm really stuck at the moment. I've heard that I should start with a simpler programming language before diving into C, but I don't want to learn a worthless language. I guess that I could wait til college to learn a better language, although I don't want to rely on a college to teach me; I'd rather be self-reliant. Since I'd rather be an Indie developer than work for EA (they have a few offices close to my house), I guess that C# would be better, but that still screws over the Mac and Linux users.
Thanks for the input so far!
-Brady
Well I decided to go with C# and XNA as Brady said above. I have had several people tell me several different reasons on why I should just do the language I want to do and use the correct tool.
C# and XNA is nice because games can be put on the Steam Platformer as some people said above, and then it can go to the Xbox game arcade. I actually started working on a small framework for a platformer for my game, and hope to develop it as I get time to work on it. It also is decently easy to learn and easy to make small games.
I didn't go with C because it's actually hard to make GUI applications and I don't see many tuts online.
I didn't go with C++ because it look's stupid. I don't even wanna attempt these languages until I go to college. Hope this thread helps anyone that needs deciding what language they should use to make a game in C/C++/C#.
Thanks
Aaron
Just to make it clear: XNA is the one that "screws over" Mac/Linux. C#, not so much - there are cross-platform implementations of C#, like Mono.Quote:
I guess that C# would be better, but that still screws over the Mac and Linux users.
There is a lot of bad info littered throughout this thread.
Eh?Quote:
I want to avoid OOP because it's apparently slow, which puts C++ out of the picture.
Again...eh?Quote:
Well I decided to go with C# and XNA as Brady said above.
So C++ is too slow b/c of its OOP so you decide to go with C#/XNA? That makes no sense whatsoever. I can assure you that C++ is not slow and I've coded demos using Direct3D in pure C++ that beat equivalent C# / XNA versions by a factor of 2 or 3. Trust me when I say that if C++ is good enough for 90% of the retail games industry it is certainly good enough for you.
Regardless of your choice you still have not explained adequately why you should even be choosing a language at this point when you have explained nothing about your game. I think you are way ahead of yourself and need to step back a bit. I wouldn't worry so much about the actual coding of the game as I would the design behind it. Poor design leads to poor code but good code almost never leads to good design. Moral of the story: coding is only about 5 to 10 percent of programming.
WTF? "It looks stupid"?
That would mean all other languages look stupid since pretty much all modern languages (OK, not all, but a lot) have their roots from C++.
What is it that looks so stupid?
This is pure nonsense. OOP isn't slow, and C++ isn't slow. What makes things slow is bad implementations.
C isn't usually used for games (game companies do not use C for games for a reason!).
It all depends on what you want to do, your requirements and what you like.
Exactly this. You cannot even measure the performance of the languages themselves. You can however compare language implementations against each other.
The blanket statement that Java is slow is wrong. Saying that Sun's (now Oracle's) Java implementation is slow is a valid statement. Which is debatable, but at least it is a valid opinion.
What?Quote:
You cannot even measure the performance of the languages themselves.
Who mentioned Java?Quote:
The blanket statement that Java is slow is wrong
I feel like I have stepped into the twilight zone in this thread.
You should read the next sentence for context.Quote:
Originally Posted by VirtualAce
BradyW mentioned Java in post #17:Quote:
Originally Posted by VirtualAce
Quote:
Originally Posted by BradyW
What I'm saying is.. Read the specification documents for C, C++ & C# and based on that information alone tell me which language has the highest performance.
It simply cannot be done, because the specifications has no mention of how many instructions/statements/whatever the languages should or will run at.
A good c# compiler will produce faster code than a bad c compiler. And the same is true for the opposite. But that's all implementation details.
So name a bad C compiler that will produce slower code than the equivalent C# compiler. We are comparing apples to oranges here.Quote:
A good c# compiler will produce faster code than a bad c compiler.
The main problem with this thread is that the OP appears to have a few misconceptions about C++ and/or about programming in general. Performance in the context of this thread is a moot point. My main question about what type of game is being made has not been answered. This leads me to believe that the people in question are selecting language A or B before understanding the requirements of the game. My guess is the requirements are not understood because the game itself has not been thought out. So I am back at my initial point which was a lot of decisions are being made without having any logic to back them up. I think we are compounding the problem by making statements about language A or B when the real problem here is simply a lack of forethought into the development of whatever this 'game' is.
Agreed, though until the OP answers that question, there is little else to discuss that will definitely be helpful to the OP.Quote:
Originally Posted by VirtualAce
Thanks guys, but just for the record, we are new to programming and heard all of this information from our friend. If he is wrong please inform us.
The reason we are choosing C# over C or C++ right now is because making GUI applications is easier. Considering that we are new programmers, we don't want to step into the hardest languages first. I actually found that C had an amazingly easy and basic way of doing console apps, but after looking at some stuff explaining how to do GUI apps it became complicated.
XNA looks like the best choice clearly right now. I would love it if some of you could challenge that and give us some more cross platform choices that are easy to use for beginners.
Thanks,
Brady
The most important thing to do is to learn how to program. Regardless of the language and library you choose to go with first, learning the fundamentals of programming are skillsets which are portable and will allow you to create games on any given platform. Pick a language, and just start learning. The C#/XNA combo provide many advantages of rapid development by hiding the implementation of the hardware interfaces and routine programming software implementations that are required for game programming. Additionally, the SDK provided with the XNA framework is very well documentated with many code snippets and full working games to refer to.
For begginners, the fact that you can write and test your games on XBOX360 is also a fun little thing that can help you stay motivated during your learning experience. If you really work at it you can have a small working game playable on the 360 within a couple of days.
Just get out there and start learning; most of the questions you have posed on this thread will be answered during your studies.
As some others said, you're probably rushing into this.
Making a good game is not just making a 'gui app' easily and the gui is often the least important part of the game.
Though I agree that it is a good idea to choose the 'easier' (and more enjoyable!) way now.
But I myself(when in your position) would first become familiar with programming enough to make an intelligent choice, not one as superficial as "It is easier to make gui s with" .
Btw.. Best of luck(and knowledge) on the way ahead. :D