Beginner C++ Game Programming Series

From Chilipedia
Jump to: navigation, search

The beginner series is meant to teach fundamental C++ programming concepts. It also covers some basic graphics programming theory. Also: making shitty little games. It is suitable even for those with zero programming experience. If this ain't your first rodeo, you can use this page to jump through the lessons, skipping any B.S. you already know.

Topics Covered

C++ Language - Procedural Basics

  • Basic variables (int,bool,float), const specifier, auto
  • Type casting (c-style (type) cast)
  • Basic arithmetic operations (+, -, /, *, %, precedence (), assignment += etc.,++/-- )
  • Conditionals (if...else, switch...case)
  • Boolean logic operations (||, &&, !)
  • Comparisons (>, <, ==, <=, >=, !=)
  • Loops (while, for, do...while, range-based for)
  • Writing functions / function parameters / return values / overloading functions
  • References & / pass by reference-vs-pass by value
  • Arrays []
  • struct (and its difference from class)
  • enum class
  • namespace / using
  • Forward declaration of classes to break circular #include cycles
  • Uniform initialization of classes / structs with {}

C++ Language - Object Oriented Basics

  • Creating objects, calling member functions
  • Creating classes, data members, and member functions
  • public / private member access / encapsulation and data hiding
  • const/non-mutating member functions
  • Writing constructors / initializing embedded objects
  • Default (automatic) constructor / = default;
  • Delegating constructors
  • static member variables / static constexpr member variables
  • Nested classes
  • Forward declaration to break circular dependencies
  • Implementing operators for classes

C++ Language - Standard Library

  • Rng <random> std::mt19973 / uniform_distributions
  • Utility functions std::min / std::max / std::swap
  • Math functions std::abs / std::sqrt
  • Measuring time <chrono> std::chrono::steady_clock / duration
  • Assertions <assert.h>

Chili Framework

  • Gfx: putpixel/screenwidth/height
  • Color: getting/setting RGB color components
  • Mouse/kbd: input (polled and event-driven)
  • Sound: loading and playing sounds

Game Programming Concepts

  • Game loop / frame based animation
  • Grid coordinate systems and mappings
  • Variable (measured) time step and fixed time step
  • Basic rectangle collision detection and handling

General Programming Techniques

  • Recursion
  • Managing a partially-filled array
  • Mapping a 2D array onto a 1D array

Graphics Concepts

  • Compiled sprite
  • Drawing filled rectangles and filled circles
  • Drawing beveled graphics
  • Pulsating color animation effect

Math / Physics Concepts

  • Position / velocity / acceleration
  • Rebounding off of a vertical/horizontal surface
  • Basic vector math (vector add/sub/scale/length/normalize)

Other Skills

  • Basic visual studio IDE usage & navigation
  • Visual studio debugger
  • Git + MSVC
  • Basic understanding of compiler, linker, .h/.cpp files, .lib/.obj files
  • Using regex find/replace in visual studio

History

This series is a reboot of Chili's original beginner series launched back in 2012 (ah, the good old days). The way that Direct3D applications are built and the tools used have changed over the last 5 or so years, and the reboot updates the tutorials to reflect those changes. It also corrects some mistakes that were made, and is reworked to shorten the journey to hardware 3D graphics programming and to introduce object-oriented programming at an earlier stage.

List of Tutorials

