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

Build Your Own 2D Game Engine in C++20 with SFML 3

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

What you'll learn

  • Build your own 2D game engine from scratch in Modern C++ with SFML 3
  • 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
  • Extend your engine with custom systems, tools, and gameplay mechanics

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

5 sections104 lectures15h 50m 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
  • 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
  • Operators - Exercises
  • Conditions11:26
  • 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
  • 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
  • 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
  • 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
  • Project - Tic Tac Toe
  • Conclusion1:27
  • Modern C++ - Final Quiz

Requirements

  • Any computer running Windows, macOS, or Linux.

Description

Welcome!

In this course, you’ll learn how to create your own 2D games in C++20 with SFML 3 — 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.

The course is divided into five main sections. 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 that handles all the visuals, input, and audio. After that, we’ll build our first game, Bounce, before creating our own 2D engine — the reusable foundation that powers all future projects. Finally, we’ll reach the Games section, where we’ll build new games every week, each one introducing new gameplay mechanics.

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

By the end of the course, you’ll have the knowledge, the tools, and the experience to keep creating your own games from scratch — and have a lot of fun doing it.

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 game engine using SFML 3
  • Anyone passionate about game development and looking for a complete, practical learning path