Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Introduction to C++ for Game Developers
Rating: 4.5 out of 5(8 ratings)
134 students

Introduction to C++ for Game Developers

Build a 2D Game Engine from Scratch: Master C++ Fundamentals, OOP, and Modern Engine Architecture with SFML 3 and CMake.
Created byJoshua Kinney
Last updated 12/2025
English

What you'll learn

  • Understand and correctly implement C++ variable declarations, common data types (including arrays, vectors, and maps), and I/O operations.
  • Use if/else statements, switch statements, and various loop structures (for, while, do-while) for game logic and iterative tasks.
  • Define, call, and manage functions, including the use of multiple parameters, returning values, and effectively employing enum types.
  • Explain the difference between Stack and Heap memory and the importance of manual memory deallocation on the Heap.
  • Use memory references (&) and raw pointers (*) to access memory addresses and pass variables to functions by reference for efficient modification.
  • Implement smart pointers to automatically manage memory and prevent common issues like memory leaks and cycling references.
  • Create effective C++ classes using member functions, class constructors, and class destructors to represent game objects and systems.
  • Utilize access specifiers (public, private, protected) to properly encapsulate data and functionality.
  • Implement core OOP principles, including inheritance, polymorphism, operator overloading, and manage the "Big Five".
  • Install and set up a C++ Integrated Development Environment (IDE) like Visual Studio or CLion.
  • Understand the C++ build stages (Preprocessor, Compilation, Assembly, Linking, Execution) and organize code using header files and forward declarations.
  • Use a build system (e.g., CMake) to create and link static and shared libraries, and integrate external libraries (like SFML) into a C++ project.
  • Set up the fundamental Application and World classes to create a basic game engine loop and project structure.
  • Define and integrate the Object class, along with key game systems such as Physics, Damage and Health, and an Asset Manager for loading resources.
  • Program enemy behavior (like chasing), manage collision, apply damage to player and enemy ships, and implement weapon upgrade mechanics.
  • Develop an in-game Head-Up Display (HUD) and User Interface (UI) elements, including kill counts, a health bar, and a game over screen.
  • Apply debugging techniques to fix common issues , implement a Sound System for background music and effects, and add visual polish.

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

11 sections231 lectures20h 58m total length
  • Introduction1:56
  • Installing Visual Studio2:59
  • Creating Visual Studio Projects2:07
  • Visual Studio Interface Overview3:10
  • Creating New C++ Source Files2:44
  • Installing CLion3:25
  • Creating CLion Projects4:57

    Create a new CLion C++ executable, explore CMake and MinGW defaults, view the hello world boilerplate, and compare Visual Studio workflow.

  • Project Configuration and Customizing the IDE3:07

    Modify your ide to improve readability by increasing the interface and font size in sea lion with alt shift plus, and set c++17 as the language standard in visual studio.

  • Declaring and Using Variables4:07
  • Exploring Common Data Types2:55

    Explore common data types in C++ including integers, floats, doubles, characters, booleans, and strings, and learn how to declare, output, and transform these values, including true/false and case distinctions.

  • Commenting Code3:20

    Learn to use comments in code, including single-line and multi-line formats, for debugging and task lists, and emphasize readable, self-explanatory code that speaks for itself.

  • Formatting Outputs3:19
  • Creative Output
  • Challenge Review: Creative Output6:27
  • Declaring and Initializing Arrays2:18
  • Accessing Data in Arrays3:32
  • Modifying Arrays1:54
  • Calculating the Size of Arrays5:57
  • Adventures with Arrays
  • Challenge Review: Adventures with Arrays5:15

    Practice building a game character in c++ by defining name, class, and gold, managing a five-item string inventory (bow, arrows, health potion, map, torch), and displaying with zero-based indexing.

  • Declaring and Initializing Vectors1:51
  • Accessing Data in Vectors1:53
  • Modifying Vectors6:04
  • Getting the Size of a Vector1:12
  • Magic Shop Inventory
  • Challenge Review: Magic Shop Inventory6:46

    Learn to manage a game inventory in C++ with a std::vector of strings, add items with push_back, and display first, last, and middle items using front, back, and at.

  • Declaring and Initializing Map Types3:26
  • Accessing Maps5:24
  • Modifying Maps3:05
  • Mapping RPG Character Stats
  • Challenge Review: Mapping RPG Character Stats3:50
  • C++ Fundamentals: Core Syntax and Containers
  • Arithmetic Operators4:57
  • Assignment Operators2:38
  • Increment and Decrement Operators2:51

    Learn how the increment and decrement operators work, including pre and post forms, with examples using cout and int variables, and how they behave in loops.

  • Comparison Operators2:55
  • Logical Operators6:04
  • Operator Precedence6:03

    Explore operator precedence and order of operations, from parentheses to multiplication, division, modulo, and addition and subtraction, evaluated left to right. See how integers and floats affect results through casting.

  • C++ Fundamentals: Operators
  • Input Basics2:38

    Learn the basics of getting user input in c++, using cin and the extraction operator, store input in age, prompt with instructions, and echo back your age as feedback.

  • Handling Invalid Input4:55
  • Combining Inputs2:33
  • Ad Lib Adventure
  • Challenge Review: Ad Lib Adventure4:12
  • C++ Fundamentals: Input
  • Branching If Statements3:53
  • Logical Operators with If Statements4:24
  • For Loops2:27
  • For Loop Variations2:47
  • Iterating Through Arrays1:51
  • Controlling For Loops3:35
  • Avoiding the Off By One Error3:52

    Explains fixing off by one errors in for loops by calculating array length (size of numbers divided by size of int), avoiding <=, and embracing for range.

  • Range Based For Loops2:29
  • Using For Loops with Vectors3:10

    Explore for loops with vectors in c++, including iterator and range-based approaches. Learn to iterate forward and backward, manage size-based indexing, and compare vectors with arrays for looping.

  • Using Iterators to Traverse Vectors and Arrays5:23
  • Number Sequences with For Loops
  • Challenge Review: Number Sequences with For Loops2:41

    Apply for loops in c++ to generate number sequences: count up from 1 to a user-defined limit, print even numbers by twos, and count down from the limit to 1.

  • While Loops4:14
  • Do While Loops3:26
  • Number Guessing Game
  • Challenge Review: Number Guessing Game5:15
  • Switch Statements3:39
  • Enum Type Basics3:59
  • Casting Types3:18
  • Strongly Typed Enum Types2:45
  • RPG Battle Action Menu
  • Challenge Review: RPG Battle Action Menu7:02
  • Defining and Calling Functions3:03
  • Multiple Parameters in a Function2:39

    Learn how to pass arguments to a function in C++, using a string parameter like message, printing it for debugging, and handling multiple comma separated parameters with the signature.

  • Returning Values in Functions3:26

    Learn to return values from C++ functions, switch from void to int with the return keyword, pass parameters, and add two numbers before storing and printing the result.

  • Calling Functions from Other Functions2:07
  • Function Declaration Order1:25
  • Returning Vectors with Functions5:44
  • Passing by Value and by Reference5:31

    Explore passing by value and by reference in c++, comparing memory use and performance while sorting a vector of random integers with the standard sort, and using ampersand references.

  • Template Basics2:25
  • Vector Templates2:44

    Learn how to use templates to sort vectors of any type with a generic sort function using a template parameter T, and apply it to string vectors.

  • Variadic Templates4:47
  • Adventure Toolkit
  • Challenge Review: Adventurer Toolkit9:11