Tutorial Number Title Release Date Runtime
0 Beginner C++ Game Programming [Intro/Setup] July 30, 2016 16:03
This tutorial introduces the Beginner C++ Game Programming Series and walks you through the setup required to follow along with Chili. It also explains who the series is intended for, the goals and outline of the series, and tips on how to succeed, but you can skip all that bullshit if you have crippling ADD. For a detailed list of what is covered in Beginner, see this page.
1 Beginner C++ Game Programming [Function Calls/Syntax] August 1, 2016 17:35
This tutorial mainly deals with how to call a function in C++ and basic syntax rules. We also talk about pixels, intellisense and other dumb bullshit.
2 Beginner C++ Game Programming [Variables/Operators] August 5, 2016 18:49
This tutorial is all about making sweet ass boxes (variables) to jam your hot numbers into and using operators (addition and subtraction) to add and subtract shit.
3 Beginner C++ Game Programming [if Statement/bool] August 9, 2016 26:11
We learn how to control the flow of execution using if statements, we learn about a new variable type called bool, and we learn how to use the Chili Framework to get keyboard input. All this, plus the dankest memes from 2007.
4 Beginner C++ Game Programming [Animation/Member Variables] August 14, 2016 16:13
In this tutorial we explore the idea of animation in computer graphics and we make the reticle move freely around the screen. Along the way we learn about classes and objects, how to add member variables to objects/classes, about .h (header) and .cpp (source) files, and about the short harsh lives of local variables (scope).
5 Beginner C++ Game Programming [Comparison/Logical Operators] August 20, 2016 20:28
Comparison and Boolean logic operators. Operators galore! Make if statements great again! Let the int dick measuring contests begin! Also, collision detection between rectangles, which is useful for stuff.
6 Beginner C++ Game Programming [Creating Functions] August 27, 2016 19:14
How to make member functions. That is all.
7 Beginner C++ Game Programming [Debugging] September 2, 2016 17:59
Mr. DeBugger is a real sir.
8 Beginner C++ Game Programming [Poo Game/RNG] September 10, 2016 27:56
We make our first game. So goddamn sweet. Not shitty at all.
9 Beginner C++ Game Programming [Creating Classes/static constexpr] September 17, 2016 20:11
In this video we make our first class and Chili teaches us about the birds and the bees and the static constexpr.
10 Beginner C++ Game Programming [Loops] October 4, 2016 20:55
In this video we learn how to loop our shit. Fuckoff copy and paste. Die in a gasoline fire (just kidding, don't leave me baby!)
11 Beginner C++ Game Programming [References/const Correctness] October 20, 2016 35:39
References are sweet because they let us control our shit from far away. Remember the days when we had to actually get up to change the channel on the TV? Remember TV? Fuck that shit! Also, const correctness is for big dick gangstas that don't give any fucks.
12 Beginner C++ Game Programming [Constructors/Encapsulation] October 29, 2016 30:55
Here we learn about the concept of encapsulation (ask your mom where she keeps the Vicodin!), which is the main principle behind object oriented programming (so listen the fuck up eh?). We also learn how to construct shit, and how to make our shit private.
13 Beginner C++ Game Programming [Arrays] November 11, 2016 34:41
In this lesson we learn about the bomb-ass data structure known as the array, the granddaddy of them all. We also learn about boring shit like the automatically-generated default constructor (BOOOOORIIIIING! NEEEEEERRRD!).
14 Beginner C++ Game Programming [Snake Game] November 26, 2016 36:22+
This is a two-part tutorial in which we tackle a game with a little more substance--the Snake Game. Grids and arrays galore. Majestic.
15 Beginner C++ Game Programming [Git in Visual Studio] December 11, 2016 37:25
In this video we learn how to use Git source control so that we can suck less at programming.
16 Beginner C++ Game Programming [float/type casting] December 20, 2016 30:30
In this video we learn how to float our boat, and how to get type cast.
17 Beginner C++ Game Programming [chrono timestep/using namespace] December 25, 2016 29:11
In this video we do the timestep thing in the Poo game. That means we measure (with std::chrono::steady_clock) the time taken for each frame, and then step the game's simulation by that amount. We also learn about the using keyword.
18 Beginner C++ Game Programming [Compiler Confessions] January 8, 2017 28:35
In this video we dig down in the dirty, juicy secrets of the C++ toolchain (the preprocessor, compiler, and linker).
19 Beginner C++ Game Programming [2D Vectors] January 14, 2017 36:09
Welcome to the fantastic erotic world of mathematical vectors. Everything is different now. Every operator is overloaded.
20 Beginner C++ Game Programming [Fart-Annoyed] January 28, 2017 28:18+
This is a three-part tutorial in which we play with our balls. Or something. Anyways, we'll finally put all that vector bullshit to good work doing some physics-y type shit.
21 Beginner C++ Game Programming [2D Arrays/Circular Dependency] February 11, 2017 27:22
2D arrays are awesome because they fuckin' let us organize or data and shit. Board games like chess, strategy games like Civilization, roguelikes, RTS games, X-Com... it's all grids baby. Also, time to learn how to circular depend our shit with forward declaration (you should still avoid circ. dep. when possible tho).
22 Beginner C++ Game Programming [enum/switch/case] February 19, 2017 21:42
We learn how to use enum to get rid of all the magic number bullshit for representing a number of options or states, and we learn how to use switch/case as an alternative to long if ... else chains. I also give the sermon on the mount (c:).
23 Beginner C++ Game Programming [Memesweeper] February 26, 2017 38:10+
Remember that movie, Field of Dreams starring Kevin Costner? No? Well neither do I, but this is a lot like that, minus the baseball, the Kevin Costner, the corn, and a lot of other stuff. But it has memes, and they will kill you.
24 Beginner C++ Game Programming [Recursion] March 11, 2017 26:54
Don't fool around with this stuff. Last week a programmer was found dead in the shower here. Apparently the instructions on the shampoo bottle read: Lather. Rinse. Repeat.

Other Series