logo.jpg (7978 bytes)

C++ Game Programming



C++ Game Programming tips and Advice

 

Introduction

Only recently has C++ game programming come into the lime light. People used to have ideas that it was too slow to be useful for game programming. This may have been true to some except, but today any performance hit from using this will be more than compensated for the speed of todays processors. A well programmed C++ program is going to out perform an average C program.

C++ for game programming has a few advantages, the first is the advantage of classes - the core of object orientation. Your program can achieve a good level of encapsulation using classes that makes any modifications or debugging a whole lot easier since other parts of a program are unaffected.

Object Orientated techniques have been largely successful due to the fact that such encapsulation allows programs to grow much larger and still be maintainable. Procedural languages such as C, on average, can reach about 25,000 lines of code before become hard to maintain. C++ on the other hand can get over 100,000 lines before the same problem occurs.

Encapsulation also gives a perfect opportunity to reuse code. Unfortunately this is not often done and similar code is rewritten again and again.

There are, however, some cases where C++ is not desirable in video game programming. If you were programming something like a Gameboy, C++ techniques would swamp it.

On a whole C++ is where it's at, Java is the only real competitor but hasn't really caught on in video game programming.

 

C++ Game programming tutorial

I have created a tutorial to create a complete game using OO techniques. The source code uses Visual C++, and OpenGL for graphics. You should be able to follow the basic idea if you are using different compilers or DirectX.

Check it out here.

 

Compilers

Follow this link for information about various C++ compilers here.

 

Source code examples

I have written various games using C++, follow these links to check them out:

 

Back to main page