Skip to main content
CourseFlix

C++ Game Engine Programming

31h 48m 39s
English
Paid

Embark on your journey into the world of game development with our comprehensive course on 2D game engine architecture. This course offers a blend of theoretical knowledge and practical application by guiding you through the creation of a small 2D game engine using modern C++, SDL, and Lua.

Course Overview

We will construct a small ECS (Entity-Component-System) framework from scratch, providing insights into managing entities, components, and systems effectively. Additionally, we will explore how engine developers design and organize game objects in memory while prioritizing performance.

Key Programming Patterns

Throughout the course, several popular programming patterns used in game development will be covered and put into practice, ensuring a solid understanding of game engine architecture.

Tools You Will Need

Equip yourself with the following tools for a comprehensive learning experience:

  • C++: A robust compiled programming language.
  • SDL2: Essential for cross-platform rendering and input.
  • GLM: A library assisting with mathematical calculations.
  • Dear ImGui: Use this for creating intuitive engine tool interfaces.
  • Sol: Facilitates the binding of modern C++ and Lua.
  • Lua: A fast, user-friendly scripting language.

Our focus will be on writing most of our engine code from scratch using these cross-platform libraries and tools, compatible with Windows, macOS, and Linux.

Is This Course Right for You?

Target Audience

This course is designed for beginner programmers eager to learn C++ for game development. Although familiarity with basic coding constructs (if-else, loops, functions, classes) and object-oriented programming is recommended, prior knowledge of C++ is not required.

Required Knowledge

No prior C++ experience is necessary. The course is also suitable for those with experience in Java, Python, Ruby, Go, Swift, JavaScript, and more, welcoming anyone with a foundational understanding of programming.

Course Differences

Unlike other resources that may be overly theoretical or extensive, this course offers a practical approach to game engine programming. You will learn to comprehend the abstraction of games and create a simple engine from scratch in C++, encompassing ECS, data-oriented design, C++ templates, the game loop, SDL rendering, event systems, resource management, memory, and performance.

Additionally, we will explore the integration of Lua into C++ code to enhance our engine with scripting capabilities.

If you seek an introductory yet thorough dive into game engine programming and wish to uncover the inner workings of games, this course is the perfect starting point!

About the Author: Gustavo Pezzi

Gustavo Pezzi thumbnail

Gustavo Pezzi is a UK-based computer-science lecturer (Pikuma) and one of the most distinctive teachers working at the intersection of low-level programming and game development. His material is unusual in the modern course market for how deep it goes into the foundations: assembly, computer architecture, classical raycasting / rasterisation algorithms, and the math underneath modern graphics.

His CourseFlix listing reflects that range: courses on 3D Computer Graphics Programming, Raycasting Engine Programming, 2D Game Physics Programming, NES Programming with 6502 Assembly, PS1 Programming with MIPS Assembly & C, Atari 2600 Programming, Compilers, Interpreters and Formal Languages, plus C++ engine programming and Lua scripting. Material is paid and aimed at developers who want to understand systems from the ground up rather than ship CRUD apps.

Watch Online 149 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 149 lessons in this course and access 10,000+ hours of premium content across all courses.

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

Get instant access to all 148 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription

Course content

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

Related courses

  • Ultimate C++ Part 3: Advanced thumbnailFree

    Ultimate C++ Part 3: Advanced

    Sources: Mosh Hamedani (Code with Mosh)
    To take this course, you should have watched the first two parts or have a thorough understanding of the concepts covered there.
    3 hours 41 minutes 57 seconds 5 / 5
  • Unreal Engine C++ Developer: Learn C++ and Make Video Games thumbnail

    Unreal Engine C++ Developer: Learn C++ and Make Video Games

    Sources: Udemy
    This "critically-acclaimed" and "insanely successful" Unreal Engine course was created in collaboration with Epic Games.
    29 hours 35 minutes 29 seconds
  • Ultimate C++ Part 1: Fundamentals thumbnail

    Ultimate C++ Part 1: Fundamentals

    Sources: Mosh Hamedani (Code with Mosh)
    Master C++ fundamentals with Mosh Hamedani's course. Ideal for video games, IoT devices, and more. Enhance your coding skills with real-world examples.
    3 hours 52 minutes 48 seconds 5 / 5

Frequently asked questions

What is C++ Game Engine Programming about?
Embark on your journey into the world of game development with our comprehensive course on 2D game engine architecture. This course offers a blend of theoretical knowledge and practical application by guiding you through the creation of a…
Who teaches C++ Game Engine Programming?
C++ Game Engine Programming is taught by Gustavo Pezzi. You can find more courses by this instructor on the corresponding source page.
How long is C++ Game Engine Programming?
C++ Game Engine Programming contains 149 lessons with a total runtime of 31 hours 48 minutes. All lessons are available to watch online at your own pace.
Is C++ Game Engine Programming free to watch?
C++ Game Engine Programming is part of CourseFlix's premium catalog. A CourseFlix subscription unlocks the full video player; the course description, table of contents, and preview information are available to everyone.
Where can I watch C++ Game Engine Programming online?
C++ Game Engine Programming is available to watch online on CourseFlix at https://courseflix.net/course/c-game-engine-programming. The page hosts every lesson with the integrated video player; no download is required.