Stack OverflowLearning game programming
[+166] [26] thr
[2008-10-06 15:41:49]
[ c++ c opengl directx ]

Quick question: I've been in the web-dev world for several years now, I've wrapped my head around Java, Python, PHP, C# and Ruby- and currently make my living as a C#.NET programmer and I want to learn game development for real, no "build your own 2d sprite game over 14 days"-bs, the real deal. Where do I start? learning C? learning C++? Assembler? I've tried searching the net but most things I find is just tutorials of the "build something quick but don't really learn anything"-type.

I am well aware that this is a huge endeavor, yes - but my current realm of problems (the web side of things) is not giving me anymore challenges, or at least challenges that can't be answered by five minutes of searching on google or a question on stack overflow. I need to teach myself something, anyway: My long term goal (several years) is to build a simple 3d engine and create a simple game within it.

So where do I start? I know basically nothing about gaming programing, I've done my fair share of threading and networking in both python and java, but I know nothing of graphics or sound programming, Direct X, OpenGL, etc. and I'm pretty lost on what platform (Windows/Linux) to start, which language to teach myself, etc.

I suppose a long term pipe dream would be to get employed as a network programmer or graphics programmer at a game development company, but I'm aware that is many, many, many years away.

Right now I'm looking for advice on this:

And let me repeat, I'm aware of how huge this is - but I need to learn, or I get boored.

(5) It appears that is blank. Will you be reviving it soon? Did it get hacked or something, or did you clear it out? - Ricket
It does indeed appear that the site is blank. It has been blank for many months, though it was up for a little while. It's too bad. I was interested to see how the learning process worked out for him. Perhaps I should get a site up along this line ... if people are interested, I'd be willing to take on the challenge. - Marc Reside
[+172] [2008-10-06 18:13:30] Marc Reside [ACCEPTED]

UPDATE - Jan 22nd, 2012 This answer, despite being over 3 years old, still gets a lot of traffic. In the years since I wrote this up, Smartphones and Tablets have become an altogether NEW platform for low-cost entry into making games. While the thoughts below are mostly relevant regardless of platform, Smartphone and Tablet development was not considered, and if you're a programmer looking to get into game design, Smartphone and Tablet games are definitely an option for you to consider.

I'm going to answer with two different ways to go. Choose depending on how you complete the following sentence: "My end goal is to ..."

1) "... make games for a living, preferably for a company that is an industry player."

Get experience and prove you can complete projects. The best way to do this is to use existing packages and build with simple game ideas.

Start with C# and the XNA Framework [1]. Aim to get published initially through XBOX LIVE Community Games [2]. Small projects are key, as you are starting alone.

Move from there to C/C++ [3] and build something with an existing engine, like Ogre3D [4] or Torque [5].

With experience and a proven track record, find ANY opportunity within the industry and apply.

2) "... push the edge of technology and build my own dreams, my way. Perhaps publish under my own name as an independent developer."

Start with C/C++ [6].
Learn DirectX [7] or OpenGL [8].

Once you move from the above simple tutorials into more advanced concepts in both C and in your chosen graphics library, start researching heavily into Computer Graphics [9].

When you can load whatever graphics you need onto the screen, next is Physics and Object Interaction [10]. * UPDATE 2011/02/26 * Original link was broken, linking to Wikipedia temporarily.

Got physics down pat? Build or incorporate a Scripting Engine [11] in so you can create animated scenes without hard coding everything into the engine. As a hobbyist, I enjoy the idea of building my own just for the learning experience. However, as pointed out by Dan [12] in the comments, there are other options available for scripting, such as incorporating LuaJIT [13] (mentioned in the comments) or another ready-made scripting language into your code.

Your engine is now a wonderful tool for simulation. Next is Human Interaction. Refine your engine's API for player control so it's independent of whatever project you pursue.

I can't hear anything ... Sound [14] is next to implement.

Now we're going to get bored interacting with static obstacles and simple challenges. We need to implement Artificial Intelligence [15] next.

