-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Beginning C++ Game Programming
By :

Whenever you make a game, it is always best to start with a pencil and paper. If you don’t know exactly how your game is going to work on the screen, how can you possibly make it work in code?
At this point, if you haven’t already, I suggest you go and watch a video of Timberman in action so that you can see what we are aiming for. If you feel your budget can stretch to it, then grab a copy and give it a play. It is often on sale for under $1 on Steam: http://store.steampowered.com/app/398710/.
The features and objects of a game that define the gameplay are known as the mechanics. The basic mechanics of the game are as follows:
Expecting you to plan the C++ code at this stage is obviously a bit silly. This is, of course, the first chapter of a C++ beginner’s guide. We can, however, look at all the assets we will use and an overview of what we will need to make our C++ code do.
Look at this annotated screenshot of the game:
Figure 1.17: Screenshot of the Timber game
You can see that we have the following features:
So, in a nutshell, the player must frantically chop to gain points and avoid running out of time. As a slightly perverse but fun consequence, the faster they chop, the more likely their squishy demise.
We now know what the game looks like, how it is played, and the motivation behind the game mechanics. Now, we can go ahead and start building it. Follow these steps:
.dll
files into the main project directory. My main project directory is D:\VS Projects\Timber
. It was created by Visual Studio in the previous tutorial. If you put your VS Projects
folder somewhere else, then perform this step there instead. The files we need to copy into the project folder are in your SFML\bin
folder. Open a window for each of the two locations and highlight all the files in the SFML\bin
folder, as shown in the following screenshot:Figure 1.18: Selecting all the files you need
D:\VS Projects\Timber
.Figure 1.19: Where to type the code
Your layout might look slightly different from what’s shown in the preceding screenshot because the windows of Visual Studio, like most applications, are customizable. Take the time to locate the Solution Explorer window and adjust it to make its content nice and clear, as shown in the previous screenshot.
We will be back here soon to start coding. But first, we will explore the project assets we will be using.