Jump to content

Game Programming Beginners Guide

programming language c++ books going learning learn resources
A must read for anyone just getting started in game programming. Answers many common questions.

4: Adsense

I often get asked how someone with little or no programming experience can get started in game development. Up until now, I have always tried to help them along as much as I can on a one-to-one basis. However, because the number of questions has grown to an almost unmanageable level lately, I decided it is time for me to put all my advice in an article to serve as a general resource.

This article is intended for people who want to make their own games, but who have little or no programming experience. In fact, I'm going to assume the reader has no programming knowledge at all. I will focus mainly on the programming and design aspects of game development, and not the artistic side. I am not going to cover actually getting into the industry (because there are already ample resources for that) but I will walk you through the things you need to do to get to the point that you can make your own games. Finally, the path I lay out here should not be looked at as the only – or even the best – route to learning how to make games, but it has worked well for me and for other people.

Choosing a Language

The first thing you will need to do is to choose a language to program in. You have a lot of choices, including Basic, Pascal, C, C++, Java, etc., and there is a great deal of debate over which language is best for beginners. For a discussion of a number of popular languages, see John Hattan's excellent article, What Language Do I Use?

I'm going to recommend starting with C and C++. Some people will say that those languages are too advanced for beginners, but because I started with C++ myself, I tend to disagree. In addition, C/C++ is the most widely used language today, so you will be able to find a wealth of resources and help. It does not really matter whether you learn C or C++ first, because once you learn one, learning the other will be a trivial matter. However, if you choose to learn C++ first, make sure you understand and can use procedural programming before learning object-oriented programming (i.e. hold off on learning about classes until you can program well without them).

If you start with C/C++ and it turns out to be too difficult, there is nothing wrong with going back and learning a simpler language, such as Basic or Pascal. But I really think that if you stick with it and find the right resources, you should have no problem with C/C++.

Your next question should be, "How do I learn C/C++?" I'm glad you asked. The best way is to take a class. Having an instructor and TAs available to answer questions and help you along makes a huge difference, and the programming assignments will ensure that you actually apply what you are learning.

If taking a class is not an option for you, the next best thing is to get some good books. Don't stress too much about picking the "perfect book", because you are probably going to buy several eventually. I'd suggest going to a local bookstore and spending some time browsing the introductory C and C++ books until you find one that you understand and think you can learn from. In time, you will want to pick up some more advanced books, and probably a reference, but once you have some knowledge of the language, you will have a better idea of what you need. See our books section for some suggestions.

At this point, I want to take a moment and address something that I have seen as a concern for a lot of beginning programmers, especially younger ones: not having money to buy books and other things. First, there are free resources available, including your local library, and Macmillan Computer Publishing, which has hundreds of programming books online at http://www.mcp.com/personal. But second, if you really want to become a good programmer, you have to plan on making an investment in it. Use whatever (legal ;<) means you have to come up with some cash.

There are also a number of tutorials available on the web for learning C and C++, but I have found that tutorials are better for supplementing what you learn in books than for being a stand-alone resource.

Picking the Right Compiler

The programs you write, or source code, is stored as a text file, and you can even use Notepad to write a C/C++ program. But something needs to take that source code and convert it into an executable file. In the case of C and C++, that something is a compiler.

There are a large number of compilers available, including many free ones. It is important to choose a compiler that you are comfortable with, and the free ones have the advantage that you can try them all out and see which one you like best. However, free compilers are often not as full-featured or well-supported as commercial ones. Fortunately, most commercial compilers come in introductory or academic versions, which cost much less and usually have the same features as the full version, with the only restriction being that you cannot distribute programs you create using it (which you are not going to be doing for a while anyway).

Ultimately, the compiler you choose will depend on how much you can spend and which operating system and platform you will be developing for. If you are going to be developing for Windows, I strongly suggest using Microsoft Visual C++. It has a powerful development environment that will make a lot of things easier for you, and there is no question that no other compiler is more well-suited to developing Windows applications. If you are a student, you can obtain a copy for a significantly reduced price. If you are going to program in DOS, your best bet is probably DJGPP, which is free.

Choosing a Target Platform

Although you will probably develop for a number of platforms eventually, you are going to need to pick one to learn in. While you are learning the language, and before you get into any programming involving graphics, you will probably want to use a non-GUI operating system, such as DOS or UNIX. These will avoid the overhead involved with, for example, Windows programming, and let you just focus on learning the language.

Once you are ready to start making games, though, you should consider changing your target platform. Let's look at the more prominent options.

