Teaching material for C++4 in Game Design, covering discrete and continuous 2D collision detection through interactive Raylib visualizers and two practical workshops.
- Author: Eliel Camargo-Molina
- Course: C++4 in Game Design
- Original course edition: September–October 2025
- Repository edition: 1.0.0
| Order | Module | Main ideas | Student activity |
|---|---|---|---|
| 1 | Discrete collision lecture | MTVs, circles, AABBs, OBBs, convexity, SAT | Explore five interactive visualizations |
| 2 | Breakout SAT workshop | Circle–convex SAT and collision response | Implement one SAT narrow-phase function |
| 3 | Continuous collision lecture | TOI, slabs, quadratics, relative motion, Minkowski sums, swept AABBs | Explore six CCD visualizations |
| 4 | Plinko CCD workshop | Broad phase, narrow phase, earliest collision | Assemble a CCD collision pipeline |
The repository includes both starter and solution executables for each workshop. See TEACHING_GUIDE.md for suggested delivery.
- A C++17 compiler
- CMake 3.20 or newer
- Git and an internet connection during the first configuration
Raylib 5.5 is downloaded automatically by CMake. No global Raylib installation is required.
cmake -S . -B build
cmake --build build --parallelExecutables are placed in build/bin (build/bin/Debug with some
multi-configuration generators):
lecture1_visualizerbreakout_starterbreakout_solutionlecture2_visualizerplinko_starterplinko_solution
To build only one target:
cmake --build build --target breakout_starterThe starter targets deliberately compile with incomplete student functions:
- Breakout: implement
CirclePoly_SAT_MTVinworkshops/01-breakout-sat/collision_engine.cpp. - Plinko: implement
FindEarliestCollisioninworkshops/02-plinko-ccd/workshop.cpp.
Completed versions are kept in separate *_solution.cpp files. They are not
needed by the starter targets.
- Touching counts as a collision.
- Collision normals point from the first object (A) toward the second (B).
- To move A out of B, use
-normal * depth. - CCD times are normalized to the current frame:
tis in[0, 1]. - All polygon SAT examples assume convex polygons.
These are teaching examples, not a production physics engine:
- Breakout uses discrete collision detection and can tunnel at extreme speeds.
- The examples resolve one selected contact at a time rather than constructing a full contact manifold.
- Plinko stops at the first impact in a frame and does not consume the remaining frame time after the bounce.
- The broad phase in Plinko scans all pegs; the swept bounds reduce expensive narrow-phase tests but are not a spatial acceleration structure.
The teaching material was created by Eliel Camargo-Molina for C++4 in
Game Design. See ATTRIBUTION.md for third-party notices and
CITATION.cff for citation metadata.
- C++ source and build files: MIT License
- Notes and teaching documentation: CC BY 4.0
See LICENSE.md for the file-by-file license mapping.