How To Learn Game Programming

Started by
16 comments, last by jpetrie 13 years, 9 months ago
*** Disclaimer: This thread was created as a redirect for a very common question asked here in gamedev. I do not claim to be an expert, but after going through it myself and seeing the same replies over and over I decided to bump it all into one thread. Any suggestions for this are welcome. ***

How to learn game programming



Realism
First of all stop. You are not going to make that huge mmo you are thinking about, you will not be working on that killer FPS you had in mind, that procedurally generated RTS? Forget about it. For a few years at least. To begin with you are not going to be very good so you have to start small.

Which Language?
This is one of the biggest questions we get asked here at gamedev and the answer is it doesn't matter. Yes more large companies code in C++ but this irrelevant to you as they aren't going to hire you without at least a few years experience. Once you get good at a language switching between them is not as big a deal as you might think when starting out. I personally recommend either C# or Phython just for the fact that they are simpler to use then some other languages and still very powerful.

OpenGL or DirectX?
Neither. Newbies put a lot of weight into this question and its not a very important one really. Graphic programming is only a small part of game programming and a pretty boring part at that. To begin with you should be using a library that does it all for you, that way you can learn all about the real code of game programming before worrying about the nitty gritty stuff.

I recommend SDL, SFML, Irrlicht or any of the simple libraries that will handle the rendering for you (those also do input and window management which is one less headache when learning). Once you have made a few simple games you can learn either GL or DX, but remember that most game programmer would be able to use both depending on that the requirements for the game are.

Where do I start then?
Pong. Seriously. This game will teach you about lives, physics, collision, AI, game loop, scoring, leveling and much more.

Next make tetris. This will teach you much the same as above but with more advanced collision detection and smarter game logic for the score counting and block removal.

Now make PacMan to learn more about AI. Nuff said.

Now make a platformer (mario clone) to learn an abundance of new things. If you feel up to the challenge use a physics library and particle effects.

*** Side Note ***
Do all of your games have sound? Menus? Help screens? Pause? Scoring? Can you change controls? Save? Add all of this to your game to make it really complete.

Conclusion
Once you have done all of this you are well on your path to a career in game development. You will now be at a level where you know what benefits you will gain to learning a graphical AI (or you might have sense to stay away from them and use a decent engine instead). Either way, you will now have all of the core knowledge you will need to become a game programmer and if you are still having fun then you know that this is the career path for you.

Happy coding.
Advertisement
URLs:
Python (http://www.python.org/)

Visual Studio ([C#, C++, F#, VB] http://www.microsoft.com/express/Windows/)

Monodevelop ([C#] http://monodevelop.com/)

Code::Blocks ([C++] http://www.codeblocks.org/)

NetBeans ([Java, but you could get plugins for other languages] http://netbeans.org/)

Eclipse ([Java, but you could get plugins for other languages] http://www.eclipse.org/)
As above - good advice.

Rules to learn game programming:

1. Write a game (in ANY language/SDK/Library or engine
2. Goto 1.
The language actually has a huge impact. Some have better documentation or easier syntax. Sure, switching might be easy ONCE you know a language, but if you choose a language with it-blocks, closures, and other fun garbage as your first language (features that are pretty new), you might have a hard time because of poor documentation. I spent a lot of time going on and finding these underground languages and found some that were really appealing. The poor documentation is what really gets you. Luckily, Sun and Microsoft have some of the best documentation and there are a lot of books regarding the programming languages these giants use and develop.
C++: Where your friends have access to your private members
I would add XNA if you are going the C# route.

If you are really new and going the C++ route, go with SFML(Their documentation is the most newb friendly. It even covers linking libraries etc.)
I'm liking what I've seen so far in this topic. Will this become a sticky or something?
Looks good but I think that jumping into a Tetris clone right after writing a Pong clone is a little tough. I had a really hard time getting my head around Tetris. Perhaps a space shooter can help bridge the gap.
Quote:Original post by X Abstract X
Looks good but I think that jumping into a Tetris clone right after writing a Pong clone is a little tough. I had a really hard time getting my head around Tetris. Perhaps a space shooter can help bridge the gap.


I agree that its harder, but the only real difference is the advanced collision detection. You have to worry about awkward angles rather then just radius vs radius, which is a good thing leading into pacman (where you have to deal with map based collision).

Quote:I agree that its harder, but the only real difference is the advanced collision detection. You have to worry about awkward angles rather then just radius vs radius, which is a good thing leading into pacman (where you have to deal with map based collision).
I don't know that Tetris is difficult because of the collision detection. How are there awkward angles? For Tetris, collision detection will typically reduce to some fairly simple array checks.

The tricky part about Tetris (IMO) is figuring out the logic to constrain the pieces (e.g. prevent rotation or linear motion) when they should be constrained, and handling other details such as adding pieces to the board at the appropriate time, dealing with timing issues, and so forth. Granted, it's not that complex overall, but it's a fair step up from Pong complexity-wise.

Trying to 'rank' these various games by complexity is probably somewhat arbitrary and pointless, but (based on my own experience at least) I'd tend to agree that something like, say, Space Invaders might be easier to put together than Tetris (even though, on the surface at least, the former might seem more complicated than the latter).
Yup, I wouldn't call that thing in tetris "collision detection". And after all, it's not so hard to constrain the pieces: there's a very simple and universal solution to it: first transform the piece "virtually". If it collides, don't apply the transformation, if it doesn't: apply the transformation.

This topic is closed to new replies.

Advertisement