To get the most out of this book
To get the most out of this book, you should have a solid foundation in C++ programming, including an understanding of Object-Oriented Programming (OOP) and data structures. Familiarity with game-related concepts and knowledge, such as rendering, animation, physics, and frame rate management, will also be beneficial in understanding the practical applications of the algorithms introduced. While this book avoids overly complex modern C++ features, a basic grasp of C++ syntax and programming logic is essential for following along with the examples.
The following table outlines the software and hardware requirements for this book:
Software/hardware covered in the book |
Operating system requirements |
---|---|
Microsoft Visual Studio 2002 with the C++ compiler |
Microsoft Windows 10 and up |
If you run the samples on systems other than Windows, such as macOS, you will need to manually set up the project and copy the source code into the project.
If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.
Note that the authors acknowledge the use of cutting-edge AI, such as ChatGPT, with the sole aim of enhancing the language and clarity within the book, thereby ensuring a smooth reading experience for readers. It’s important to note that the content itself has been crafted by the authors and edited by a professional publishing team.
Download the example code files
The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Practical-C-Game-Programming-with-Data-Structures-and-Algorithms. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781835889862.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “ However, when we assign CameraMode
as CAMERA_FIRST_PERSON
and add it to the scene, Knight will activate first-person mode and enable input control for first-person mode.”
A block of code is set as follows:
OrthogonalCamera* OrthCam = NULL;
OrthCam = _Scene->CreateSceneObject<OrthogonalCamera>("Orthogonal Camera");
OrthCam->SetUp(Vector3{ 0.0f, 15.0f, 15.0f }, Vector3{ 0.0f, 0.0f, 0.0f }, 20.0f);
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
//Push the sample data into the dataset
sampleData.clear();
sampleData.push_back(inputs[0]);
sampleData.push_back(inputs[1]);
sampleData.push_back(targets[0]);
sampleData.push_back(targets[1]);
dataset.push_back(sampleData);
Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “ When installing VS2022, make sure to enable the Desktop development with C++ module to install the C++ compiler together with the IDE.”
Warnings or important notes appear like this.
Tips and tricks appear like this.
Further, to maintain consistency and minimize confusion, the C++ sample code in this book primarily follows the Visual Studio C++ coding preferences. For detailed guidelines, you can refer to the official documentation at https://learn.microsoft.com/en-us/cpp/ide/how-to-set-preferences?view=msvc-170.
Additionally, some special coding conventions used in the sample code are inspired by OpenStack’s C++ Coding Standards. You can find more details in their documentation at https://wiki.openstack.org/wiki/CppCodingStandards#:~:text=Private%20member%20data%20variables%20should,all%20lowercase%20with%20underscore%20separation.
In certain cases, exceptions may be made for compact expressions that enhance readability and fit within the page layout constraints, ensuring clarity without compromising comprehension.