Alright, you're at least far enough into the engine building to hire a team for your grand dream. You need the following team members as a minimum, more than likely:

  • Author
  • Musician
  • Animator
  • 2D Artist (for concept art, textures, backgrounds, UI ...)
  • 3D Modeler (to transform concept art)
  • Director

That's at least a start to what you'll need to do to make your own engine, your own way, with your own two hands. If that's what you're looking to do, I say go for it. It'll be fun! :)


(1) The link to the XNA Framework takes you to Wikipedia "Breakout Arcade Game" when I think maybe it should take you to - Bill
You're right, fixed link to point to the Microsoft XNA page instead. :) - Marc Reside
(3) Nice run down - personally would put Sound before AI. All you need for a simple puzzle game is Object/Human Interaction, Sound, and Video. I like that you included the whole stack though. - Nick
You make a good point, Nick. I think I'll reverse those two on the list. - Marc Reside
(3) 2d artist is also necessary for textures and UI etc etc, not just for concepts ;) - Stowelly
(1) This is true. Will fix. - Marc Reside
I wouldn't build a scripting engine, instead I'd incorporate an existing lnagugae like Lua, Squirrel, Angelcode, Python or Falcon - Dan
@Dan: While incorporating an entire language is an option and can be very powerful, sometimes you don't really need all the power of these suggested languages. A scripting engine doesn't need to be very complex, at least initially. Of course, I'm a hobbyist, so I like building stuff myself just to see how it works. ;) - Marc Reside
Marc, nice answer. I'd like to contend that starting with C# & co. then moving down toward C is generally a pain compared to learning in the other direction. Better to gradually build that understanding of the "magic" that higher-level languages do, IMO. - Cheezmeister
(2) @Marc, building it for yourself as a learning exercise is probably the most valid reason to reinventing the wheel. If this were not a hobbysit project though, unless you have some very special requirements, I would say writing your own language is the wrong thing to do because it is something a lot of people who know what theyre doing have already spent a lot of time on and it would be hard to beat something like LuaJIT. Of course, there will be times when making your own language is the right thing to do (and as a learning experience is one of those, I agree) - Dan
General: updated Physics link ... link was gone, so I'm temporarily pointing to Wikipedia. Will try to find a better link later. Maybe it's time I stopped nursing this one answer and built myself a website for this stuff? ;) - Marc Reside
@Cheezmeister I'm of two minds on this item. On the one hand, I think the prerequisite for becoming a good programmer is to understand the basics of computation, which can be (but isn't always) easier to teach (in my opinion) using lower-level languages such as C. On the other hand, the advantage in this case with using a higher-level language like C# is to finish a number of non-trivial projects using ready-built packages. This is much more analogous to working on larger projects in teams ... junior programmers are going to start out not as core engine coders, they're going to work up to it. - Marc Reside
@Dan You've convinced me to update my scripting section. I now cover both options, as it seems the technology has advanced quite a bit since the last time I browsed around on the subject. Two and a half years since I first posted this answer ... wow. - Marc Reside
Whatever you decide on, don't jump into Ogre or Torque as the first or second step. Make Pong as your first game. Tetris or Pacman as your second. These games are simple enough that you have a chance making them (and if you arn't able to make those 3 games, game programming is not for you), yet teaches you most of the basics you'll need - a basic game loop, some graphics, collision detection, animation, possibly a menu system, a hud, etc. - nos
Nice answer, I would add "3D Math Primer For Graphics And Game Development" and "Game Scripting Mastery" as good books to have around when learning game/engine development. - Saif
+1, One of the best answers I've seen on SO. - ApprenticeHacker
(1) Please remove the link to NeHe. It's outdated and shouldn't be learned from. Point them at the OpenGL Wiki instead. - Nicol Bolas
@NicolBolas That's fair. I've updated to point to the OpenGL website. - Marc Reside
Awesome! Thank you very much!! - Nazka
[+65] [2008-10-06 16:13:57] Skizz

Here's a secret....there's nothing special about game programming! It's just like any other bit of software engineering: you have a design, an implementation and a QA phase. Graphics and physics - they're just APIs. Audio - another API. AI - a big state machine.

You can write a game on any platform, the original Adventure was written in Fortran for a PDP-10 mainframe. Some of the most popular games today are written using Flash.

