C++ Game Development By Example: Learn to build games and graphics with SFML, OpenGL, and Vulkan using C++ programming
- Length: 420 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2019-05-03
- ISBN-10: 1789535301
- ISBN-13: 9781789535303
- Sales Rank: #1637780 (See Top 100 Books)
Explore modern game programming and rendering techniques to build games using C++ programming language and its popular libraries
Key Features
- Learn how you can build basic 2D and complex 3D games with C++
- Understand shadows, texturing, lighting, and rendering in 3D game development using OpenGL
- Uncover modern graphics programming techniques and GPU compute methods using the Vulkan API
Book Description
Although numerous languages are currently being used to develop games, C++ remains the standard for fabricating expert libraries and tool chains for game development. This book introduces you to the world of game development with C++.
C++ Game Development By Example starts by touching upon the basic concepts of math, programming, and computer graphics and creating a simple side-scrolling action 2D game. You’ll build a solid foundation by studying basic game concepts such as creating game loops, rendering 2D game scenes using SFML, 2D sprite creation and animation, and collision detection. The book will help you advance to creating a 3D physics puzzle game using modern OpenGL and the Bullet physics engine. You’ll understand the graphics pipeline, which entails creating 3D objects using vertex and index buffers and rendering them to the scene using vertex and fragment shaders. Finally, you’ll create a basic project using the Vulkan library that’ll help you get to grips with creating swap chains, image views, render passes, and frame buffers for building high-performance graphics in your games.
By the end of this book, you’ll be ready with 3 compelling projects created with SFML, the Vulkan API, and OpenGL, and you’ll be able take your game and graphics programming skills to the next level.
What you will learn
- Understand shaders and how to write a basic vertex and fragment shader
- Build a Visual Studio project and add SFML to it
- Discover how to create sprite animations and a game character class
- Add sound effects and background music to your game
- Grasp how to integrate Vulkan into Visual Studio
- Create shaders and convert them to the SPIR-V binary format
Who this book is for
If you’re a developer keen to learn game development with C++ or get up to date with game development, this book is for you. Some knowledge of C++ programming is assumed.
Table of Contents
- C++ Concepts
- Mathematics and Graphics Concepts
- Setting Up Your Game
- Creating your game
- Finalizing your Game
- Getting started with OpenGL
- Building on the game objects
- Enhancing your game with Collision, loop, and Lighting
- Getting started with Vulkan
- Preparing the Clear Screen
- Creating Object Resources
- Drawing Vulkan Objects
Title Page Copyright and Credits C++ Game Development By Example Dedication About Packt Why subscribe? Contributors About the author About the reviewers Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Get in touch Reviews Section 1: Basic Concepts C++ Concepts Program basics Variables Strings Operators Statements Iteration Jump statements Switch statement Functions Scope of variables Arrays Pointers Structs Enums Classes Inheritance Summary Mathematics and Graphics Concepts 3D coordinate systems Points Vectors Vector operations Vector magnitude Unit vectors The dot product The cross product Matrices Matrix addition and subtraction Matrix multiplication Identity matrix Matrix transpose Matrix inverse GLM OpenGL mathematics OpenGL data types Space transformations Local/object space World space View space Projection space Screen space Render pipeline Vertex specification Vertex shader Vertex post-processing Primitive assembly Rasterization Fragment shader Per-sample operation Framebuffer Summary Section 2: SFML 2D Game Development Setting Up Your Game An overview of SFML Downloading SFML and configuring Visual Studio Creating a window Drawing shapes Adding sprites Keyboard input Handing player movement Summary Creating Your Game Starting afresh Creating the Hero class Creating the Enemy class Adding enemies Creating the Rocket class Adding rockets Collision detection Summary Finalizing Your Game Finishing the Gameloop and adding scoring Adding text Adding audio Adding player animations Summary Section 3: Modern OpenGL 3D Game Development Getting Started with OpenGL What is OpenGL? Creating our first OpenGL project Creating a window and ClearScreen Creating a Mesh class Creating a Camera class The ShaderLoader class The Light Renderer class Drawing the object Summary Building on the Game Objects Creating the MeshRenderer class Creating the TextureLoader class Adding Bullet Physics Adding rigid bodies Summary Enhancing Your Game with Collision, Loops, and Lighting Adding a RigidBody name Adding an enemy Moving the enemy Checking collision Adding keyboard controls Game loop and scoring Text rendering Adding lighting Summary Section 4: Rendering 3D Objects with Vulkan Getting Started with Vulkan About Vulkan Configuring Visual Studio Vulkan validation layers and extensions Vulkan instances The Vulkan Context class Creating the window surface Picking a physical device and creating a logical device Summary Preparing the Clear Screen Creating SwapChain Creating Renderpass Using render targets and framebuffers Creating CommandBuffer Beginning and ending Renderpass Creating the clear screen Summary Creating Object Resources Updating the Mesh class for Vulkan Creating the ObjectBuffers class Creating the Descriptor class Creating the SPIR-V shader binary Summary Drawing Vulkan Objects Preparing the GraphicsPipeline class ShaderStageCreateInfo VertexInputStateCreateInfo InputAssemblyStateCreateInfo RasterizationStateCreateInfo MultisampleStateCreateInfo Depth and stencil create info ColorBlendStateCreateInfo Dynamic state info ViewportStateCreateInfo GraphicsPipelineCreateInfo The ObjectRenderer class Changes to the VulkanContext class The Camera class Drawing the object Synchronizing the object Summary Further Reading Other Books You May Enjoy Leave a review - let other readers know what you think
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: C++ Game Development By Example: Learn to build games and graphics with SFML, OpenGL, and Vulkan using C++ programming
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.