Programming language to learn
April 2, 2010 9:21 AM   Subscribe

What programming language should I learn?

I learned java at university, which I'm almost finished with, but we have barely touched any other language and I would like to branch out.

I'm sure the immediate response to that question would be to ask me what I want to do. So:

I want a nice job. I'm not trying to be on the fast track to being a millionaire or anything. I just want a good job that pays the (not extravagant) bills.

I want to make games. They would most likely be open source, but it is possible I would put a game or two up for sale to see if I can collect a bit of pocket money. The type of game I'm most interested in is something rather like the turn-based RPGs Squaresoft used to make before they were making 3D games. Final Fantasy, for example. I doubt I would make anything 3D, but possibly isometric. I might also want to make a game people can play online, but probably not browser-based.

I have done a little bit of C++ but I didn't like it. Should I stick with it until I get used to it or try something else? In my very inexperienced opinion, I really like how Java forces (or at least encourages) good practices. A lot of the time when I was doing C++, I felt like I was forced to do things that I would have considered bad practice in Java. Especially, it didn't seem well geared to OOP.

This question has been asked here and here, but I'm asking again because I think the answer is specific to who is asking this question.
posted by giggleknickers to Computers & Internet (34 answers total) 15 users marked this as a favorite
 
I want to make games.

What platform?
posted by Brent Parker at 9:28 AM on April 2, 2010


YMMV depending upon platform:

Objective-C. Not the prettiest language, but if you want to make games, I heard of this new device that plays games running in Objective C, not browser based, with rich graphics in a tightly controlled environment. Bonus: instant marketplace.

This is the canon to start with.
posted by pmed at 9:31 AM on April 2, 2010


I want a nice job. I'm not trying to be on the fast track to being a millionaire or anything. I just want a good job that pays the (not extravagant) bills.

If you want a good job, learn a Microsoft .Net language, specifically C#. I'm not sure how useful it'll be for games, though.
posted by exhilaration at 9:34 AM on April 2, 2010 [1 favorite]


Objective-C is more Java-like than C++, but if you're looking for game programming, sort this list by language. Most are in C or C++. C and C++ do not force what you consider good practice on you. In fact, what's considered good Java practice may be considered BAD C or C++ practice. If you were more specific about your concerns I could be more specific in my response :)
posted by mkb at 9:35 AM on April 2, 2010


flash! flixel!

it's easy peasy and built for game-making.
posted by soma lkzx at 9:36 AM on April 2, 2010


Thanks for the answers so far. Looking into C# and Cocoa now.

What platform?
I want to make PC games. A nice bonus would be if they will run on multiple operating systems.

Not the prettiest language
I have to confess I do prefer a "pretty" language. I'm a big fan of clean, extendible, readable code.
posted by giggleknickers at 9:36 AM on April 2, 2010


And as far as a nice job goes, I have a pretty nice job writing Perl, C, and C++ (with very small amounts of Python and Java)
posted by mkb at 9:38 AM on April 2, 2010


For PC or console games you want C++.

Some good introductions to C++ practices:
C++ FAQ Lite
Effective C++
posted by equalpants at 9:40 AM on April 2, 2010


I'm not sure how useful it'll be for games, though.

I'm perfectly happy if the answer to my question is two languages. If someone wants to say "Learn x for games and learn y to make yourself a marketable employee," that's a-okay with me.

For PC or console games you want C++.
Could you please do me a favour and tell me why C++ is better for PC games than other languages?
posted by giggleknickers at 9:44 AM on April 2, 2010


The heavy lifting in pretty much all PC and console games is done by C++ code for performance reasons. C++ produces native compiled code, while C# and Java must be run through a virtual machine. I'd imagine that other game functionality, such as game logic and scripting, could be done with C#, though. C# means you'll be mostly restricted to Windows (and Xbox360), however.

Not only do you have to pick a language, you have to pick a graphics library to learn. Most games use Direct3D, which is Windows and Xbox-only, but some use OpenGL. The OpenGL number is increasing somewhat due to OpenGL's dominance on phones (it's what's used on the IPhone and Palm Pre, the only phones with decent 3D) and on the Mac. Valve just ported all of their first-party games to OpenGL so they'd run on the Mac.

If you want to write games that run on multiple operating systems, C++ with OpenGL is pretty much the only option.
posted by zsazsa at 9:49 AM on April 2, 2010