If you want to make games, design one and make it using the software development methods you already have (if you've written threaded code that works, you're well above most game programmers I've met already). Also, you need to accept that you won't produce anything on a par with consoles or bleeding edge PC games unless you have an artistic friend willing to work for free, you're willing to pay for models and textures or you're artistic yourself. But don't let this put you off! Implement something that you can do (i.e. doesn't need a fully animated humanoid character or large, detailed environments) - tetris is usually a good start or games involving spheres and boxes.

Anyone can make a game, the really hard part is making a fun game that people want to play again and again and that is nothing to do with programming at all.

(10) There is one thing, though: Games, particularly 3D games, require a lot of math. - Powerlord
(9) Good answer. People all too often assume that game programming is "special". Yes, it requires a bit of domain knowledge (3d maths, for example), but it's still just programming against a bunch of API's. The best way to learn game programming is to learn programming. - jalf
"Graphics and physics - they're just APIs. Audio - another API. AI - a big state machine." OP clearly wanted to know the real stuff, not how to use a high-level API - Calvin1602
Well comparing web site development to gamedev... for games you need more realtime responses, math and physics. Its much broader. - schoetbi
(8) Treating physics as "just an API" is not going to turn out well. - Ben Voigt
(1) No matter how many times people answer these questions, there is a lack of tutorials on really getting started. Its too easy to say do-this do-that, but if you just offering advice and not pointing to a direction that has info on building the simple concepts and structures, you aren't helping. And all these so-called books on game programming thats suppose to get you in the door of development are basically scams - SpicyWeenie
@SpicyWeenie: The point I tried to make is that you don't need a specific game programming tutorial, a general tutorial is enough. If you can build an application, use an API and know how to do debugging, then you have all the tools needed to build a game. It's just a different set of requirements. There may be specific areas that most apps don't worry about that need extra information (constructing a game loop, user input, etc). A question here on a specific problem is more useful than a general "how to write a game" question. The answer to "learning game programming" is "learn programming" - Skizz
[+23] [2008-10-06 15:45:22] Fionn

Maybe take a look around at

(1) +1, great site which helped me a lot in the past. - Dan
[+18] [2008-10-06 15:59:03] KPexEA

I've been programming video games for 20+ years, you need to learn c and c++. I would recommend writing a game using, it is a cross platform game engine framework. No need to come up with something original, try making clones of older classic games. The most important part is just to jump in with both feet and start.

(2) +1, SDL is great. Been using it for years. GLFW is not bad either: - Dan
[+16] [2008-10-06 15:47:35] JTA

I know it's not C or C++, but if you would like to stick with the C# you've learned, check out the XNA Framework from MS. It's a C# game development platform which you can develop games for Windows, XBox, and Zune (beta version). There are plenty of resources available on the web on how to get started. [1]

If you prefer C++, take a look at the DarkGDK for rapid game development. It will at least allow you to get your head around the art.


(1) Note: as of 2012, it seems the future of XNA is in doubt. - JTA
[+6] [2008-10-08 12:24:19] dbr

Start by making modifications for existing games.

I would strongly recommend the Half Life 2 engine, the mod tools are good, and are pretty easy to pick-up (compared to the Unreal tools, in my experience), the Source Engine is still very relevant, it is very flexible, and has a great distribution system (Steam)..

This [1] seems like a good starting point. Of course the Source Engine is mostly aimed at first-person-shooter type games, you could mod it into model train-simulator, but you'd probably have more like mod'ing a different game engine!

"Making a MOD" [2] is a great (more general) article on creating game mods.

Mod'ing a game means you have assets to start with - you don't have to model a gun, or textures, just to start level-design. Not to say you wont replace those models/textures eventually, but you at least have a starting point.

Trying to write you own game from scratch will never end well. Most game developers (even "big" ones) do not write their own engines - it's an incredibly complex thing to do - that is why so many license the Unreal Engine, or the Source Engine.

If you really don't want to mod a game, at least use one of the pre-built engines (I would recommend PyGame [3] for 2D, Torque [4] for 3D, possibly DarkBASIC [5])

