
Develop a solid foundation in C++ by exploring variables, containers, pointers, classes, and templates while building the Light Years game from scratch, using git and cmake for multi-platform project management.
Install Visual Studio 2022 as the C++ and Unreal Engine IDE, select desktop and game development workloads, and verify the Windows SDK compatibility to start building.
Create a new c++ project in Visual Studio for Windows, explore the solution explorer and source structure, add a src/main.cpp, and learn the entry point with a hello world program.
Create a hello world program by including the iostream library, using std::cout to print to the console, and terminating statements with a semicolon.
Learn how to declare and use variables in C++, including std::string, integers, and floats, and print outputs with cout, newlines, and end-of-line markers.
Explore char and boolean types, how single quotes define characters and true or false behave in memory, and examine size and precision limits of int, float, and bool.
Explore arrays in C++: declare an array of strings, access and modify elements using zero-based indices, and understand fixed size, out-of-bounds undefined behavior, and basic size calculations.
Explore how the vector type differs from arrays in C++ and how to use std::vector with initializer lists, push_back, front, back, size, insert, erase, and iterators.
Explore std::map, a key value store with string keys and int values, enabling lookups by key, updates, inserts, erases, size checks, and clear, and may insert default values.
Explore C++ operators, including arithmetic (plus, minus, multiply, divide, modulo), assignment and increment, and note precedence and integer versus float behavior.
Learn how to read input in C++, using std::cout and std::cin with age and name, manage the input buffer with clear and ignore, and use getline for full names.
Learn how the if statement evaluates a boolean condition to execute code blocks, using comparisons, proper booleans, and else branches, while avoiding confusing nesting and accidental assignments.
Learn how the for loop works by building a sum from 1 to 100, understanding initialization, condition, and incrementation, and using break and continue to control the loop.
Explore using for loops with arrays and vectors, including index-based, range-based, and for-each iteration. Understand off-by-one pitfalls, size calculations, and iterators begin and end for traversing vectors.
Compare the while loop to the for loop, and learn the do while loop that runs at least once, including break, continue, and proper increment to avoid infinite loops.
Learn how switch statements work with integers and enums, including case and default handling, fall-through with breaks, and how enum types define mood options and safe enum class usage.
Convert miles to kilometers by reading user input, multiplying by 1.6, and printing the result while teaching constant values, initialization, and input error handling.
Learn to determine odd or even numbers in C++ using the modulus operator and input validation. Implement robust error handling, explore integer reading, and understand edge cases and common pitfalls.
Learn to count repeated words in a text using C++ by extracting words with a string stream, normalizing case and punctuation, and tallying with a map.
Learn to use a std::map to count word occurrences with a string key and int value, insert and update counts, then print the results.
Learn to generate a random sequence in c++ using a vector and a seed, then scan the numbers to find the smallest value, handling empty input and edge cases.
Explore bubble sort, a simple sorting method that reorders a vector from smallest to largest by swapping out-of-order values with nested loops.
Learn how to define and call functions to organize code, use void and return values, pass arguments with signatures, and return std::vector<int> such as random numbers for flexible programs.
Explore pass by reference with the ampersand to sort a vector without unnecessary copies, and apply const to read-only parameters to boost performance.
Learn the basics of templates in C++, including declaring a type parameter T and using templates to print vectors of any type.
Learn variadic templates and template specialization in C++, using multiple template arguments and unpacking (recursion) to sum values, including ints, floats, and strings, with practical caveats.
Explore separating a C++ program into multiple files using translation units and object files, understand compilation and linking stages, differentiate declarations from definitions, and introduce header files for reuse.
Learn how header files declare utilities and enable includes with preprocessor directives, reuse code, apply forward declarations, templates, and inline files to manage declarations, definitions, and linking in C++ projects.
Learn to separate utility code into a library project and build a reusable static library while exploring includes, linking, and the role of templates and the standard library.
Explore how dynamic link libraries differ from static libraries, learn to expose functions with export/import directives, and link dlls and libs in a Visual Studio project for reusable shared code.
Learn to package a C++ library with include and binary folders, provide header files, and link a lib or dll in another app with extern, vendor, and proper directory setup.
Explore how memory is organized as labeled boxes with addresses, how variables like x store values, and how the ampersand accesses addresses and creates references that share a memory location.
Explore how pointers in C++ store memory addresses, use ampersand and dereference with the star to access or modify values, and how void pointers differ from typed pointers.
Drill into pointer behavior in C++ by comparing raw C-style casting and static_cast, and use breakpoints, memory window, and step-by-step debugging to inspect memory addresses and values.
Explore how arrays relate to pointers by viewing memory layout, dereferencing, and pointer arithmetic; learn about offsets, addresses, and how integers occupy multiple bytes.
Explore how the stack memory stores variables as a top-of-stack block sequence, with scopes limiting lifetimes, as x, value, c, and d are pushed and popped during execution.
Explore how heap memory differs from the stack, how to allocate with new, and how to delete to free heap memory, preventing leaks and dangling pointers.
Diagnose access violations and memory leaks in heap-allocated memory by understanding delete, null pointers, and dangling references. Explore smart pointers in C++11 to improve memory safety.
Learn how the unique pointer manages heap memory, automatically frees on scope exit, and transfers ownership via move semantics, avoiding copies and preventing double deletion.
Compare shared pointer with unique pointer, explain copy behavior and how reference counting tracks owners, freeing the raw pointer when the last shared pointer goes out of scope.
Explore weak pointers in C++: hold a non-owning reference to a shared object, check expiration, and use lock to obtain a temporary shared pointer while not affecting the reference count.
Learn how to model game objects with classes, define a class with public and private members, create instances, and store them in a vector for iteration and output.
Learn how constructors initialize class members, including default and custom constructors, initializer usage, calling another constructor, with string and raw char pointer examples.
Learn how destructors release resources when objects go out of scope or are deleted. Explore memory management, heap allocations, and the RAII pattern in C++.
Explore member functions as the public interface for a class, using getter and setter pairs to protect private data, exemplified by a student class with increment year and graduation logic.
Learn how the const keyword applies to classes, use const member functions, differentiate accessors from mutators, and mark non-changing members as const.
Learn how inheritance lets a car derive from a vehicle, reusing name and capacity while adding mileage, and how to initialize the base class in the derived constructor.
Learn how the protected keyword enforces inheritance safety, and how virtual functions, override, and upcasting enable polymorphic behavior across base and derived classes.
Explore pure virtual functions and polymorphism in C++. See how abstract base classes define interfaces like take damage for characters and how virtual tables call the correct derived function.
Demonstrates how a simple int container uses constructors and a destructor to manage memory, and highlights shallow copies and the need for deep copy via copy constructors.
Explore how to implement a deep copy with a copy constructor, distinguish shallow versus deep copy, and apply move semantics to transfer ownership using r-values and the move constructor.
Define the copy assignment operator for a dynamic int type, performing a deep copy by dereferencing the right-hand side, and return a reference to this while guarding against self-assignment.
Define operator overloads for your type to implement equality and relational comparisons, returning booleans, and extend to other operators, including the subscription (square bracket) operator.
Explore the move assignment operator and its relation to the move constructor, learning how ownership transfers between objects, guard against self-assignment, and the big five in C++.
Move class declarations to a header and definitions to a cpp file, forward declare related classes, provide copy and move constructors, and use include guards.
Learn to implement a template class in c++ by building a generic dynamic number and the big five (destructor, copy and move constructors/assignments) with int and float examples.
Learn to implement binary operators for a dynamic int outside the class, support left and right operands with int types, and understand why the friend keyword is best used sparingly.
Explore the static keyword in a class, defining a private static count shared by all instances and static functions that access static members.
Learn the basics of git as a version control tool and how GitHub hosts your repositories, including installation, console commands, and creating an account.
Explore git basics by initializing a repository, tracking changes in a staging area, and recording history with commits, while learning about branches and common commands like status, add, and log.
Create and switch between branches to safely develop features, fall back to the main branch when needed, then merge changes back with git merge and delete obsolete branches.
Learn to traverse git history using hard and soft resets, reflog, and restore, and understand the risks of history deletion in team workflows before mastering revert.
Master git history with revert, not reset, learning to apply on commits, use vim to edit messages, and manage branches and merging.
Identify and resolve merge conflicts in git by understanding branches changing the same lines, then resolve using ours or theirs and commit the final result.
Push your C++ game project to GitHub by creating a repository, setting a remote origin, and pushing the master branch. Understand public versus private settings, licenses, and gitignore basics.
Learn to update local and remote repositories by pulling and pushing changes with git, manage branches, and resolve merge conflicts when collaborating.
Learn to use git ignore to reduce tracked files by excluding build folders. Create a .gitignore, apply Visual Studio presets, and push to GitHub with a remote.
Install and set up cmake, a cross-platform build tool for c and c++, and add it to the system path to enable building projects via CMake lists.
Learn to set up a cross-platform C++ project with cmake by creating a cmake list and building in a build folder for light years spaceship game, without a game engine.
Add an executable for the light years game in cmake, create light years/src/main.cpp with hello world, and configure the build, startup project, and a clean rebuild workflow.
Refactor your CMake setup by introducing a custom variable, organizing sources with add_subdirectory, and initialize git with ignore rules to track the project while keeping builds out.
Fetch Sfml into a c++ project with CMake fetch content to link graphics, window, and system, and enable cross-platform building via Visual Studio and CMake.
Learn to automate copying dynamic link libraries into the build output using CMake post-build commands, replacing manual DLL copying for SFML and other libraries.
Create a dedicated application class to manage an SFML render window, implement a responsive game loop with event handling, and organize code with include and framework folders and CMake configuration.
Set up a fixed frame rate game loop using an SFML clock, accumulate delta time, and update the game at a target delta time to ensure consistent physics.
Explore rendering in the game loop by clearing the window, drawing a 100 by 100 rectangle, and displaying the frame with a render function overridden by subclasses.
Encapsulate the program by turning main into a template entry point and splitting the engine and game into two targets, with the game supplying get application.
Define a shared core with data types and a logging macro that replaces cout with printf, enabling easy backend swapping and unified, scalable logging for your game framework.
Define common data types with type aliases for smart pointers and containers using std::unique_ptr, std::shared_ptr, std::vector, std::map, and std::unordered_map. Explain ordering, hashing, and how aliases enable future swapping of implementations.
Implement the world class to represent a level and enable loading and running multiple game levels with a template loader, begin play and tick, and a virtual destructor.
Implement the actor class, manage ownership by the world, and enable spawning, begin play, and ticking with pending actors handling.
Create a base object class with a pending destroy flag and a destroy function, and use iterators to remove actors on the next tick with logs.
Learn to render a sprite as an actor in a C++ game from scratch, including customizable window size and style, texture loading, and basic render loop.
Configure a resource directory with a config header and CMake to copy assets into the final build. Distinguish debug and release paths to enable correct relative asset loading.
Create a singleton asset manager to load textures, fonts, and audio, caching textures in a path keyed map and returning shared textures on demand.
Implement a clean cycle in the asset manager by iterating the texture map with an iterator, removing textures when only one shared_ptr remains, and scheduling cleanups with a clock interval.
Implement the actor transformation interface by adding set/get location and rotation, offset helpers, forward and right direction vectors, and a center pivot using a two-dimensional rotation math utility.
Add a base spaceship and a player spaceship, implementing velocity, a tick with delta time, and spawning in the world, with rotation and velocity controls for movement.
Learn to implement a player spaceship with texture loading, input handling, and movement using W, A, S, D controls in a C++ game, including asset root setup and tick updates.
Learn to normalize player input by computing vector length, scaling vectors in place, and implementing a universal normalize function in a reusable math library for precise movement.
Clamp the player's movement to the game window by querying window size from the application and restricting input at left, right, top, and bottom edges before normalization.
Develop a modular shooting system for the player spaceship by introducing a base shooter and a bullet shooter class, implementing cooldown, input, and simple log output.
Create a bullet class in C++ for a shooter game, spawn bullets from the shooter using the world, owner, and texture path; implement movement, speed, damage, and off-screen destruction.
Implement a bullet out-of-bounds check against window size and actor bounds to destroy bullets, and introduce a world clean cycle to batch deletions for memory efficiency and C++ benefits.
Fetch and integrate the Box2D 2D physics engine into a C++ game project via CMake, pulling from GitHub, linking to the engine, and testing collision detection.
Implement a physics system as a singleton to decouple box2d from other code, initialize a zero-gravity physics world, and set a 0.01 physics scale for centimeter-like sizing.
Create the add listener function to create a dynamic Box2D body for an actor, sync its position and angle, and step the physics world with velocity and position iterations.
Learn to initialize and toggle actor physics in C++, attach a b2 body to the physics system, and update transform on location and rotation.
Implement a physics contact listener to signal actor overlaps by overriding begin and end contact, and broadcasting when actors begin and end overlap.
Learn to safely remove physics bodies by queuing removals in a set, processing them before stepping, and restarting physics with a clean system.
Learn to implement a reusable health component for a spaceship, handling damage, clamping health to zero or max, and supporting health regeneration, with future options for delegates or listener interfaces.
Explore lambdas, delegates, and the std::function class in C++, learn to broadcast events with a delegate pattern, and master capture lists, by value and by reference.
Learn two ways to obtain a weak pointer from an actor—via the world or via std::enable_shared_from_this—to let delegates broadcast safely, by checking expiry and avoiding raw pointers.
Implement a universal delegate class in the engine using a variadic template, enabling binding to member functions with a weak object reference and flexible callback signatures.
Develop a delegate class that stores callbacks as std::function, uses a lambda to invoke them while validating object lifetime, and broadcasts changes to listeners.
Learn how to implement bullet damage using a team ID system to prevent friendly fire, by assigning teams, checking hostility, and applying damage via a health component.
Add eye-catching hit feedback to enemies by blinking their sprite with a red color offset using a lerp during updates, and plan to spawn an explosion VFX on destruction.
Create a particle class for explosion effects in C++, with velocity, lifetime, and a fade, including random velocity, size, and lifetime, to support an explosion actor that spawns multiple particles.
Create an explosion class in C++ to spawn multiple particles by spawning actors in the world using a particle image path, with randomized life, size, velocity, and color.
In this comprehensive course, students will delve deeply into the fundamental aspects of C++, explore the language's core concepts, study the principles of Object-Oriented Programming, and achieve mastery over the intricacies of memory management. The curriculum goes beyond theoretical knowledge, extending to the creation and practical utilization of C++ libraries and executables, equipping learners with tangible, applicable skills. Emphasizing tools relevant to the industry, the course seamlessly integrates Git and CMake into the workflow, ensuring that students acquire essential instruments widely employed in software development.
Having established a robust foundation, the course then progresses to the dynamic creation of a complete game from scratch. This exciting phase involves leveraging C++ in conjunction with a carefully chosen array of powerful libraries. Through immersive, hands-on experiences, students not only cultivate a profound understanding of C++ but also witness firsthand its practical applications in real-world scenarios.
Upon completing the course, participants will have garnered valuable insights and proficiency, empowering them to confidently pursue careers in software engineering for game development. Furthermore, the acquired knowledge acts as a sturdy launching pad for further studies, encompassing advanced topics like Unreal Engine and broader application development.
This course stands as the fourth installment in a comprehensive game development series and marks the initial exploration of C++. Importantly, students aspiring to study C++ and subsequently delve into Unreal Engine are not obliged to complete the preceding three courses in the series.