Dunsky | Mastering C++ Game Animation Programming | E-Book | www2.sack.de
E-Book

E-Book, Englisch, 544 Seiten

Dunsky Mastering C++ Game Animation Programming

Enhance your skills with advanced game animation techniques in C++, OpenGL, and Vulkan
1. Auflage 2025
ISBN: 978-1-83588-193-4
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection

Enhance your skills with advanced game animation techniques in C++, OpenGL, and Vulkan

E-Book, Englisch, 544 Seiten

ISBN: 978-1-83588-193-4
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection



With two decades of programming experience across multiple languages and platforms, expert game developer and console porting programmer Michael Dunsky guides you through the intricacies of character animation programming. This book tackles the common challenges developers face in creating sophisticated, efficient, and visually appealing character animations.
You'll learn how to leverage the Open Asset Import Library for easy 3D model loading and optimize your 3D engine by offloading computations from the CPU to the GPU. The book covers visual selection, extended camera handling, and separating your application into edit and simulation modes. You'll also master configuration storage to progressively build your virtual world piece by piece.
As you develop your engine-like application, you'll implement collision detection, inverse kinematics, and expert techniques to bring your characters to life with realistic visuals and fluid movement. For more advanced animation and character behavior controls, you'll design truly immersive and responsive NPCs, load real game maps, and use navigation algorithms, enabling the instances to roam freely in complex environments.
By the end of this book, you'll be skilled at designing interactive virtual worlds inhabited by lifelike NPCs that exhibit natural, context-aware behaviors.

Dunsky Mastering C++ Game Animation Programming jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


Preface


Have you ever caught yourself watching your player character and the enemies in a first- or third-person game running and jumping around, firing and dodging, as you’re pressing buttons and shooting at targets, and asked yourself:

To answer these questions, you would need to start up a modern 3D engine such as Unreal Engine, Unity, or Godot. You would play around with models and animations, levels, assets, menus, and other objects. By working your way through tutorials and videos, you would learn how to build a world similar to the game you love and be happy with what you have achieved.

But what if your hunger for the low-level details, for the implementation of several features, remains? Even after moving from visual programming to the underlying programming languages of the 3D engine, you are still not satisfied. The complexity of the code is way too heavy to learn just the basics from it. So, you are again on the road, searching for answers to those questions...

Does that sound familiar to you? Many game programmers start off with this kind of curiosity, a will to look “under the hood” of the things they see, and an urge to understand how models are animated and animations are blended. This might be how facial animations work or a simple “nodding” of the head is done, or how to make characters walk and run on the ground polygons of the level but not clip through walls.

This book aims to answer your questions about the implementation details of 3D game character animations. You will start off with nothing more than a basic OpenGL or Vulkan renderer to draw triangles to the screen – and then you will be guided all the way up the hill, from loading a single character model from a file to multiple instances of different models roaming around a game map, detecting and avoiding walls and other instances in the virtual world, following predefined paths, and being able to interact with another instance.

With the knowledge gained from this book, you will see the animations in games with a different pair of eyes, smiling a lot because you know how they’re made.

Who this book is for


If you are already familiar with C++ and character animations but want to learn more about the implementation details and advanced character animation topics, similar to the animations found in 3D games, this book is for you.

What this book covers


, , gives an overview of the data structures of Open Asset Import Library (or assimp) and explains how to load a character model from a file. The fileloading process will be enhanced by adding an ImGui-based Open File dialog. In addition, code to add and remove model and instances at runtime will be covered.

, , introduces compute shaders to offload calculations to the graphics processor and store lookup data in GPU memory. By using the massively parallel architecture of the GPU, computing the node positions of all instances will be accelerated, and the CPU will be free again for other tasks.

, , explains how to support the user of the application in the task of character instance selection. As well as highlighting the currently selected instance on the screen, the ability to select any instance by using the mouse will be added.

, , introduces a separation of the application into a view mode and an edit mode with partially different configurations. Also, undo and redo operations will be implemented.

, , covers storing the current configuration of the application plus the loaded models and created instances in a YAML file, as well as loading the configuration from a file back into the application.

, , shows how different camera types and configurations can be added. The new camera settings include orthogonal projection and first-person and third-person views.

, , covers basic animation blending, action states, and linking the action states with the animation clips. By the end of the chapter, you will be able to control the instances using the keyboard and mouse, including additional actions such as jumping, rolling, or waving.

, , explains the path to instance/instance collision detection and the reaction to collisions, based on a quadtree, axis-aligned bounding boxes, and bounding spheres.

, , adds a node-based graphical editor to control instance behavior by creating and connecting simple nodes. The nodes will be extended to cover a configurable interaction between instances.

, , introduces face animations to express emotions and additive animation blending to move the head independently of the rest of the character model’s body.

, , explains the differences between the dynamic character model instances and static level geometry, and how to load and process level data to achieve a good performance.

, , extends collision detection to the level geometry added in . Simple gravity will be added to keep the model instances on the level floor, and you will see how to avoid instance collisions with walls.

, , covers path-finding and navigation inside the loaded game map. A well-known path-finding algorithm will be used to let the instances roam around freely in the level.

, , gives tips and resources on how to add more cool features to the character model editor, advancing the code step by step to a simple game engine.

To get the most out of this book


To get the most out of this book, you should have at least intermediate-level experience in C++ and knowledge about vector/matrix mathematics, as well as understanding the basics of skeletal animation. Any special or advanced features will be explained, and sources to learn more about these features are included in the chapters of their first usage. But you should be able to debug simple C++ problems by yourself (i.e., by using logging statements, or by attaching a debugger to the application).

The code is written for OpenGL 4.6 Core and Vulkan 1.1+. Both graphics APIs are widely supported in modern GPUs. The oldest graphics cards known to work with these API versions are the Intel HD 4000 series, made about 10 years ago.

Software covered in the book

OS requirements

OpenGL 4.6 and Vulkan 1.1+

Windows or Linux

C++17 and above (upto C++26)

The example code presented in the book should compile on any desktop computer or laptop running a recent version of Windows and Linux. The code has been tested with the following combinations:

  • Windows 10 with Visual Studio 2022
  • Windows 10 with Eclipse 2024-09, using GCC from MSYS2
  • Ubuntu 24.04 LTS with Eclipse 2024-09, using GCC or Clang
  • Ubuntu 24.04 LTS, compiling on the command line, using GCC or Clang

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.

The full source code for the examples is available from the book’s GitHub repository (a link is available in the next section). The chapters in the book contain only excerpts from the code, covering the important parts.

Download the example code files


You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Mastering-Cpp-Game-Animation-Programming. If there’s an update to the code, it will be updated in the GitHub repository.

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/9781835881927.

Conventions used


There are a number of text conventions used throughout this book:

: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user...


Dunsky Michael :

Michael Dunsky is an electronics engineer, console porting programmer, and game developer with more than 20 years of programming experience. He started with BASIC at the young age of 14 and expanded his portfolio over the years to include assembly language, C, C++, Java, Python, VHDL, OpenGL, GLSL, and Vulkan. During his career, he also gained extensive knowledge of Linux, virtual machines, server operation, and infra-structure automation. Michael holds a Master of Science degree in Computer Sci-ence from the FernUniversität in Hagen with a focus on computer graphics, parallel programming, and software systems.



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.