As an aside - many game developers started their game-making lives modifying existing games - creating, or being part of a decent game mod is a very good foot-in-the-door into "the games industry".


[+5] [2008-10-06 16:42:39] crystalattice

To get your feet wet, you may want to consider PyGame [1], since you already have experience using Python. It's a Python library dedicated to making video games so it has a lot of the features you will have to learn.

Once you are comfortable using that, then you can move into C/C++ game development. That way you will have a solid foundation of what's required, know what works and what doesn't, and have an idea of how to tie everything together.

Don't forget there are a lot of game engines available for your use, such as the original Quake engine. Building games with those will let you concentrate on the actual game and show you what's needed to develop an engine.

You can also look at the mod scene. Counterstrike started out as simply a mod for Half-Life; now it's a bona-fide game of it's own. Many people got hired at game companies based on their mods.


[+3] [2008-10-06 15:56:58] Jeff Mc

Right now the market is all C++ and DirectX, While I'm a huge OpenGL advocate, Direct3D 10 on Vista solved the major marshalling problems of old D3D9. That coupled with OpenGL's glacial speed to adopt new video technology has started to make me think it's a sinking ship.

There are countless places to learn C++, and if you really understand C# and the CLR, C++ should be a pretty easy slide over.

Once you feel comfortable with general Win32 C++ just grab the DirectX SDK, there are some pretty decent tutorials there on the basics and advanced stuff. Unfortunately there is a weird absence of intermediate level tutorials.

[+3] [2008-10-06 16:40:16] intrepion

If you want to stick with Python, you can do OpenGL with pyglet [1].

Or if you want to do C++, my favorite tutorial on OpenGL is at [2]


[+3] [2008-12-02 00:48:15] kranzky

Totally disagree with your assumption that building a 2D sprite engine in two weeks isn't real game development. It is. Take C++, a basic engine such as Haaf's Game Engine (, a physics engine such as Box2D (, get them all talking together happily, then build the fundamental entity system yourself, and build a game on top of that. Depending on the game you choose, you'll need to solve all the same kinds of problems that real game developers face every day.

As far as languages go, learn C++. If you don't already know C, then learn C first, then C++.

Also, don't worry about low-end graphics and sound programming to begin with; I'd recommend that you leave those things to the library that you use (HGE or SDL or whatever) and focus on the underlying mechanisms that all games share. Once you understand those, then drill down into the graphics or sound layers, sure.

[+2] [2008-10-06 16:34:22] David Hicks

Where do I start?

Flash. Forget trying to do a full-blown download-and-install application complete with snazzy graphics, aim for something self-contained and with good gameplay. This is what people actually like playing. Don't just take my word on it, though - if XKCD [1] says so, it must be true.


[+2] [2008-10-06 16:38:30] Electrons_Ahoy

On a somewhat different tack is Inform [1], which is a modern reconstruction of the language Infocom used to make all their Interactive Fiction back in the old days. So, while there aren't any graphics or sounds, it does provide a really solid way to learn how games works in the big picture sense - how to put together an environment that the player can move around in and interact with. Also, as it's just text, you can knock together an entire playable game in a weekend, which is pretty hard to do in anything else.

It also runs on just about every environment in existence, so you get to put off making platform decisions for a while longer.


This is really bizarre but I kind of like it :) - Guillaume Massé
[+2] [2009-01-07 07:04:50] Steve Lacey

Games aren't all about 3D graphics. Believe me, I spent 10 years building 3D engines...

3D graphics programmers are like guitarists - they rock hard, but at the end of the day there are loads of them around. If you've ever tried to put a band together, you'd realize that finding bass players and drummers is very hard...

Take a look at the other areas, for example AI and sound. Skilled specialists in these areas are always in demand...

[+2] [2012-02-29 08:19:31] Jonas Byström

You have the right mindset, and you're aware of the amount of work it's going to take - which is by far the most important consideration. I did the same thing that you set out to do, apart from that I had some game dev skills already when I started making my engine and games. These were my goals:

  1. learn a lot,
  2. make a 3D game engine from scratch,
  3. make 3D games with that (of which my first is almost done),
  4. focus on reusable code so making a new game is fast,
  5. make sure it's easily portable so I can move to new platforms whenever I want,
  6. eventually, in the long run, try to make a living doing it.

I'm now some 10 yrs+ in the making... :))) (But it's really just the last seven years I worked extremely hard. :)

