I’ve thought for a long time about writing an article on how to become a game programmer on your own. The problem is that everybody and their kid sister has written an article on this subject, and most of them are better than anything I could write.
But there is one thing I can do to help the budding game developer, and that’s point out which books he probably should be reading (and which ones he probably should avoid).
There are a couple steps on the path to becoming a game programmer. First, you have to pick your language. Your language is C++. There, wasn’t that easy?
Yeah, I’m being a little facetious. If you’re just writing games for yourself and don’t want to get an industry job or ever work on a team, you can write your games using whatever language, libraries and helper programs you want.
But if you want to become a professional, you’re going to have to learn C++. End of story. Oh sure, other languages might be helpful, but the vast majority of game development (both on PCs and on consoles) is done in C++. Why? Because it works, and more libraries have been written for it than any other language. There are free C++ compilers for almost every operating system on the planet. And there are more books on C++ than any other programming language.
Let’s talk about what to avoid. Avoid books that promise to teach you how to program a game in a short amount of time. What most of these books teach is how to use a scripting language or a gamemaker program to make games. This won’t be useful to you if you want to become a professional game developer. Specifically avoid the book 3D Game Programming All in One, as this book is basically just a tutorial for the Torque game engine and teaches you nothing about programming. Also take careful note of any book that promises to teach you DirectX; some of them actually use Visual Basic instead of C++, which makes them darn near useless.
So here’s what I suggest.
First, get a compiler. You cannot learn C++ without a compiler. If you’re on Windows, get Visual C++ Express and be done with it; there’s no sense in messing around with anything else. If you’re on another operating system you’ll probably end up with some version of GCC, which I don’t know much about, but it’s in widespread use so research shouldn’t be that hard.
Second, you need to learn basic C++ syntax. There are a lot of books on this subject. Tons and tons of them. Most of them are crap, but even a crappy book can suffice here if it does actually cover the basics. Now, back when I learned C++ I did it from a book that included a floppy disk with a copy of Borland’s Turbo C++ on it…that’s how long ago it was. So I’m not that familiar with the current crop of books, but the one I keep hearing about is Accelerated C++. You probably won’t go wrong with it (but this is the only book I will recommend that I haven’t actually read).
Once you’ve learned basic C++ and are familiar with your compiler, it’s time to get a more thorough overview of the language, and the best book for that is none other than Stroustrup’s The C++ Programming Language. Now, this book covers the entire language and most of the Standard Template Library and it’s not particularly difficult to read. But it should not be your first C++ book, because it isn’t a tutorial. I would recommend going straight through the book, reading each section and writing little programs in your compiler to demonstrate to yourself that you understand each concept – this is exactly how I learned C++ on my own. I would also recommend making double sure that you understand how classes work, how inheritance works, and how pointers work before you proceed to the next level. If you can’t tell me what a reference to a pointer is and why you would want to use one, you probably shouldn’t go on yet.
Now you know how to do pretty much everything in C++. But there’s more to learn, because there are a lot of things in C++ that you shouldn’t do even though you can. The next two books I would recommend are Meyers’ Effective C++ and McConnell’s Code Complete. Both of these are outstanding books that will make you a much better programmer practically overnight if you take the time to read and understand everything they say. Effective C++ will tell you about all the common traps C++ programmers fall into and explain how to avoid them. Code Complete is a bit higher level – it will teach you how to design your programs before you start coding so that your code doesn’t get so tangled you can’t deal with it any more. Code Complete is especially important if you plan to become part of a programming team.
Now, during the course of reading Effective C++ and Code Complete, you will probably encounter information that contradicts what you read in earlier books. In this case, these two books win.
Now you’re a hardcore C++ developer, but you still don’t know anything about game development. Therefore, your next book should be Llopis’ C++ For Game Programmers. This book is going to directly contradict things you’ve previously read; in this case, this book wins. You’ll be doing lots of stuff in game development that would make your average OOPmeister wince; that’s just the way game development is. Some of the content in the book will be stuff you already know. That’s okay, because the rest of it is pure gold. Pay special attention to the section on memory management; this is a vital concept that most game development books ignore because it can be quite difficult.
I’m also going to recommend that you read McShaffry’s Game Coding Complete at this point. Make sure you get the latest edition, which at the time of this writing is the fourth edition. This is the only book I’ve ever seen to cover how to design and write an overall game engine, as well as how to create a resource handling system. Again, these are both topics that most game development books ignore because of their difficulty. This book will also cover the basics of just about every aspect of game development, including graphics, sound, physics and networking.
If you’ve been reading and coding dilligently then you should now have a solid understanding of the basics of professional-level game development. Now there isn’t so much a progression as just a list of books I’d recommend.
The Graphics Gems series – if you’re doing 3D programming, and especially if you’re doing 3D programming on a platform that does not have hardware acceleration, then you must have at least the first book in this series. Yes, it is terribly expensive, but it’s worth it.
The Game Programming Gems series – this was an attempt to create a series like Graphics Gems, but for general game development. As they progressed the information presented became more specialized and less vital – but again, you should definitely own at least the first book.
If you are just starting out with Direct3D, then the book I’d recommend is Introduction to 3D Game Programming with DirectX 9.0 by Frank Luna. This book actually lives up to its name and will take you in baby steps from initializing Direct3D to particle systems, multitexturing, shadows, landscape rendering, picking, and pixel and vertex shaders. Make sure you get the first edition of this book, as the second edition will focus on DirectX 10 and will do everything with shaders. That’ll be interesting, but it won’t be a “for beginners” book like the first edition is.
Hope this helps!
The question is, is learning how to do everything with shaders that bad of a thing? There are many other things about the DirectX 10 API that make sense from a performance perspective, but could be very difficult for beginners to grasp. I think starting out coding shaders as a beginner would give you a better understanding of the graphics pipeline and 3D math. Another question is, as 3D graphics APIs get more complex what will beginners pick up to get familiar with 3D? Once DX11 is out and DX10 has wide adoption, for example.
And whatever you do, don’t forget to read Dan Marshall’s EXCELLENT tutorials over at http://www.gibbage.co.uk, right Viridian??
They explain the process in nice, slow easy-to-understand terms…
Now this I like. No tutorials, no step by step for dummies in 24 hours. Just a list of good books that you used yourself with a breif synopsis of what we can look towards getting out of it.
You’re right, the “how to be a game programmer” space is pretty full. But this is great.
Dan: Uh…right! Right! Those were some of the ones I meant when I said that many people had written far better articles on game development than I ever could. Really!
Delve: Thanks!
Impossible: I simply have no idea how 3D graphics are going to shake out post DX10. The whole point of DX10’s “everything is a shader” approach is supposed to be to make 3D graphics easier, not harder. It is entirely possible that it will have the effect of making 3D graphics easier for people who already know shaders, but making it harder for people with no 3D experience to understand the basic concepts. We’ll see.
Viridian: Yes I think you’re exactly right. There are some nice fixed function features that were previously “automatic” that now with DX10 you will have to implement yourself with shaders. I like the API a lot because it fixes many of the problems DX8DX9 had when it comes to performance, but I can imagine beginners being completely lost.
Hey Vir, this is an interesting post. I might have to follow it even. I’ve completed a few games I do some c programming, and i’m starting to learn c++ but I could sure use the help. I have already read (1st edition) of Code complete, it totally fouled me up 😉
I mean imagine just coding along to your self maybe you’re not that good, and you read Code Complete, then suddenly you’re writing accessors and trying hard to use pdl, and soon you don’t understand anything and your code’s a mess and you start second guessing all the code you write – that’s what happened to me.
On the plus side it is a very good book. But in combination with my bad coding habits trying to implement the stuff you just get all criss-crossed.
By the way I wouldn’t throw it out. But i’d definately read it through several more times and make sure i understood the material before trying to implement it again.
Keith
[…] In the wake of my article on getting started in game programming, I have been taking my own advice and doing some learning. In particular, I am getting more familiar with Direct3D. While I’ve known the basics for a while, I want to become a more advanced 3D programmer and I also need to learn vertex and pixel shaders. So I’m working my way through Frank Luna’s Introduction to 3D Game Programming with DirectX 9.0. I mentioned this book earlier, but I really can’t say enough about it. As far as I’m concerned, this is the book to get if you want to learn Direct3D. […]
Has anyone noticed the price on Game Coding Complete lately? Is this book made of gold?
Hey Vir, Just wanted to say thank you. As someone looking to learn this stuff and to poor for school, this gives me a new sense of hope. Cant wait to start!
[…] Always be expanding. And post all your stuff on the intertubes so I can try it out! Oh, and this is probably the post you were looking […]
I found this article. and even though I know the basics of xna I really wanted to start from scratch with c++ and go into game programming. So I decided to get “Accelerated C++” even though it was published in 2000 at least I hope it teaches the basics and I saw some other great reviews. I might order a few of the other book as well but seeing as this is a 1 and a half year old article maybe you could post an update to some of the newer books out? I know there are newer directx ones but are the c++ books still great?
Wow its actually 2 and a half years.