If you want to write games that run on multiple operating systems, C++ with OpenGL is pretty much the only option.

Is this the case even if I'm only making 2D games?
posted by giggleknickers at 9:53 AM on April 2, 2010


Also, is performance as much of an issue when I'm doing turn-based games?
posted by giggleknickers at 9:57 AM on April 2, 2010


If you're only making 2D games, C# would still limit you to Windows mostly. There's Mono, which lets you run C# on Mac and Linux, but it is always lagging behind in features. ObjC and Cocoa would limit you to the Mac and iPhone world. Java may actually be a decent option. It definitely does a good job of running on all major OSes.

I'd go out on a limb and suggest picking up Python. It's a wonderful language and is well-supported on all OSes. There's a game framework for it called pygame. As far as job marketability goes, Python is decent. It's used a lot on the web in frameworks such as Django.
posted by zsazsa at 10:02 AM on April 2, 2010


Could you please do me a favour and tell me why C++ is better for PC games than other languages?

What zsazsa said. The libraries you'll be needing are written in C++. Some have bindings for other languages, but those don't get as much use, so they're not maintained as well, etc. C++ is pretty much the lingua franca of PC games.

Now, if you want to stick to simple 2D ("casual", perhaps) games, you could go with C#, or other .NET languages, if you don't mind being limited to Windows. Java is a dead platform as far as PC or web games go, but I think it's still used on phones (maybe? I'm not really sure). Flash is the current way to go for the web (although if you're worried about C++ being ugly...).

On preview: for turn-based games C# and the like should be fine. (At least as far as graphics go, anyway--if your AI is doing some really intense computation, you might need something faster.) You'd still be limiting your choices with regards to existing libraries, but if you're going to roll everything yourself, it'll be fine.
posted by equalpants at 10:04 AM on April 2, 2010


Watch this talk:
The Next Mainstream Programming Languages: A Game Developer's Perspective
by Tim Sweeney, at POPL 2006.
then go to learn C++, LUA, CG/HLSL and Haskell.
posted by gmarceau at 10:07 AM on April 2, 2010 [1 favorite]


So am I understanding you correctly in that there is nothing actually special about C++ for game programming, but there are better tools out there for C++ game programming than there are for other languages?
posted by giggleknickers at 10:10 AM on April 2, 2010


A real pro will know a lot of languages and probably master only one or two. If gaming is your goal, C or C++ are natural choices as they have excellent performance and can, with a great deal of care, be portable. If employment is your goal, Java is actually a pretty good choice, as is Python or PHP.
posted by chairface at 10:13 AM on April 2, 2010


There is nothing really special about any general-purpose language for game programming, really.
posted by mkb at 10:20 AM on April 2, 2010


Ok, so you want to develop games, but you don't want to program in C++, which seems to be the de facto language to go to for desktop game development. For doing desktop development independently or in the industry (and ask yourself if you really want to get an industry job, the internet is full of horror stories such as EA Spouse) I think everyone is recommending C++ because many of the major engines have bindings to that language, the compilers are a mess but will still produce relatively fast code, and it's easiest to do cross platform development with.

That said, if you're just doing a 2D RPG, I think it's probably overkill. If you want to just release an open source game for your own amusement, the real question is what kind of programming do you like? If you like functional programming, the Clean language looks promising. Do you dig the properties pattern? Try Python, Lua, or JavaScript -- Steve Yegge of Google has an explanation of the method and how it relates to his game. All of these are multi-platform and have game bindings if you search around for them -- even if they're not as well supported than their C++ counterparts, they're all open source. Which means that you have some say in their development and can actually fix the bugs you may find.

All that said, I think you need to ask yourself why you're opposed to browser/portable device development. Objective-C is fast, has many of the features of modern languages with less bolts showing than C++, and most importantly seems to be the language of choice for iPhone development. The WebGL team has just ported Quake II to the browser, and the demo looks nice. You're not likely to find a lot of people to buy independent desktop games -- if they want a cheap gaming option on that platform, all they have to do is pick up a used game that was a hit a few years back.

Smart phones and devices like netbooks/iPads are a different story. The platform is new, people are willing to spend money, and there's not enough processing resources to justify huge teams working on them. If you want to go down this route, try HTML5/Canvas/WebGL. Android support is coming along nicely, and many developers for the iPhone and iPad already seem to be considering the switch. It's not as widely supported as Flash, but seems to be the way of the future.
posted by ayerarcturus at 10:22 AM on April 2, 2010


