When deciding to write a new game, there are 3 primary decisions that will drive forward your entire development process:
1) Figure out what you want to do.
First, you have to come up with a good game idea. This can be really difficult, or it can be really easy, depending on how creative you are and whether inspiration hits. An typical answer is, “I want to write a game like <Halo/Starcraft/insert favorite game here>”. Unfortunately, this is not a good answer. That game already exists, and the people who are interested in that type of game are already playing it. You’re probably not going to do a better job than a company that can throw millions of dollars at development. Even if your only competition is other hobbyist programmers, does the world really need another game where you can click on blocks and make them disappear if there are at least 3 of the same color touching? (unless you’re making a Tetris Attack clone, then the answer is yes). In order to attract attention, your game needs to offer something different -- something novel. What are you going to bring to the table that hasn’t been seen/done before? People are resistant to change, so unless you can offer them something that makes them want to spend the time to figure out your game, your game will go sadly (but not unexpectedly) unappreciated.
Second, you have to decide upon the scope of your project. It’s extremely common to think big and shoot for the moon. However, in programming, this is often exactly the wrong idea, because odds are that six months into development you will get bored and frustrated with your lack of progress and decide to call it quits. Shoot for something expremely simple and modular, and then add the complexity in layers. Your goal should be to get something that is minimally playable within a couple of weeks time, even if it doesn’t have most of the features you want, and even if it’s totally unbalanced.
2) Choose your language and platform.
Is C++ really the right language for your project? If you’re interested in developing a lightweight game that can be net accessible, perhaps flash or Java would be more appropriate choices. C++ is good for games that will be downloaded to the user’s machine, games that need to be fast, and games that need to do complex things, like render 3d scenes.
Assuming that C++ is indeed the right language for you, what platform are you targeting? Is your game going to be Windows only? Linux only? Mac only? If you’re developing for a single platform, you make your development job easier because you can use platform specific tools and libraries, and don’t have to worry about cross-platform issues. However, you’re also restricting yourself to a limited audience. Many Windows programmers dismiss Linux and Mac users because they aren’t as numerous -- however, users on these platforms also have a smaller selection of software to choose from, which means your game ported to those platforms may get more attention there. If you’re writing a roguelike game, will you support old console-only workstations that don’t have GUIs? Fortunately, many popular libraries these days are cross-platform, making your development job easier if you write the rest of your code so that it is cross-platform.
3) What libraries are you going to use?
The core C++ language was intentionally kept simplistic and minimal -- consequently, it does not come with the tools required to create most games. In order to do things like handle graphics, fonts, mouse actions, sounds, music, and other things that modern games need, you will have to use add-on libraries that have been developed for these purposes.
If your game is going to be a 3d graphics heavy game, the most popular choices are either OpenGL, which is great for cross-platform use, or DirectX, which is Windows specific. Or perhaps a layer on top of one of those, such as Ogre 3D.
If you want to do a 2d game, SDL or Allegro will both fit the bill. SDL can also utilized in conjunction with OpenGL, so you can mix 2d and 3d. (Allegro might be able to as well, but I am not that familiar with Allegro).
If you’re interested in writing a console roguelike game, Ncurses or PDCurses will allow you to do ASCII graphic games. Many modern roguelikes emulate a console using SDL or Allegro -- this gives you advantages not available on console machines, such as being able to access more colors, use different fonts, and swap in graphical tiles.
It’s worth noting that it may be possible use multiple libraries. For example, if you write your code modularly enough, you could have it use Ncurses on old unix consoles, PDCurses on dos consoles, and an emulated console via SDL on Windows and X-Windows. In this way, you can hit a huge range of machines with different capabilities.
Once you have your idea, your platform target, and your target libraries, the easy part is done. ;) From here, all you have to do is design your game, and learn how to use the tools at your disposal to implement it!
It is worth your while to do two things:
- Design your game on paper as much as possible before trying to implement it. The idea is that you want to minimize changes as much as possible while coding -- so the more you can solidify before you start coding, the better. The farther you are into the development process when a change is made, the larger ramifications that change will have, and the longer it will take to implement. Make your major decisions as early as possible and try not to change them unless necessary.
- When implementing a new technology for the first time, it’s often a good idea to test run your idea in a separate program (called a prototype). The object of this prototype is to get something working fast, even if the coding is poor, and allow you to play with it without having to worry about messing up your game. Once you are comfortable with how the feature works, you can then implement it correctly/modularly in your game. Because you’ll get many learning curve mistakes out of the way when developing the prototype, you’ll have a better idea how to implement it successfully in your game without breaking anything else.