C++ Game Engine Programming

C++ Game Engine Programming

English | MP4 | AVC 1920×1080 | AAC 44KHz 2ch | 149 Lessons (31h 48m) | 7.10 GB

Learn the fundamentals of 2D game engine development and create a simple game engine using C++ SDL and Lua scripting

This course is a gentle and comprehensive introduction to the fundamentals of 2D game engine architecture. We’ll discuss several of the most popular programming patterns used in game development and try to put all the theory we learn into context by coding a small 2D game engine using modern C++, SDL, and Lua.

We will write, together, a small ECS framework from scratch to manage our entities, components, and systems. We will discuss how engine programmers design their code and how we should think of organizing game objects in memory with performance in mind.

The tools you’ll need

  • C++ is a powerful compiled language
  • SDL2 is a library for cross-platform rendering and input
  • GLM is a math helper library
  • Dear ImGui is a library to create UI for engine tooling
  • Sol is a binding library for modern C++ & Lua
  • Lua is fast and easy to use scripting language

We’ll try to write most of our engine code from scratch. All these libraries and tools are cross-platform, so you’ll be able to code along with either Windows, macOS, or Linux!

Is this course for you?
The target audience for this course are beginner programmers that wish to learn more about how C++ works in the context of game development. Therefore, students must already know how to code and be familiar with basic concepts of programming and logic. You should be able to write if-else statements, loops, functions, and classes using simple OOP.

You do not need to know C++ before enrolling; many successful students have a background in web, mobile, and game development, working with languages like Java, Python, Ruby, Go, Swift, JavaScript, Ada, Zig, Kotlin, and many others.

How is this course different?
This course is not just a simple tutorial on how to create a game with C++. This is the opportunity for you to think about the abstraction of what a “game” really is and all the pieces that need to interact to make them happen. More than that, this course allows you to write from scratch the code of a small C++ engine that can be used to create many types of games.

We will also touch other important topics like ECS, data-oriented design, STL containers, C++ templates, game loop, SDL rendering, event systems, asset management, memory management, and performance. And finally, we’ll also learn how to embed the Lua language into our native C++ code to add scripting power to our engine.

While there are other resources about game engine development out there, they are either too theoretical or overwhelmingly long. If you are looking for a gentle introduction to the world of game engine programming and want to learn how games really work under the hood, then you should definitely take this course!

Table of Contents

1 Motivations & Learning Outcomes
2 How to Take this Course
3 Project Technologies & Libraries
4 Linux Dependencies
5 macOS Dependencies
6 A Small Note for Windows Programmers
7 Compilation
8 Header & Implementation Files
9 Linking
10 Makefile
11 Lua Version & Lua Header Files
12 Compiling & Testing All Dependencies
13 Configuring Visual Studio on Windows
14 Library Binaries
15 Game Loop
16 Game Class
17 Creating an SDL Window
18 Polling SDL Events
19 Rendering our SDL Window
20 Fullscreen Window
21 Fake Fullscreen vs. Real Fullscreen
22 Drawing an SDL Rectangle
23 Double-Buffered Renderer
24 Loading PNG Textures
25 Object Movement & Velocity Vectors
26 Capping the Game Framerate
27 SDL Delay
28 Delta Time
29 Uncapped Framerate
30 Logger Class
31 Logger Class Implementation
32 Popular Logging Libraries
33 Source Subfolders
34 Makefile Variables
35 Creating C++ Objects
36 Examples of C++ Object Creation
37 Organizing Game Objects
38 Object Inheritance Design
39 Component-Based Design
40 Entity-Component-System Design
41 ECS Folder Structure
42 System Component Signature
43 Working with C++ Templates
44 Component Type Template
45 Exercise System Functions
46 Adding & Removing Entities from Systems
47 Operator Overloading for Entities
48 Component Pool
49 The Pool Class
50 Implementing the Pool Class
51 Registry Systems & Entity Signatures
52 Entity Creation & Management
53 Function Templates to Manage Components
54 Adding Components
55 Function to Add Components
56 Function to Remove Components
57 Templates as Placeholders
58 Implementing System Functions
59 Creating our First Entity
60 Smart Pointers
61 Converting ECS Code to Smart Pointers
62 SDL Raw Pointers
63 Adding our First Components
64 Exercise Entity Class Managing Components
65 Entity Class Managing Components
66 A Warning About Cyclic Dependenciesb
67 Movement System
68 Movement System & Delta Time
69 Render System
70 Managing Game Assets
71 The Asset Store
72 Displaying Textures in our Render System
73 Exercise Displaying the Tilemap
74 Displaying the Tilemap
75 Rendering Order
76 Sorting Sprites by Z-Index
77 Animated Sprites
78 Animation System
79 Entity Collision Check
80 Implementing the Collision System
81 Exercise Render Collider Rectangle
82 Render Collider Rectangle
83 Killing Entities & Re-Using IDs
84 Implementing Entity Removal
85 Introduction to Event Systems
86 Event System Design Options
87 Starting to Code the Event System
88 Event Handlers
89 Emitting Events & Subscribing to Events
90 Exercise Key Pressed Event
91 Implementing the Key Pressed Event
92 Event System Design Patterns
93 Keyboard Control System
94 Camera Follow System
95 Sprites with Fixed Position
96 Camera Movement for Colliders
97 Projectile Emitter Component
98 Health Component
99 Projectile Duration
100 Exercise Shooting Projectiles
101 Shooting Projectiles
102 Tags & Groups
103 Optimizing Access of Tags & Groups
104 Implementing Tags & Groups
105 Projectiles Colliding with Player
106 Projectiles Colliding with Enemies
107 Error Checking and Validation
108 Data-Oriented Design
109 Avoiding Data Gaps
110 Packed Pool of Components
111 Coding Packed Pools of Data
112 Checking for Null Pool
113 Array of Structs vs. Struct of Arrays
114 Cache Profiling with Valgrind
115 Popular ECS Libraries
116 Adding Fonts to the Asset Store
117 Render Text System
118 Exercise Display Health Values
119 Rendering Health Values
120 Introduction to Dear ImGui
121 Dear ImGui Demo Window
122 Immediate-Mode GUI Paradigm
123 Render GUI System
124 Button to Spawn Enemies
125 Exercise Customizing New Enemy
126 Custom Enemy Values with ImGui
127 Killing Entities Outside Map Limits
128 Flipping Sprites on Collision
129 Exercise Keep Player Inside the Map
130 Keeping the Player Inside the Map
131 Culling Sprites Outside Camera View
132 Do Not Cull Fixed Sprites
133 Game Scripting
134 The Lua Scripting Language
135 Lua State
136 Reading Lua Tables
137 Lua Functions
138 Level Loader Class
139 Reading Assets from a Lua Table
140 Reading Entities from a Lua Table
141 Handling Multiple Objects in a Lua Level
142 Scripting Night-Day Tilemap
143 Scripting Entity Behavior with Lua
144 Script System
145 Lua Bindings
146 Binding Multiple Lua Functions
147 Loading Different Lua Levels
148 Division of C++ & Lua Code
149 Next Steps

Homepage