These are my hands-on recommendations, if you don't want to end up in the same pitfalls I have:

  1. Write portably in general code. It's difficult and demanding and you'll learn about different hardwares, operating systems and compilers.
  2. Learn C++. It is next to C the most portable language. It is fast. It is difficult.
  3. Use OpenGL and OpenGLES for your 3D stuff. Generate your stuff, don't build homebrew model importers, it took me six months to get it right. If you still choose to do this, note that you'll learn more about linear algebra than game development.
  4. Write a very, VERY small, hackish game (not game engine) from scratch. Make it small or you'll literally spend years producing it. Don't polish it when done; tip of the iceberg principle will keep you busy for months, and you'll only learn it takes a lot of time. Polising a game is as technical as polishing a car - being close to hi-tech is not going to get you any more knowledge about it.
  5. Port your Tiny Game from, say, a desktop application to iOS. This will give you a basic understanding about platform differences, how to handle taps (which is very different to clicks, you'll see), and so on.
  6. Now create your game engine from finished building blocks instead. (If I wasn't so damn proud of what I've created so far, I'd do this too, but I'm not dogfooding [1] unfortunately. For instance, I might've combined Ogre3D [2] rendering engine, Bullet [3] physics engine and quite possibly Boost [4] to avoid reinventing the wheel.) You'll learn how to make games, and you'll get a very good understanding of what it takes to build a game engine, and how it's built up.
  7. Don't try to build a bunch of frameworks or toolkits that are "reusable", it takes insane amounts of time. Time which you, if you're anything like me, eventually don't want to spend there.

I've learned loads from reinventing the wheel [5], but I'd definitely learnt more if I'd pushed myself in other areas. For instance, implementing your own threading toolkit is fun and a valuable experience, but if I hadn't wasted my time there, I could have investigated elaborate rendering techniques or fabulous input control methods.

Stay hungry, stay foolish! (And best of luck!)


[+1] [2008-10-06 15:47:36] Chad Moran

C/C++ is where you want to go for the end-result of high-end high performance gaming applications. Though to be honest I'd recommend starting off with some manged game programming it'll help you wrap your brain around it because it's no small task. I've put my feet in that pool and burned myself.

Here are some resources.

These are both places to start working with DirectX. With your background in C# I'd say this is a great starting point. Once you're rolling you can move your way to C++ once you need the performance and have a grasp of the subject.

[+1] [2008-10-06 16:16:14] akalenuk

Creating your own engine from scratch is not the best idea. Sure it can bring a lot of experience, but there are enough engines already done and working. And for the time you will spend on creating your own, there'll be more. If you're interested in game development, you shold first of all get familiar with existing engines.

[+1] [2008-10-06 16:16:33] John Smithers

If you want to focus on 3D engines, you already have a starting point. ;-)
Look for open source 3D engines like e.g. Ogre 3d [1].
Download the source, learn the language it is written in and dig into it.
Become a member of the community, fix bugs, read their documentation.
After a year ore two you have learned enough to write your own engine, I guess :-)


[+1] [2008-10-06 16:24:26] glenatron

Additional to the stuff recommended above ( and to start with you can develop in a language you are familliar with - for what you will achieve in your first few attempts C# is fine and then you'll know what you want if you do decide to move to something lower level ) I would look into game design as well.

You may want to be doing something epic and awe-inspiring full of sparkly particles and dramatic physics effects, but as countless games have shown us in the past, that is no use if the game isn't fun. It's worth spending a while with a simple prototyping environment, experimenting with different kinds of gameplay and trying to find something that works well in a simple form- books like A Theory Of Fun [1] may be useful in helping you find inspiration and ideas to experiment with.

Once you've got great gameplay you can build it up however you want and know that you have a really solid foundation to start with.

Another thought is that if you want to finish a project, you may find you get more joy starting out by building mods rather than building engines or whatever else- for a single person a modern game is a project of enormous scope, but extending an existing engine and building new content for it is a little more achievable and certainly a few games development teams now started out from the modding scene.


[+1] [2009-01-31 17:56:42] Nic Wise

C might be a good language to start with, but have you considered the iphone/ipod touch as a platform? it's (objective-)C based, has opengl and animation lib's, has sound, and also has a very good "getting paid" model :)

