Book Image

C++ Game Development Cookbook

By : Druhin Mukherjee
Book Image

C++ Game Development Cookbook

By: Druhin Mukherjee

Overview of this book

<p>C++ is one of the preferred languages for game development as it supports a variety of coding styles that provides low-level access to the system. C++ is still used as a preferred game programming language by many as it gives game programmers control of the entire architecture, including memory patterns and usage. However, there is little information available on how to harness the advanced features of C++ to build robust games.</p> <p>This book will teach you techniques to develop logic and game code using C++. The primary goal of this book is to teach you to create high-quality games using C++ game programming scripts and techniques, regardless of the library or game engine you use. It will show you how to make use of the object-oriented capabilities of C++ so you can write well-structured and powerful games of any genre. The book also explores important areas such as physics programming and audio programming, and gives you other useful tips and tricks to improve your code.</p> <p>By the end of this book, you will be competent in game programming using C++, and will be able to develop your own games in C++.</p>
Table of Contents (20 chapters)
C++ Game Development Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

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!