This course includes:

(updated Jan 2021)

  • 30 hours of on-demand video

  • Downloadable resources and exercises

  • Lifetime access

  • Access on mobile and desktop

  • Certificate of completion

  • 14-day money back guarantee

  • Secure checkout through Credit Card or PayPal

Watch Intro Video

Course Introduction & Learning Outcomes

What you'll learn

These are the topics you'll learn in this course

  • Modern C++

  • SDL for rendering and input

  • Create a small ECS framework to manage game objects

  • Fixed time step game loop

  • Logger

  • Event System

  • Systems for animation, collision, movement, text rendering, projectiles, health, and many more

  • Data-oriented design algorithms and data structures

  • Learn how Dear ImGui is used to create UI tools

  • Learn to embed Lua with C++ and expose scripting power to your engine

Prerequisites

Before taking this course, you must have:

  • An intermediate knowledge of coding (variables, if-else, loops, functions, OOP)

  • Some experience with either Linux, Windows, or macOS

Is this course for you?

If you already know how to code but always wanted to learn C++ and how game engines work under the hood, then this course is for you. We'll start from scratch and create a minimal but functional 2D game engine while learning a large number of important computer science concepts.
Buy $39.99
Is this course for you?

Technologies we'll use and learn

Languages, libraries, and frameworks

In this course we'll use the following technologies:

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


ECS

Entity-Component-System

We'll create a small data-oriented ECS framework to manage our game objects in memory while keeping an eye on performance.

Lua Scripting

Learn to embed Lua in your game engine

We'll expose the power of the Lua programming language in our game engine. You'll learn how to use a powerful library called Sol to bind Lua with modern C++. Lua will allow us to customize game objects and script behavior, such as movement, velocity, animation, and much more.

  • Lifetime access

    Join our community and get lifetime access to the course content

  • Access to discussion forum

    Discuss course topics and engage with other students using the discussion board

  • Money back guarantee

    We offer a 14-day money back guarantee for all our courses. No questions asked.

