This is the very first project on the road to building games for desktop operating systems like Windows, Linux and Mac. In these really simple steps we will walk through the process of installing the software applications that we need to start to learn to code for these desktop OS’s.

[widgets_on_pages id=”udemy_advert_cpp_1″][widgets_on_pages id=”udemy_code_details”]

About this project

Skill level 1
Time to complete 40 minutes (downloads might take longer)

New concepts

  1. Visual Studio Express IDE
  2. SFML SDK

Recommended preparation tutorials

Assumed previous experience

  • Basic proficiency with Windows
  • A free Microsoft account

Getting started

Before we can practice using what we have learnt about coding we need a development environment. This is certainly the least fun of any tutorial you will read on this site but once it is complete we can get straight down to basic game coding and start building up to a full playable game.

[widgets_on_pages id=”bcgp_cfgp_gpp”]

Visual Studio

This tutorial has been updated to work with Visual Studio 2017 Community Edition. The SFML setup remains the same except the version number is slightly higher now so I haven’t bothered redoing all the screen-shots, etc, for the SFML part of the tutorial.

Visual Studio is an Integrated Development Environment (IDE) from Microsoft. It is the app that will allow us to enter our C++ code, compile it and then link it with the SFML code to make our games. If that process sounded complex that’s because it is- but by following a few conventions Visual Studio will handle everything with the click of a button. But first, we need to install and configure it.

Visual Studio is an Integrated Development Environment (IDE) from Microsoft. It is the app that will allow us to enter our C++ code, compile it and then link it with the SFML code to make our games. If that process sounded complex that’s because it is- but by following a few conventions Visual Studio will handle everything with the click of a button. But first, we need to install and configure it.

You can use other IDE’s to make games with SFML but Visual Studio is very easy to set up, the version we need is free and SFML themselves recommend it. Installing Visual Studio is as simple as downloading it and following the instructions. It is vital however to get exactly the right version because there are many!

To use Microsoft Visual Studio you will need a free Microsoft account. If you use XBOX, Windows Live services or have a Hotmail email account then you already have one. If not, you can get one here: https://login.live.com/.

Assuming you have Windows 7 or newer we want to use Visual Studio 2017 Community Edition.

The documentation on the Visual Studio website claims you need around 5GB of hard disk space. This is inaccurate. It is best to assume you need at least 10GB free space. Furthermore, if you are planning to install to a secondary hard drive (because it has more space) you will still need up to 5 GB on the primary hard disk because Visual Studio dumps things there too. So, in summary, it is best to make sure you have a full 10 GB space on the primary hard disk if you are installing it there. If you are installing it to a secondary hard disk make sure you have at least 5 GB on the primary and perhaps up to 10 GB on the secondary. Yeah I know, stupid isn’t it.

Visit this link: https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx.

download-visual-studio-2017-community-edition

Click on Free Download as shown above. There will be a short download. Run the downloaded file.

Next, you have to configure the exact setup. To run all the SFML tutorials select the option highlighted below.

choosing-install-options-for-visual-studio-2017-community-edition
Now you can just wait for the lengthy but hopefully uneventful installation to complete. Let’s move on to the SFML phase.

SFML

[widgets_on_pages id=”udemy_advert_cpp_2″][widgets_on_pages id=”udemy_code_details”]
Now we need to get hold of all the SFML files that Visual Studio will require to help us build our games. This is known as the SDK or software development kit. Visit this link on the SFML website: http://www.sfml-dev.org/download.php. Click on the button that says Latest Stable Version.

download_sfml_latest_stable_version

By the time you read this guide the actual latest version will almost certainly have changed. That doesn’t matter as long as you do the next step just right.

We want to download the 32bit version for Visual C++ 2014. This might sound counter-intuitive because we have just installed Visual Studio 2015 and you probably(most commonly) have a 64bit PC. The reason we choose the download that we do is because Visual C++ 2014 is part of Visual Studio 2015 (Visual Studio does more than C++) and we will be building games in 32bit so they run on BOTH 32 and 64 bit machines. To be clear click the download indicated below.

download_sfml_latest_stable_32bit_version_for_visual_studio_2015

When the download completes, create a folder at the root of the same drive where you installed Visual Studio and name it SFML. Also create another folder at the root of the drive where you installed Visual Studio and call it Visual Studio Stuff. Now, ready for all the projects we will soon be making create a new folder inside Visual Studio Stuff. Name the new folder Projects. Just to be clear, here is what my hard drive looks like after this step and within the Visual Studio Stuff folder there is another folder; Projects. Obviously the folders you have in between the highlighted three folders in the image will probably be totally different to mine.


sfml_visual_studio_folder_structure

Finally, unzip the SFML download, do this on your desktop. When unzipping is complete you can delete the zip folder. You will be left with a single folder on your desktop. Its name will reflect the version of SFML that you downloaded. Mine is called SFML-2.3.2-windows-vc14-32-bit your file name will likely reflect a more recent version. Double click to see the contents of this unzipped folder then double click again into the next folder (mine is called SFML-2.3.2). The image below is what my SFML-2.3.2 folder contents looks like when the entire contents has been selected. Yours should look the same.

sfml_folder_structure

Copy the entire contents of this folder, as seen in the previous image and paste/drag all the contents into the SFML folder you created previously. In future tutorials and projects, I will refer to this folder simply as your SFML folder.

We are ready to build our first SFML game project!