Choosing the right source control tool
In this recipe, we will see how easy it is to take a backup of our code using the right version control. The advantages of having a backup to a central server is that you will never lose work, can download the code on any machine, and can also go back to any of your changes from the past. Imagine it is like a checkpoint that we have in games, and you can go back to that checkpoint if you face problems.
Getting ready
To go through this recipe, you will need a machine running Windows. No other prerequisites are required.
How to do it…
Choosing a correct version tool is very important as it will save a lot of time organizing data. There are a few versioning tools that are available, so it is very important that we should be informed about all of them so that we can use the correct one based on our needs.
First analyze the choices that are available to you. The choices primarily include Concurrent Versions System (CVS), Apache Subversion (SVN), Mercurial, and GIT.
How it works…
CVS has been around for a long time, so there is tons of documentation and help available. However, a lack of atomic operations often leads to source corruption and it is not well cut out for long-term branching operations.
SVN was made as an improvement to CVS and it does fix many of its issues relating to atomic operations and source corruption. It is free and open source. It has lots of plugins for different IDEs. However, one of the major drawbacks of this tool is that it is comparatively very slow in its operations.
GIT was made primarily for Linux but it improves operation speed a lot. It works on UNIX systems as well. It has cheap branch operations but it is not totally optimized for a single developer and its Windows support is limited compared to Linux. However, GIT is extremely popular and many prefer GIT to SVN or CVS.
Mercurial came into existence shortly after GIT. It has node-based operations but does not allow the merging of two parent branches.
So to sum up, use SVN if you want a central repository that others can push and pull. Although it has its limitations, it's easy to learn. Use Mercurial or GIT if you want a distributed model. In this case, there is a repository on every computer, and generally, one of them is regarded as the official one. Mercurial is often preferred if it is a relatively small team, and it's easier to learn than GIT.
We will look into these in more detail in a separate chapter.
Tip
Detailed steps to download the code bundle are mentioned in the Preface of this book. Please have a look.
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/C++Game-Development-Cookbook. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!