Course Content

  • 1
    Introduction
  • 2
    Libraries & Dependencies
  • 3
    Displaying the Game Window
    • Game Loop
    • Game Class
    • Creating an SDL Window
    • Polling SDL Events
    • Rendering our SDL Window
    • Fullscreen Window
    • Fake Fullscreen vs. Real Fullscreen
  • 4
    Rendering SDL Objects
    • Drawing an SDL Rectangle
    • Double-Buffered Renderer
    • Loading PNG Textures
    • Quiz: Game Loop & SDL Window
  • 5
    Fixing the Game Time Step
    • Object Movement & Velocity Vectors
    • Capping the Game Framerate
    • SDL Delay
    • Delta Time
    • Uncapped Framerate
    • SDL Delay Accuracy
    • Quiz: Fixed Time Step
    • What About Determinism?
  • 6
    Logger
    • Logger Class
    • Exercise: Logging Game Info
    • Logger Class Implementation
    • Popular Logging Libraries
    • Quiz: Logger
  • 7
    Files & Folder Structure
    • Source Subfolders
    • Makefile Variables
  • 8
    Organizing Game Objects
    • Creating C++ Objects
    • Examples of C++ Object Creation
    • Organizing Game Objects
    • Object Inheritance Design
    • Quiz: C++ Objects
  • 9
    ECS Design
    • Component-Based Design
    • Entity-Component-System Design
    • ECS Folder Structure
    • System Component Signature
    • Working with C++ Templates
    • Component Type Template
    • Understanding Component
    • Just a Generic Cup
    • Exercise: System Functions
    • Adding & Removing Entities from Systems
    • The Erase-Remove Idiom
    • Operator Overloading for Entities
    • Quiz: ECS Design
  • 10
    ECS Implementation
    • Component Pool
    • The Pool Class
    • Implementing the Pool Class
    • Registry Systems & Entity Signatures
    • Entity Creation & Management
    • Function Templates to Manage Components
    • Adding Components
    • Function to Add Components
    • Function to Remove Components
    • Templates as Placeholders
    • Implementing System Functions
    • Quiz: ECS Implementation
  • 11
    Creating Entities & Components
    • Creating our First Entity
    • Smart Pointers
    • Converting ECS Code to Smart Pointers
    • SDL Raw Pointers
    • Quiz: Smart Pointers
    • Adding our First Components
    • Warnings Between Int and Size_t
    • Exercise: Entity Class Managing Components
    • Entity Class Managing Components
    • A Warning About Cyclic Dependencies
  • 12
    Creating Systems
    • Movement System
    • Movement System & Delta Time
    • Render System
  • 13
    Managing Assets
    • Managing Game Assets
    • The Asset Store
    • Displaying Textures in our Render System
    • Exercise: Displaying the Tilemap
    • Displaying the Tilemap
    • Rendering Order
    • Sorting Sprites by Z-Index
  • 14
    Animation System
    • Animated Sprites
    • Animation System
    • Identifying Animations by Name
  • 15
    Collision System
    • Entity Collision Check
    • Implementing the Collision System
    • Exercise: Render Collider Rectangle
    • Render Collider Rectangle
    • Quiz: Collision in 2D
  • 16
    Killing Entities
    • Killing Entities & Re-Using IDs
    • Implementing Entity Removal
  • 17
    Event System
    • Introduction to Event Systems
    • Event System Design Options
    • Bat Signal Event
    • Starting to Code the Event System
    • Event Handlers
    • Emitting Events & Subscribing to Events
    • Exercise: Key Pressed Event
    • Implementing the Key Pressed Event
    • Event System Design Patterns
    • Quiz: Event System
  • 18
    Other Useful Components & Systems
    • Keyboard Control System
    • Camera Follow System
    • Sprites with Fixed Position
    • Camera Movement for Colliders
    • Projectile Emitter Component
    • Projectile Texture Inspiration
    • Health Component
    • Projectile Duration
    • Exercise: Shooting Projectiles
    • Shooting Projectiles
    • A Quick Reflection on DRY Code
  • 19
    Tagging & Grouping Entities
    • Tags & Groups
    • Optimizing Access of Tags & Groups
    • Implementing Tags & Groups
    • Projectiles Colliding with Player
    • Projectiles Colliding with Enemies
    • Error Checking and Validation
    • Comparisons using Strings
    • Compilation Time
  • 20
    Data-Oriented Design
    • Data-Oriented Design
    • Avoiding Data Gaps
    • Packed Pool of Components
    • Coding Packed Pools of Data
    • Checking for Null Pool
    • Array of Structs vs. Struct of Arrays
    • Cache Profiling with Valgrind
    • Popular ECS Libraries
  • 21
    Displaying True-Type Fonts
    • Adding Fonts to the Asset Store
    • Render Text System
    • Exercise: Display Health Values
    • Rendering Health Values
  • 22
    Dear ImGui
    • Introduction to Dear ImGui
    • Dear ImGui Demo Window
    • Immediate-Mode GUI Paradigm
    • Render GUI System
    • Button to Spawn Enemies
    • Exercise: Customizing New Enemy
    • Custom Enemy Values with ImGui
  • 23
    Culling & Map Control
    • Killing Entities Outside Map Limits
    • Flipping Sprites on Collision
    • Invisible Entities & Obstacles
    • Careful when Flipping Sprites
    • Exercise: Keep Player Inside the Map
    • Keeping the Player Inside the Map
    • Culling Sprites Outside Camera View
    • Do Not Cull Fixed Sprites
    • Allowing a Margin Around the Map
    • Enabling VSync
  • 24
    Lua Scripting
    • Game Scripting
    • The Lua Scripting Language
    • Lua State
    • Reading Lua Tables
    • Fetching Missing Table Values with Sol
    • Lua Functions
    • Level Loader Class
    • Reading Assets from a Lua Table
    • Reading Entities from a Lua Table
    • Handling Multiple Objects in a Lua Level
    • Scripting Night-Day Tilemap
    • Scripting Entity Behavior with Lua
    • Script System
    • Lua Bindings
    • Binding Multiple Lua Functions
    • Loading Different Lua Levels
    • Division of C++ & Lua Code
  • 25
    Next Steps
    • Next Steps
  • 26
    Bonus: The Map Editor
    • Final Project: Creating a Tilemap Editor
  • 27
    Moving Forward
    • Copyright & Content Distribution
    • Similar Courses

FAQ

  • Will this course work for any operating system?

    The code we'll create works for Linux, Windows, Unix (BSD), macOS, and even RaspberryPi.

  • What if I don't know C++?

    Not a problem. Many students come from different languages, like Python, C#, JavaScript, etc. An intermediate knowledge of programming in any language is enough for you to follow along. We'll learn the ins and outs of C++ together.

  • What if I have any issues or questions?

    Each lecture has a discussion board, where you can ask other students for help. You will also be able to engage with others by answering their questions.

Instructor

  • Gustavo Pezzi

    Senior Lecturer

    Gustavo Pezzi

    Gustavo teaches computer science and mathematics at BPP University, London. He studies how teaching game programming can help enhance awareness and understanding of basic mathematics and physics. He is also a professional programmer with several years of experience in the computing industry. His academic path includes institutions such as Pittsburg State University, City University of London, and University of Oxford.