So am I understanding you correctly in that there is nothing actually special about C++ for game programming, but there are better tools out there for C++ game programming than there are for other languages?

Yes and no. The reasons are thus:
1. for maximum performance, you need to compile for the target hardware directly, as opposed to running in a virtual bytecode machine (.NET, Java)
2. C is well suited to very low-level development (and it mixes well with assembly); C++ inherits this ability
3. C has been used for operating systems (Windows, Unix), so using C makes it easy to deal with the OS as well; C++ inherits this ability
4. C++ has OOP and generics, giving it a large advantage over plain C for the portions of programs that aren't as obsessed with performance

So some of it is historical accident, and some of it is being well-suited to low-level stuff.
posted by equalpants at 10:27 AM on April 2, 2010


If you're going to do game things, you're eventually going to need to toggle bits to get performance and graphics just the way you want. So, here's my take:

1. Learn C. Plain old C. It's the grandfather of almost every other language that will beb useful to you here. Make sure you study its history and quirks. And, do all the examples, but *don't* try to write anything meaningful in it... yet.

2. Move on to C++. Same as step 1. While doing this, you might want to read Design Patterns by the "Gang of Four". (Note: I guarantee that there will be some mefites who chime in to scream down Design Patterns, and tell you to burn it if you own it. There is some justification for that point of view.) Start doing a little basic Object Oriented stuff in C++, but don't use any of the "clever" features, like multiple inheritance or overloading operators. You do want to know OOP basics.

3. The Really Hard Part. Try to learn Linear Algebra. It's a math discipline. It's hard. People take the course in college, and flunk out of it at a high rate. But, once you get that down, you'll know how to write a program (in whatever language) that makes a 3D polygon rotate on a screen. It's not a huge leap from there to physics models and polygon shading. (But, it is a lot of work. Game programmers don't get paid the big bucks just because they design cool characters. :) )

4. Start looking at the platform-specific languages for the platforms that you want to target. The list that mkb gave you above is a good resource for this. Then, go headlong into the language(s), including/especially best practices, and practice as much as you can.

5. Write a game! Amazing how by the time you get here, it ends up being "the easy part".
posted by Citrus at 10:28 AM on April 2, 2010 [2 favorites]


Thank you so much for all these responses. I'm learning so much with this thread. Just to be clear, I'm not interested in games to make money. I want to make games for my own pleasure. I would like other people to play them, but I will most likely be giving them away for free to achieve that. I absolutely do not want to work in the game industry, specifically because I have read about such things as the EA spouse article.

Try to learn Linear Algebra.
I actually already know linear algebra, because I took a course on it. If you'll excuse my bragging, I passed with flying colours. However, I haven't actually taken any course that taught me what to do with it, so I have no idea how to apply it in programming. I'm not interested in 3D, but might this be of any use to me anyway? I honestly have no idea what application linear algebra has.
posted by giggleknickers at 10:33 AM on April 2, 2010


Following up on Citrus:

0: Learn some assembly. Not nessesarily a lot, but do some non-trivial programs. Enough to understand what's really going on under the hood.

3.5: Once you have a firm handle on Linear Algebra (really, an excellent suggestion), get yourself some Knuth. Do the excercises.

6: Try out some languages outside of the procedural/OOP paradigm. Lisp definately, something functional like ML/F#/OCAML/Haskell. Maybe Prolog. You might find these match up better with RPG type game development.

P.S. - You went through a University CS program and only did Java? That's.........awful. They've done you no good turn. I think I did significant programming in at least 8 languages and was exposed to a bunch more in my program. Makes it a lot easier to weather the fickle changes of fashion in the industry (remember when Pascal-derrived languages were going to take over the world? Smalltalk was the next great thing?).
posted by kjs3 at 11:27 AM on April 2, 2010


You went through a University CS program and only did Java? That's.........awful.

I'm doing computer engineering, not CS and most of what we did was low level. We only had a few high level programming courses. That's part of why I want to expand my high level programming on my own. Making desktop apps is fun, and programming microcontrollers is boring. I would have done CS instead if I could go back in time.
posted by giggleknickers at 11:36 AM on April 2, 2010


You went through a University CS program and only did Java? That's.........awful.
Many CS programs teach mainly java these days. Mine (UCSD) did this, even though we did a token amount of C and C++. Sure, I had a programming languages course, but for virtually all projects, it was Java.
posted by beerbajay at 12:14 PM on April 2, 2010


Remember that procedural programming still exists! OOP is not the best answer for every computing problem, and can add a lot of unnecessary complexity in some cases.
posted by schmod at 12:23 PM on April 2, 2010


There's a reason that C++ is pretty much THE language of choice where performance matters. Yes, it takes more care with regards to garbage collection and pointers, but once you've got the fundamentals down, you can do anything with it.

Delphi with OpenGL comes in at second IMHO.

If you just want to play around, give GameMaker a try.
posted by hungrysquirrels at 2:12 PM on April 2, 2010


You went through a University CS program and only did Java? That's.........awful.

Even if you had been a CS major, you might easily have never needed to do anything in languages other than C/C++ and/or Java. (Good) University courses tend not to be "how to program in language X" but instead focused on some other topic; "operating systems" or "artificial intelligence" or what-have-you. Once you have a pretty good handle on any typical programming language of a given type, others are easy to pick. If you know, for example, Java, learning C/C++/Objective-C/C#/yadda yadda is relatively straightforward. Haskell might be a bit more of a stretch, but it's a functional language. Bananas and plantains.

In regard to your second question (the game related one has been sufficiently addressed, I think), it depends on the type of job you want to get. If you want to be a web developer, look into the popular web frameworks. I notice nobody has mentioned Ruby yet. If you want to work on 20-year-old financial software, you might try, I don't know, Cobol. Truly, I think "learn language X" is probably not the best way to "get job Y" -- focus instead on honing some other skills (learning a language isn't terribly impressive). Get some experience. You'll pick up a language or two along the way.
posted by axiom at 4:39 PM on April 2, 2010


