Friday, August 27, 2010

Getting started with C++ game development

There is considerable debate among indie game developers about whether C++ is ideal for beginner game development. There are quirks to using C++ that make it more difficult for the beginner to learn to program, issues related to compilation, syntax, and style. However, it remains an extremely popular choice due to the amount of libraries and support available.

If you're just starting out in programming and you've chosen to use C++, then you almost certainly need a book, and preferably even a class if you aren't particularly self-disciplined. For an introduction to C++, I'm not sure you can top the most recent book by the man himself, Bjarne Stroustrup, the creator of C++:
Programming: Principles and Practice Using C++

Alternatively, if you already know how to program and want to get acquainted with C++, then the following book is always highly recommended:
Accelerated C++: Practical Programming by Example

You aren't exactly required to be an expert in C++ before you begin developing games, but generally the more you know, the better. Some very useful libraries may be beyond your comprehension, and you'll end up reinventing the wheel several times over -- usually very poorly. Speaking of libraries, let's move on to those. To get started with PC game development, there aren't any better places to start than SDL, the cross-platform library that can handle graphics, sound, networking; if it's useful for game development, SDL (and family) can do it. One developer that goes by the name lazyfoo has developed an extensive set of tutorials on setting up and using SDL. I can't recommend these enough:
Lazyfoo tutorials

He hasn't added any new ones for a long time, but he does keep them up to date. Also be sure to check out his articles for additional info. The alternatives for SDL include SFML and Allegro. SFML is newer, and while it is not as mature, it is gaining popularity among those who heavily prefer object-oriented programming. Allegro, like SDL, is mature and has an active community of users. One point to consider is that its use is largely focused on games, whereas SDL is commonly used for all sorts of applications.

That should be enough to get anyone started with 2D game development. Displaying a bunch of images on screen and getting them to move how you want is quite literally all the technology involved in just about every 2D game there is. Future posts will go more in depth, show off some code, and delve into 3D programming as well. Best of luck to you!

No comments:

Post a Comment