Just a thought.

[+1] [2009-04-23 10:45:44] Stowelly

These 2 articles are very useful for beginners to know as a preliminary to game development:

Write games not engines:

Teach yourself programming in 10 years:

edit: added the cached version as link doesn't appear to work [1]


[0] [2008-10-06 15:53:29] Dropped.on.Japan

I attended a school that offered a Game Programming degree, and I remember hearing about a book called 3D Game Engine Programming by Stefan Zerbst. I haven't read it personally, but you can get it here. [1]


[0] [2008-10-06 17:23:12] Andrew Jahn

Intro to making games [1] is a the best place to start. I'd also recommend reading this C++ [2] book. And reading this book [3] for no other reason then I like it and find it valuable for any developer.


The link to the Gamedev site has changed. It's now here:… - rtperson
[0] [2008-10-21 20:26:00] thing2k

If you want to get into game development, I strongly recommend the [1] - XNA Xtreme 101 : Volumes 1, 2 and 3 [2], especially as you already have C# experience.

Have you ever been interested in creating your own games? Welcome to the XNA Xtreme 101 video training course! This first volume covers nearly 30 hours of lecture and is specially geared toward the first-time programmer interested in creating games for the PC and Xbox 360 platforms!

Volume I will quickly get you up to speed in programming with a strong foundation in the C# programming language. You’ll also get a clear description of the .NET infrastructure, while learning precisely what .NET is and how it is defining the next generation of computer programming. The lessons have a strong emphasis on programming using proper design principles, including creating your initial requirement spec, moving on the design phase, and laying out a solid implementation plan.

You’ll also get a taste of the artistic side of game creation as well, with discussions of the creative process, the importance of artist-programmer interaction, and even videos that cover the creation of graphics within Photoshop!

There are a number of XNA sample videos for each volume, include two full projects for volume one.

I believe XNA Xtreme 202 is currently in development, and is planned to involve the building a 3D RPG of reasonable size, I'm trying to find a link for this but it may have only been mentioned in the Radio Show.


[0] [2008-11-16 00:04:05] Paul Sagor

You could a totally different route than C / C++ / C#, etc. and try Dark Basic Pro - yes it is basic, but it has a huge library of game constructs for 3D and 2D and include extensions for just about anything. It is tied to Direct X, so no cross-platform stuff as with Open GL, but it produces very quick results.

[0] [2008-11-27 02:04:50] M. Utku ALTINKAYA

3D API choices are overrated, nobody is using fixed function pipeline anymore anyway, so you will sooner or later have to let go the helpers of the API. Porting from one to another is not that big deal, if you are not in the release state or have hundeds of shaders.

For an independent developer, for any independent project in fact, I believe the most important thing is to know where to stop. It is easy to lost your way while the client is yourself.

So prototyping is critical, for that I think the best way is to go with high level dynamic languages, you can change stuff easily, try your ideas, let your work evolve, trying to design everyting without experimenting is for dinosaurs anyway. Once your game design, your requirements, data structures and file formats etc. are clear, start implementing with compiled languages, if you ever need to of course.

[0] [2010-01-15 10:39:52] Ben J

I can highly recommend the book "Game Physics Engine Development" by Ian Millington. This has practical examples written in C++ and uses the OpenGL framework. It will take you step by step in developing a physics engine that can be applied in many different realistic gaming environments and has very nice practical examples, for example, a simple 3D flight simulator (code examples included on an additional CD)

All the best, Ben.

EDIT: Additionally, I would recommend a language like C++ since this allows integration with a variety of 3D graphics apis (e.g. openGL) relatively seemlessly, yet also has the advantages of object orientation, and the ability to integrate assembly and `normal' c code for purposes of fine-tuning...