Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Build a 2D & 3D Game Engine with C++20, SFML & OpenGL
Rating: 4.9 out of 5(89 ratings)
873 students

Build a 2D & 3D Game Engine with C++20, SFML & OpenGL

Master C++20, CMake, SFML 3 and OpenGL by building real 2D/3D games and a reusable game engine from scratch.
Created byAdel Hales
Last updated 10/2026
English
English [Auto],

What you'll learn

  • Build your own 2D & 3D game engine with SFML 3 and OpenGL
  • Create complete 2D arcade games step by step using a clean architecture
  • Master essential C++20 features by applying them to real game projects
  • Learn to handle graphics, input, audio, physics, and gameplay systems
  • Understand how to organize a multi-project C++ game development workflow
  • Understand modern 3D rendering with OpenGL and shaders

Coding Exercises

This course includes our updated coding exercises so you can practice your skills as you learn.

See a demo
Image of coding exercise example

Course content

6 sections • 109 lectures • 17h 31m total length
  • Presentation6:39

    Master modern C++ by building a 2D game engine from scratch, learning fundamentals from variables and control flow to object oriented programming, vectors, maps, sets, pointers, and debugging.

  • Presentation - Quiz
  • Introduction6:59

    Explore the birth and evolution of C++ and its powerful, flexible paradigms from imperative to object oriented. Learn about modern standards, cross-platform development, and rich library support.

  • Introduction - Quiz
  • Installation22:26

    Set up Visual Studio Code with a compiler and debugger to write, compile, and run your first C++ hello world program, then use cmake with a Cmakelists.txt for cross-platform builds.

  • Installation - Quiz
  • Variables14:44

    Declare and initialize variables to store data such as a player's name, score, or speed, using int, float, bool, and char types, with clear naming and basic memory awareness.

  • Variables - Quiz
  • Terminal9:22

    Explore how to display messages and read user input using the iostream library, cout and cin, with insertion operators, escape sequences, and comments to create clear, interactive terminal programs.

  • Terminal - Exercises
  • Operators6:39

    Master arithmetic and unary operators in C++ for calculations, including addition, subtraction, multiplication, division, modulo, and increments. Understand precedence and associativity, integer division, and syntactic sugar like the plus-equals shorthand.

  • Operators - Exercises
  • Conditions11:26

    Master conditional logic in modern C++ with if, elsif, else, and switch, using boolean values, comparison and logical operators, and the ternary operator to craft clear, decision-driven code.

  • Conditions - Exercises
  • Loops9:54

    Master loops in C++ by using while, for, and do-while to repeat actions, manage iterations, and handle input, including break and continue, with nested loops and common pitfalls.

  • Loops - Exercises
  • Documentation5:20

    Discover how the C++ standard library speeds development with headers for i/o, containers, memory, and math. Learn to consult cppreference for up-to-date library headers and examples.

  • Project – Number Guesser
  • Arrays11:46

    Learn how Stdarray stores a fixed set of elements, initializes values, uses the fill method, tracks indices safely, and handles 2D arrays for grid-like data.

  • Arrays - Exercises
  • Strings12:09

    Learn to store and manipulate text in C++ using std::string, including initialization, concatenation, input with getline, and common methods for substring, find, replace, and formatting with std::format.

  • Strings - Exercises
  • References6:19

    Learn how references create aliases to variables, demonstrate range-based for loops, and modify or read container elements using references and const references.

  • References - Exercises
  • Functions14:15

    Write reusable functions to organize code, define return types, parameters, and bodies; call functions, pass by value or reference, and use prototypes and scope to manage visibility.

  • Functions - Coding Exercise
  • Structures10:45

    Define and use structures to group related data, initialize members with braces, access via the dot operator, nest structures, and pass or return arrays of structured data in functions.

  • Structures - Exercises
  • Enumerations5:26

    Define and use enumerations to make code expressive and readable, using named values for days, directions, and difficulties, and switch or if statements to handle them.

  • Enumerations - Exercises
  • Classes32:20

    Explore how object oriented programming organizes code into classes with behaviors and encapsulation. Use constructors, destructors, getters and setters, and composition with vector two to model 2d game entities.

  • Classes - Coding Exercise
  • Inheritance15:49

    Demonstrate inheritance in c++ by creating a base class and derived classes such as dog and cat, and warrior and mage, reusing common behavior while adding unique features.

  • Inheritance - Coding Exercise
  • Namespaces7:37

    Organize code with namespaces to prevent name collisions and keep projects modular. Define and access grouped types under graphics and math, use nested namespaces, and balance using directives for clarity.

  • Namespaces - Quiz
  • Vectors11:08

    Explore vectors, a dynamic array in C++ that grows and shrinks at runtime, stores elements of the same type, and demonstrates pushback, emplace back, and memory management.

  • Vectors - Exercises
  • Maps8:07

    Explore how maps store key-value pairs with unique keys using std::map and std::unordered_map, covering creation, access, updates, and common methods for efficient data lookup.

  • Maps - Exercises
  • Pointers5:43

    Master pointers as optional references to objects that may be null, using nullptr, the arrow and dereference operators. Return pointers from functions and safely search a player collection by name.

  • Pointers - Exercises
  • Polymorphism12:33

    Explore polymorphism in modern C++ by storing derived entities in a single base class interface using virtual methods, smart pointers, and abstract classes, enabling unified update and draw operations.

  • Polymorphism - Coding Exercise
  • Iterators7:30

    Learn how iterators move through containers from begin to end, dereference to access elements, and use them with maps and vectors for common operations like find, erase, and insert.

  • Iterators - Quiz
  • Auto4:13

    Understand the auto keyword in modern C++11, which lets the compiler deduce a variable’s type from its initializer, with examples for range-based for loops and iterators.

  • Auto - Quiz
  • Exceptions4:51

    Learn how exceptions signal runtime errors with try and catch blocks and std::exception, but the course avoids them for performance, using return values and error codes.

  • Exceptions - Quiz
  • Debugger11:59

    Use the Visual Studio Code debugger to pause execution, set breakpoints, and inspect variables as you step through code, configuring debugging with CMake, launch.json, and tasks.json.

  • Debugger - Exercise
  • Algorithms9:09

    Explore standard algorithms in the C++ standard library, using ranges and lambdas to search, sort, count, reverse, and transform containers with predicates.

  • Algorithms - Exercises
  • Files6:42

    Learn to read from and write to files, create folders, and add debugging information. Open scores.txt, update player scores, and track changes with a source location header.

  • Files - Exercises
  • Random4:14

    Generate random numbers in modern C++ using a Mersenne Twister engine, seeds, and distributions to drive unpredictable gameplay, from dice rolls to coin flips and deck shuffles.

  • Math4:08

    Master essential c++ math with the smart, numbers, and numeric headers, featuring pi, sqrt, pow, trig, and log, plus algorithms like accumulate, inner_product, clamp, and lerp.

  • Utility8:18

    Learn to use std::optional, std::chrono, and std::variant to write clearer, safer code that handles optional values, measures timing, and stores multiple types in a single variable.

  • Project - Tic Tac Toe
  • Conclusion1:27

    Consolidate your foundation in clean modern c++ code and program structure, then explore sfml 3 to draw shapes, textures, input, and sounds in interactive 2d apps.

  • Modern C++ - Final Quiz

