Difference between revisions of "Beginner C++ Game Programming Series"

From Chilipedia
Jump to: navigation, search
(Topics Covered)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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 here wiki to jump through the lessons, skipping any B.S. you already know.
+
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 ==
 
== Topics Covered ==
=== Language - Procedural Basics ===
+
=== C++ Language - Procedural Basics ===
Common to a lot of languages
+
*Basic [[variable|variables]] (<code>int</code>,<code>bool</code>,<code>float</code>), <code>[[const]]</code> specifier, <code>auto</code>
Basic variables (int,bool,float), const specifier, auto
+
*Type casting (c-style (type) cast)
Type casting (c-style (type) cast)
+
*Basic arithmetic operations (<code>+</code>, <code>-</code>, <code>/</code>, <code>*</code>, <code>%</code>, precedence <code>()</code>, assignment <code>+=</code> etc.,<code>++</code>/<code>--</code> )
Basic arithmetic operations (+, -, /, *, %, (precedence), assignment += etc.,++/-- )
+
*Conditionals ([[If_Statement|<code>if</code>...<code>else</code>]], <code>switch</code>...<code>case</code>)
Conditionals (if...else, switch)
+
*Boolean logic operations (<code>||</code>, <code>&&</code>, <code>!</code>)
Boolean logic operations (||, &&, !)
+
*Comparisons (<code>></code>, <code><</code>, <code>==</code>, <code><=</code>, <code>>=</code>, <code>!=</code>)
Comparisons (>, <, ==, <=, >=, !=)
+
*Loops (<code>while</code>, <code>for</code>, <code>do</code>...<code>while</code>, range-based for)
Loops (while, for, do...while, range-based for)
+
*Writing [[function|functions]] / function parameters / return values / overloading functions
Writing functions / parameters / return values / overloading functions
+
*References <code>&</code> / pass by reference-vs-pass by value
References & Pass by reference - vs - Pass by value
+
*Arrays <code>[]</code>
Arrays
+
*<code>struct</code> (and its difference from <code>class</code>)
Struct (and its difference from class)
+
*<code>enum class</code>
Enum class
+
*<code>namespace</code> / <code>using</code>
Namespace / using
+
*Forward declaration of classes to break circular <code>#include</code> cycles
Uniform initialization of classes / structs with {}
+
*Uniform initialization of classes / structs with <code>{}</code>
=== Language - Object Oriented Basics ===
+
 
Creating objects, calling member functions
+
=== C++ Language - Object Oriented Basics ===
Creating classes, data members, and member functions
+
*Creating objects, calling member functions
Public / private member access / encapsulation and data hiding
+
*Creating <code>class</code>es, data members, and member functions
const/non-mutating member functions
+
*<code>public</code> / <code>private</code> member access / encapsulation and data hiding
Writing constructors / initializing embedded objects
+
*<code>[[const]]</code>/non-mutating member functions
Default (automatic) constructor / = default;
+
*Writing constructors / initializing embedded objects
Delegating constructors
+
*Default (automatic) constructor / <code>= default</code>;
Static member variables / static constexpr member variables
+
*Delegating constructors
Nested classes
+
*<code>static</code> member variables / <code>static constexpr</code> member variables
Forward declaration to break circular dependencies
+
*Nested classes
Implementing operators for classes
+
*Forward declaration to break circular dependencies
=== Standard Library ===
+
*Implementing operators for classes
Just a few things, more to come
+
 
Rng <random> std::mt19973 / uniform_distributions
+
=== C++ Language - Standard Library ===
Utility functions std::min / std::max / std::swap
+
*Rng <random> <code>std::mt19973</code> / uniform_distributions
Math functions std::abs / std::sqrt
+
*Utility functions <code>std::min</code> / <code>std::max</code> / <code>std::swap</code>
measuring time <chrono> std::chrono::steady_clock / duration
+
*Math functions <code>std::abs</code> / <code>std::sqrt</code>
Assertions <assert.h>
+
*Measuring time <code><chrono></code> <code>std::chrono::steady_clock</code> / duration
 +
*Assertions <code><assert.h></code>
 
=== Chili Framework ===
 
=== Chili Framework ===
gfx : putpixel/screenwidth/height
+
*Gfx: putpixel/screenwidth/height
Color: getting/setting RGB color components
+
*Color: getting/setting RGB color components
mouse/kbd: input (polled and event-driven)
+
*Mouse/kbd: input (polled and event-driven)
Sound: loading and playing sounds
+
*Sound: loading and playing sounds
=== Game programming concepts ===
+
=== Game Programming Concepts ===
Game loop / frame based animation
+
*Game loop / frame based animation
Grid coordinate systems and mappings
+
*Grid coordinate systems and mappings
Variable (measured) time step and fixed time step
+
*Variable (measured) time step and fixed time step
Basic rectangle collision detection and handling
+
*Basic rectangle collision detection and handling
 
=== General Programming Techniques ===
 
=== General Programming Techniques ===
Recursion
+
*Recursion
 
*Managing a partially-filled array
 
*Managing a partially-filled array
Mapping a 2d array onto a 1d array
+
*Mapping a 2D array onto a 1D array
=== Graphics concepts ===
+
=== Graphics Concepts ===
Compiled sprite
+
*Compiled sprite
Drawing filled rectangles and filled circles
+
*Drawing filled rectangles and filled circles
 
*Drawing beveled graphics
 
*Drawing beveled graphics
 
*Pulsating color animation effect
 
*Pulsating color animation effect
=== Math / Physics concepts ===
+
=== Math / Physics Concepts ===
Position / velocity / acceleration
+
*Position / velocity / acceleration
rebounding off of vert/horz surface
+
*Rebounding off of a vertical/horizontal surface
Basic vector math (vector add/sub/scale/length/normalize)
+
*Basic vector math (vector add/sub/scale/length/normalize)
=== Other skills ===
+
=== Other Skills ===
Basic visual studio IDE usage & navigation
+
*Basic visual studio IDE usage & navigation
Visual studio debugger
+
*Visual studio debugger
Git + MSVC
+
*Git + MSVC
Basic understanding of compiler, linker, lib/obj files
+
*Basic understanding of compiler, linker, .h/.cpp files, .lib/.obj files
Using regex find/replace in visual studio
+
*Using regex find/replace in visual studio
 
+
  
 
== History ==
 
== 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.
+
This series is a reboot of Chili's [http://forum.planetchili.net/viewtopic.php?f=3&t=1792 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 ==
 
== List of Tutorials ==
Line 254: Line 254:
 
| style="border:1px solid grey;padding:8px;" colspan="4" | {{#lsth:Beginner C++ Game Programming Tutorial 24}}
 
| style="border:1px solid grey;padding:8px;" colspan="4" | {{#lsth:Beginner C++ Game Programming Tutorial 24}}
 
|}
 
|}
 +
 +
== Other Series ==
 +
*[[Intermediate C++ Game Programming Series]]

Latest revision as of 22:55, 17 June 2018

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