Beginner; Interested in game programming and have a basic question

Being interested in programming a new game, I have one basic question that needs to be answered. Is this "C++" programming language what it is that I need to know to learn how to program a computer based video game? I don't really mean your basic generic cell phone "Pong" game, but one that may be in the area of say; "Myst" or the like?
Any help would be greatly appreciated.
Thanks in advance.
C++ is the most used language for video games, however there are quite a number of other languages that you could use.
Thanks for the help Athar. One more thing, would this be one of the easier languages to learn?
C++ isn't considered to be one of the easier languages. Which does not mean that it is hard.
Sounds great. Thanks. Athar, would you mind me calling you for a few minutes? I would like to pick your brain for some basics. I find that a few minutes on the phone can prevent 5 days of posts/emails and minimizes agitating the forum etc. Is this possible?
you look at this site for the game.

http://www.lazyfoo.net/SDL_tutorials/
Looks like a great resource. Thanks firix. Although, can I ask the same of you about a phone call?
I live in Germany, so depending on where you live, a phone call could get quite expensive.
You could join the local IRC channel, though. While it's not quite the same as speaking to someone directly, it's still more "dynamic" than posting on a forum.
See http://www.cplusplus.com/forum/lounge/28548/
I'm living in turkey.
phone call can be really expensive.
try to help you here.
you look at this site for the game.


http://irrlicht.sourceforge.net/
Yep, the phone calls would be expensive:) Thanks for the links, I'll check them out.
Last edited on
All you need is C++ and a graphics api. Some options include SDL, SFML, Ogre3d, OpenGL, Direct3d. There is of course more to it than simply coding... there's audio and graphics to consider as well as AI scripting. It's not an easy task to make a decent game. There is also a C# route using XNA studios... but I do not recommend this option.
This is cool. Just what I'm looking for. Thanks for all of your help.


Ok, so if I'm understanding this right, Generally speaking that is.........; the C++ stuff is the coding/basics/frame work of the game. Then one has to apply the audio (which was obvious to me) then the graphics (which I'm not exactly sure how that differs from the base coding except that it adds the elaborate looks per say) and then the "AI" (?), that I will have to research for a bit.

I'm sponging now; If you could add any more, I would appreciate it immensely. Its starting to make sense.

Here's the way it works. A game consists of several elements. The core being the game engine. The core of most game engines is written in C++ although you will find many still written in C or a combination of C++ and legacy C code not yet rewritten. C++ is the choice for three main reasons (there are others): Cross Platform, Performance, and general industry acceptance.

So you know now that C++ is what you'll be writing your game in. C++ has no native ability to display graphics. For this you'll need an API (a prewritten library of code) that can interact at low levels with the graphics card to render your graphics. This is where OpenGL, Direct3d, etc... come into play. The graphics card must support the version (implementation) of the API. For example if you're using Direct3d v 10 then you'll have problems rendering graphics on an older card unless an available driver is published by say Nvidia or ATI. These libraries are either written in C or C++, but many of them can be used with other languages such as Java or C#.

The APIs I mentioned earlier where written in the following languages:
2d Graphics: SDL (C), SFML (C++)
2d/3d Graphics: OpenGL (C), Ogre3d (C++), Direct3d (depends on the version I believe, C & or C++, someone correct me if I'm wrong, I haven't touched v11 yet).

To continue focusing on the graphics portion we can discuss what the APIs typically are used for. The APIs are used to render game objects, typically created through external graphics applications (images, shapes etc...) but they can't effectively make, say a Mage with a flaming staff, although I've seen some impressive things. For the more elaborate game objects the characters of the game, the buildings, etc... these are forged in 2d/3d Graphics tools. To discuss them briefly:

Autodesk: Maya (mainly used for game cinematics and movies, but is pretty much the equivalent of 3ds Max... I find the UI easier) Has its own scripting language called MEL Script which is used to execute repetitive tasks such as building 100 polygons or whatever.

Autodesk: 3ds Max (the standard in the industry, both apps run at around 3-4k per license, but there are some free student editions that stick a big watermark on your graphics, but a good learning tool.) Uses MAX Script, same purpose as MELScript, both can be used to build out the UI of the products as well.

Adobe Photoshop: (For all 2d this is the way to go, just much easier to create meshes for example. Typically runs at a few hundred bucks)

Blender: Free 2d/3d tool that has some excellent abilities, not quite used in mainstream AAA game development but will get the job done just as well.

So basically the gaphics are created elsewhere and then rendered using the APIs. Make sense? Now the APIs have incredible power when it comes to lighting, for this you'll need a shader language for the best of the best (don't even bother to look at it yet as it is pretty much its own language). You can just use what OpenGl has for example. They also excel at particles, here's a good example http://www.youtube.com/watch?v=F5xwSLdG9n0.

So now we have the graphics out of the way. Time for audio. Typically an api has some sort of equivalent audio library to play sounds, music, etc... To name a few SDL has a mixer extension and there's OpenAL. Same idea as the graphics api, you call its functions to do things, these are in C or C++.

Physics: Unless you are a math/physics wiz you'll want to grab a physics library if you need something hardcore, otherwise basic collision detection and gravity effects are enough.

Event and AI Scripting: Think of this as the behavior of the game. You have the core game engine, the rules of how the world exist, how physics work, the boundaries of the games "reality" that govern the objects. Typically these things, including items, attributes of all sorts, NPC and enemy behavior are all done in a scripting language. The reason being is it is more managable. Imagine everytime the items changed, or you wanted to change the way the game went, quest text, etc... you had to update some C++ code... just not worth it. So you use a scripting language which can be embedded directly into your C++ source code, or just called. The two popular ones at the moment are Lua (used in World of Warcraft) and python, which is very popular and has an extensive library, even one for games called Pygame. Game designers typically work in this domain along with a level/object editor of some sort.

Databases: Every game has some method of storing game data, be it a Relation Database such as MySQL, SQLServer, or Oracle, or just some flat text files. XML has recently become popular for managing item attributes and passing data back and forth as well as use in config and error logging. You most likely won't need SQL because realistically AAA games develop their own proprietary databases for much of the game data (I wish Blizzard had done a better job). Which of course is written in C or C++! They are used for accounts for example.

You also have 2 other factors to consider depending on your game. Multithreading and Network programming. There are apis for both. C++ has no native multi threading capability (see boost library). I won't go into detail about either of these.

Now all of these components are interfaced among each other and you have yourself a real game... I'm not talking pong for this amount of effort, but I think you get the point. Pick and choose the tools you need. Hope this info was useful.
Last edited on
That was the best explanation I've heard yet. This gets me fired up knowing that I'm going in the right direction.
Thanks for all of your help, and the others. I'll keep poking away at this stuff.
Topic archived. No new replies allowed.