Sound and vision
So, having swotted up on the nuts and bolts of C++ it’s time to make a start on my first game.
Before I get that far, though, there’s the small matter of making the leap from command-line based, text-only programs to all-singing, all-dancing (literally) games programming.
It’s a bigger leap than it might sound to the non-programmers out there. There are many things a game needs to do that aren’t covered in the standard C++ libraries or taught in the core tutorials, and that would be hugely complicated for a beginner to write from scratch.
Things like drawing things on the screen, moving sprites around, playing sounds and music, loading graphics and sound files from disk, checking for input from a joypad… that sort of thing.
Fortunately for the beginner, there are various free libraries out there that essentially provide extra commands to use in programs to do all that sort of thing for you.
Allegro, the library I used during my brief foray into C, is still doing the rounds and seems quite a popular choice for my fellow newbies. But although it works with C++, it isn’t built from the ground up for the language (it isn’t “object-oriented”, which I gather is quite important - although I’m not quite sure why).
Another popular choice is SDL, which has also been around for a fair old while and has many devotees. This, it seems, is the more “hardcore” option and has made its way into several commercial titles.
But I’m going with the new kid on the block. SFML (it stands for Simple Fast Multimedia Library) is in its relative infancy compared to the other two libraries mentioned but gets my vote due in no small part to the noob-friendly tutorial section on its website. It’s completely free, even if used to make commercial software. And, from the quick play about with it that I’ve had tonight, it’s pretty damn impressive.
After following the first couple of tutorials I’ve managed to plonk a big space invader on the screen and get it moving around according to keyboard presses. I can even rotate it, something I couldn’t have done in my wildest dreams back in the Amiga days. Life is good.