Windows: If you want to eventually work professionally in the games industry, or if you just want a lot of people to be able to play your game, then this is the platform you want to choose. The majority of your target audience uses Windows, and I don't see that changing any time soon. The vast majority of games today are made for Windows using a technology you have probably heard of called DirectX. DirectX is a library that allows you to access the hardware directly, which means you can write high-performance games.

DOS: DOS used to be the dominant platform for games, but those days are gone. Although some hobbyists are still making games for DOS, no commercial games are being made for DOS, and it will continue to decline as Microsoft stops supporting it. If you are just starting to make games, don't choose DOS, or if you do, don't stay with it for long. Note: because there are a large number of game programming books written specifically for DOS, there may be some justification to developing games in DOS while learning from these books. However, as the number of books for game programming in Windows grows, this argument becomes less and less valid.

Linux: Linux is a UNIX variant that has become popular lately for a number of reasons, including stability, price, and anti-Microsoft sentiment. Although the number of Linux users is still relatively small, the enthusiasm surrounding it and the potential growth of the market make it an viable choice as a target platform.

Macintosh: The Mac has a very loyal following in numbers that are not insignificant, and nearly every Mac enthusiast I have talked to has expressed a desire for more and better games for the Macintosh. I have not seen as many resources for making games for the Mac, but I am sure they are out there, so this may be a valid option too.

Consoles: The console (i.e. Playstation, N64, Dreamcast, etc.) game market is huge, and there is certainly a future in console game development. However, developing console games in a non-commercial setting is not really plausible at this time, for a number of reasons. If you develop for consoles, it will probably be while employed by a commercial game studio.

On to the Good Stuff

Now it's time to discuss actually making games. For simplicity, I'm going to assume that you have chosen to program in C/C++ for Windows, although most of what I say will apply if you chose otherwise.

First of all, before you even think about starting to make games, you should have a good command of C and C++. You should understand pointers, arrays, structures, functions, and probably classes, and you should be proficient in using them. If so, you are ready to start making games.

This article can't possibly teach you everything you need to know about making games. Fortunately, it doesn't have to. There are many books on the subject, and hundreds of tutorials on the web. GameDev.net should have everything you need right here. Here's how I suggest you start:
  • Get one or more books. For beginning game programmers in Windows, Tricks of the Windows Game Programming Gurus is the perfect place to start. Besides that, there are a number of other good books in our Books section. Read through the books, trying all the examples, and rereading parts you don't understand.
  • Supplement what you read with online tutorials. Besides clarifying things you read, they also cover topics not covered in books.
  • Ask the experts for help. If you cannot find answers to your questions in books or tutorials, take advantage of our message board and chat room. There are a lot of people out there willing to help out.
This should not be looked at as a sequential process, but as a silmultaneous process that is repeated continually.

It is not enough to just learn, though, you must apply what you learn. Start off with a simple game, and work up from there. See Geoff Howland's article, How do I Make Games? A Path to Game Development.

At first, plan on working on your own. Don't rush to join a team, because it will only slow down the learning process. Once you have several games under your belt, you can make a much larger contribution to a team anyway.

One thing I'd like to mention about books: You will need to read more than just game programming books. To be able to create the kinds of games you see on store shelves, you are going to have to delve into topics more advanced than those covered in most game programming books. Some of what you need can be found in tutorials, but you are also going to need to pick up some books on graphics, artificial intelligence, networking, physics, and so on. This is where pursuing a degree in Computer Science comes in handy, because you will be required to take classes that you may think don't apply to game programming, but they do.

Wrapping Up

Here's a few more tips that can make a huge difference:
  • Don't just accumulate knowledge, apply it. You will never really know or understand something until you use it. Make little demo programs that use the things you are learning. Actually do the exercises at the end of the chapters in the books.
  • Play a lot of games. Doing so will give you ideas and help you make better games. It will also provide a welcome relief from programming.
  • Help others. You will get to the point where you can help others out, and you will learn more yourself through the teaching process.
  • Finish what you start. Don't fall into the trap of thinking "I know I can finish this game, but I have an idea for a better one, so I'll move on to it instead." You will learn so much more if you finish the games you start, and you will have something to prove that you are not all talk. To make this a little easier, don't try to make really big or complex games until you are more experienced.
There you go! You should now be well on your way to making Quake 4. Well, not quite, but at least you can start on that path and know where to look for more information, and with years of hard work, it can happen.

About the Author(s)

Dave Astle has been making computer games since 1984. By day he is a Software Engineer for [url="http://www.roisys.com/"]ROI Systems, Inc.[/url], and by night he heads up the development team of [url="http://www.myopicrhino.com/"]Myopic Rhino Games[/url]. Somewhere in there he finds time to help make GameDev.net the best resource of its kind. Occasionally he sleeps.


Note: GameDev.net moderates article comments.