The "Being a Game Programming Newbie" Handbook
programming c++ game directx language windows want opengl choice
I will be honest with you: I am getting sick of your average newbie. "What books should I get?" "How long until I can make _______ (famous game name)?" "I want to make an RPG!" "Tell me how to make a game!" Well kids, those might be questions that you have, but don’t go up to a respected programmer and ask them any of the previous… Well, unless you feel like being laughed at and made fun of.
Basically, all of these people you see, making the "big games." Yeah well, those people didn’t get there by using "RPG Maker," or "Klik and Play." They put some serious work into learning a computer programming language (C, C++, Assembly, Visual Basic, etc…). Then when they had a language down pat, they put some more serious work into learning an application programming interface (more commonly known as an API) with two of the most famous being OpenGL and DirectX. So, if you are interested in doing some serious reading, learning, and listening, you too can be on the road to making the next "big game," but it's not easy. This article is not going to teach you how to program, but it will give you the right steps to becoming a good programmer.
There is no set "best language," though most of the industry either uses C, C++, or a mix of the two. Most people say that you should learn C before C++, though I tend to disagree. I learned C++ with no prior programming experience, except for some BASIC about 4 years before I started. I prefer C to C++ however, I like how easy it is, and how fast it is. Perfect for game programming. But whatever floats your boat will work. Here is some recommended reading for C++ readers in order of difficulty:
- The Waite Group’s C++ Primer Plus by Stephan Prata
- The Waite Group’s Object Oriented Programming in C++ by Robert LaFore
- Thinking in C++ by Bruce Eckel (this is more for programmers who want to convert from C to C++, it has some interesting coding tips for C++ coders too
- Effective C++ by Scott Meyers
- More Effective C++ by Scott Myers
- The C++ Programming Language by Bjarn Stroustrup (C++’s creator)
- C by Example by Greg Perry
- The C Programming Language by Brian Kernighan and Dennis Ritchie
Once you have read up, and practiced your language of choice for about 3-4+ months, I want you to try to program a complete text game. It can be any type of game. And you must implement the following features: structures/classes (for C/C++ respectively), file input/output, pointers, game logic, all original code, and if you are doing C++, you might want to practice some of the more complex class techniques such as Polymorphism, Inheritance, Abstract classes, virtual functions, etc…
Once you have created a game, and had no problems what-so-ever, you are ready to now move onto Windows programming.
Windows programming can seem a bit daunting at first, but trust me, once you read for a while, and are able to recognize all the functions, you will be fine. And, to keep consistent, here is some recommended reading for you. The choices are a wee bit thin, but these are great books:
- Tricks of the Windows Game Programming Gurus by Andrè LaMothe
- Windows Game Programming for Dummies by Andrè LaMothe
Once you have the basics of making a window down (hehehe… ), it's time to move on to Windows' Graphics Device Interface (GDI). The GDI is basically a really great "API" for business applications, or other apps that don’t require extreme speed, or sound at all. You should learn how to use it anyway though, because it gives you some insight on moving into the API of your choice. It is perfect practice, and also gets you used to graphics programming. For this "exercise" I would like to see you make a Pong, Tetris, or similar game of your choice. Have fun.
The Dark, Scary World of APIs
MWAHAHAHA! Okay sorry, I feel better now. This is where things start to get really fun. This is where one of the bigger choices comes down to. You basically have a choice of two major APIs. DirectX, which has 2D, 3D, Input, Sound, Music, and Internet Support) or OpenGL (which is absolutely perfect for 3D games. Quake was made in OpenGL, and if you haven’t heard of Quake, how on Earth did you find this article?). It isn’t really that much of an Earth-shattering decision. More of matter of preference. You will probably be learning some parts of DirectX no matter what though (another example of Microsoft’s strangle hold on the world), as OpenGL doesn’t have and Input, Sound, or Music support. And though OpenGL is made for 3D, it can also be used in 2D, though it’s 2D capabilities are not as great as DirectX’s DirectDraw for 2D.
I may sound pro DirectX up there, but DirectX also has its share of flaws. First of all, it is incredibly hard to learn, and master. I have read Tricks of the Windows Game Programming Gurus’s section about DirectDraw about 7-8 times, and I still don’t get it. In fact, as I type this I just printed out 37 pages of the DirectX SDK help file to learn from. The absolute best book on DirectX in my opinion is LaMothe’s TOTWGPG by far. It is also my game programming "bible" for many things, such as AI, and physics.
It's that time to say good-bye kiddos. By now, you should be a Window’s expert (can we say oxymoron?) and should be moving your way into DirectX or OpenGL. Feel free to mail me at any time. It can be about this article, future requests for articles, some progress you have made, a section of code you would like me to check out, venting about how your dog died… My address is ShiningKnight7@hotmail.com. I really don’t care what its about, I just love to hear from people!
And if you get anything from this article, anything at all: please, don’t ask dumb questions, expecting to get smart answers. Most questions aren't dumb, but if you want to hear some dumb ones, just re-read the opening paragraph in this article. Happy coding!