Requirements

  • Any computer running Windows, macOS, or Linux.

Description

Welcome!

In this course, you’ll learn how to build your own 2D and 3D game engine and create games in C++20 with SFML 3 and OpenGL — through a complete, step-by-step journey that makes game development both accessible and exciting.

You don’t need to be an expert to get started. Together, we’ll start simple and gradually move on to more advanced concepts, always by building real projects and seeing the results on screen.

We begin with Modern C++, where you’ll learn the essential features of the language in a practical, game-oriented way. We’ll also use CMake from the very beginning to build and organize our projects. Then we move on to SFML 3, the library we’ll use for graphics, input, audio, and window management.

From there, we’ll build our first game, Bounce, before creating our own 2D game engine — a reusable foundation that powers all the games that follow. We’ll then put the engine into practice by building several complete 2D games, each introducing new gameplay mechanics and programming concepts.

Once the 2D foundation is in place, we’ll take the engine into the third dimension. You’ll discover modern OpenGL and learn the fundamentals of real-time 3D rendering. Instead of starting over, we’ll extend the same engine step by step, turning it into a complete 2D and 3D game engine.

Everything is explained clearly and demonstrated in real time. You’ll understand not only how things work, but also why. Each project is focused and practical, designed to improve both your C++ skills and your confidence as a game developer.

By the end of the course, you’ll have built your own 2D and 3D game engine, created multiple games with it, and gained the knowledge and experience to continue developing your own projects from scratch.

Who this course is for:

  • Beginner to intermediate developers who want to learn modern C++ by creating 2D games
  • Game enthusiasts who want to understand how engines like Unity or Unreal work under the hood
  • Programmers who want to build their own custom 2D & 3D game engine using SFML 3 and OpenGL
  • Anyone passionate about game development and looking for a complete, practical learning path