Requirements

  • A basic level of computer literacy (installing software, navigating file systems) and a commitment to learning a foundational programming language for advanced software development.

Description

This course is a comprehensive, project-based program designed to guide you through building a complete, functional 2D Game Engine and a game from the ground up using C++. Master modern C++ programming principles and apply them directly to create your own scalable game engine and a complete game using the SFML 3 library and the CMake build system.

Who is this course for?

This course is for developers who have a foundational understanding of programming and are looking to specialize in C++ for game development, transitioning from core principles to professional engine architecture.


Course Progression and Key Modules:

The curriculum is structured sequentially, moving from core language features to complex game systems:

  • Module 01: C++ Fundamentals: Solidify your foundation with a deep dive into core C++ syntax, common data types, control flow (If statements, Switch statements, Loops), functions, and standard data structures like Arrays, Vectors, and Maps.

  • Module 04: Object-Oriented Programming (OOP): Learn the core of professional C++ design. This module covers Classes, Constructors, Destructors, Access Specifiers (public/private), Inheritance, Polymorphism, Operator Overloading, and managing class member functions with Const and Static keywords.

  • Module 03: Memory and Pointers: Demystify C++ memory management. You will explore Stack and Heap memory, learn to avoid common issues like memory leaks, and master Smart Pointers (Unique, Shared, and Weak) for safe, efficient resource management.

  • Module 05: Building the Game Engine: This is the heart of the course, where you build the core architecture. You will install and configure the CMake build system, integrate the SFML graphics library, establish the project's structure, implement the main Tick and Render Game Loops, and design core engine classes such as Application, World, and the Actor base class.

  • Game Feature Implementation (Modules 06 - 11): Apply your engine knowledge to build out a full game:

    • Player & Projectiles: Implement player input, clamping movement to the screen, and creating owner-based projectile systems with their own movement logic.

    • Physics System: Implement basic Collision Detection, the Health Component, and enemy AI behaviors like Chasing and off-screen Spawning.

    • Damage & Health: Centralize damage settings, create a Ship Stats class, and implement the logic for applying damage to both the player and enemies.

    • Weapon Upgrades & UI: Develop features like Spread Shot, implement a system to track enemy deaths, and build the user interface, including the Main Menu, Game Over Screen, Kill Count, and Health Bar.

    • Debugging & Polish: Finalize the game with touches like basic player rotation, Camera Shake effects, and a complete Sound System for audio polish.

By the end of this course, you will have a fully working, self-built C++ game engine, giving you the practical experience necessary to tackle more ambitious projects.

Who this course is for:

  • This course is designed for individuals who have little to no prior experience with the C++ programming language but have a strong interest in game development and are ready to learn a complex, powerful language.
  • Absolute C++ Beginners: Students who have never coded in C++ or are looking for a comprehensive, structured introduction to the language's fundamental concepts, including variables, data structures (arrays, vectors, maps), control flow, and functions.
  • Aspiring Game Developers: Individuals whose primary goal is to build their own game engine or work on low-level game systems. The course directly transitions C++ fundamentals into building an application, world, and physics system.
  • Programmers from Other Languages: Developers experienced in languages like Python, Java, or C# who want to transition to C++ for performance-critical applications like game development, and specifically need to master manual memory management and object-oriented principles.
  • Students Ready for an In-Depth Study: Given the course's coverage of complex topics like memory management (Stack/Heap), raw and smart pointers (unique, shared, weak), and the Big Five of object-oriented programming, learners should be prepared for a rigorous, detail-oriented learning experience.