If you want to earn shitloads of money in the financial sector, and be looked upon as an elite among most elite programmers, become an expert at APL. However, beware that there are not many positions left, so you'd need good networking abilities too.
posted by knz at 7:23 AM on April 3, 2010


Well, if you already know Java, I would recommend C#. The two languages are remarkably similar -- in fact, C# is basically just an improved version of Java. In addition, MS treats their developers well and gives them lots of nice tools. I really only have good things to say about .NET, and for a Java programmer, learning it would be an easy way to diversify your skillset.

For games programming, why not learn Flash/ActionScript? That seems to be what a lot of casual games are written in these days. Plus, I've heard there's a really good cross-compiler that will turn Flash code into native iPhone code.

C# also has a cross-compiler for the iPhone, called UNITY. I've heard good things about it, but I think it's still pretty new.
posted by Afroblanco at 10:30 AM on April 3, 2010


Java pays the bills for a lot of people but not really game creators. C++ is the language you should be moving into and Accelerated C++ is the book you should acquire since you already know Java.

Learning C# can also lead to a lot of opportunities but not so much in the gaming industry, excluding XNA (which is actually a good place to start as an independent gaming programmer.
posted by asharchist at 4:41 PM on April 3, 2010


Wonderful responses. Thank you, everyone! After considering all the answers here, I have decided to focus on C#. It seems to be good for the games I want to do, appears to have a lot of resources for learning it, and also makes me more marketable. I will probably also pile some python on top of that for scripting.
posted by giggleknickers at 6:28 PM on April 3, 2010


giggleknickers, I shot you a MeFi mail last week sometime but the envelope icon is pretty unobtrusive. I may have an opportunity for you to do game development on existing projects and platforms using Java. Mind taking a look? If you're not interested that's cool too, just wanted to make sure it didn't float on by in the electronic ether.

Cheers!

Glad you found the answers you were looking for BTW.
posted by vsync at 5:43 PM on April 13, 2010


Even if you had been a CS major, you might easily have never needed to do anything in languages other than C/C++ and/or Java.

Really? Every CS problem should be solved with a procedural/OO language?

If all you have is a hammer...

(Good) University courses tend not to be "how to program in language X" but instead focused on some other topic; "operating systems" or "artificial intelligence" or what-have-you.

But if that course in operating systems only covers Unix, and the AI class never mentions anything other than Prolog, well, then I would have problems calling it "good". Your mileage may vary.
posted by kjs3 at 6:57 PM on April 19, 2010


« Older Help Me Find This Mid-1990s Independent Movie!   |   Suppressing Emotions During Conversations Newer »
This thread is closed to new comments.