So many things to learn, so little time.

I don’t know why I do this, maybe because I am curious or interested in making lots of different kinds of things - from games, to art and music. I am interested in how things work, and I can easily get lost in concentration as I investigate further, drawing paralleles with my existing understanding. In any case, I keep finding myself with lots to learn and not enough time to learn it.

Whenever start learning something new, it seems I am already learning a few other things. Learning C++ is the latest thing, even if I only intend to get a beginner level at the moment.

I am also learning Unity, Blender, Ableton Live, C#, Digital Illustration, Irish traditional music on bousouki… you see what I mean!

Regarding game development, I’ve recently been learning Unity. Unity uses C# for its scripting. C# is new to me, and I don’t have experience in Java to help me grok it. I’ve been teaching myself C# using some TeamTreehouse online courses, and that’s been great so far. C++ is not C#. So why bother learning that too? Let me explain.

My latest game dev project is largest one yet. The scope of it has required me to up my programming skills, since larger projects demand a different approach. Becoming better acquainted with systems programming languages and strongly typed languages is one thing, designing and implementing a modest project in clean code is another.

Learning Objective

Tutorials and books on the subject of game dev often use C++ as a reference language in their examples. Understanding such examples line-by-line can be a little confusing if an example relies on C++ specific keywords or statements. Learning C++ would likely help.

My favourites include Game Programming Patterns, Robert Nystrom and Game AI Programming By Example, Mat Buckland.

While I mostly comprehend the examples in texts I’ve come across, I occasionally encounter C++ keywords and features that I have not directly experienced in my everyday scripting language use. Without a solid frame of reference to translate the meaning of the example code in my head, I must think abstractly about the source code in addition to the programming concept demonstrated in the example.

Generally this is not a big deal, I can infer useful meaning by the context of the accompanying text. However, it slows me down and the potential for misunderstanding has recently come to frustrate me. I would rather immediately understand what is happening from having a solid foundation of understanding of C++.

Having stumbled across a few such problems in quick succession, I have finally decided to start learning C++.

Where to start learning C++?

Learning sources

To begin, I’ve signed up to MOOC’s on edX and began to go through learncpp.com tutorials. Some sources are better than others.

Setup

I’m using Windows 10 but I’ll be using Windows Subsystem for Linux with Ubuntu 18.04 and setting up Visual Studio Code to edit using the Remote connection feature. I’ve installed a gcc compiler on WSL and hooked everything up. This tutorial helped a lot to get it all hooked up without issue: https://code.visualstudio.com/docs/cpp/config-wsl

I can’t wait to get into the more object oriented side of things with C++. That is my big blindspot with the language. I don’t actually care to take on the object oriented style of programming very much, as I tend to prefer shallow but wide heirarchies in code for sanity and maintainability. The specifics are important though. Armed with that knowledge who knows what I will do next.

Anyawy, here’s some useful stuff to know already.

Numeric Data Types

I already found this table of Numeric Data a useful resource to help clear up my understanding of the innerworkings. NOTE: The type names that start with a __ character are considered non-standard types.

Type NameBytesAliasRange
int4signed–2,147,483,648 to 2,147,483,647
unsigned int4unsigned0 to 4,294,967,295
__int81char-128 to 127
unsigned __int81unsigned char0 to 255
__int162short, short int, signed short int–32,768 to 32,767
unsigned __int162unsigned short, unsigned short int0 to 65,535
__int324signed, signed int, int–2,147,483,648 to 2,147,483,647
unsigned __int324unsigned, unsigned int0 to 4,294,967,295
__int648long long, signed long long–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned __int648unsigned long long0 to 18,446,744,073,709,551,615
short2short int, signed short int-32,768 to 32,767
unsigned short2unsigned short int0 to 65,535
long4long int, signed long int–2,147,483,648 to 2,147,483,647
unsigned long4unsigned long int0 to 4,294,967,295
long long8none–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long long8none0 to 18,446,744,073,709,551,615
float4none3.4E +/- 38 (7 digits)
double8none1.7E +/- 308 (15 digits)
long double8none1.7E +/- 308 (15 digits)

Character Data Types

For internationalization purposes, the wchar_t type is used which expands on the numeric values available to represent character sets from various languages found around the world. 

Type NameBytesAliasRange
char1none–128 to 127 by default 0 to 255 when compiled by using /J
signed char1none-128 to 127
unsigned char1none0 to 255
wchar_t, char16_t, and char32_t2 or 4__wchar_t0 to 65,535 (wchar_t & char16_t), 0 to 4,294,967,295 (char32_t)

Other Data Types

Type NameBytesAliasRange
bool1nonetrue or false
enumvariesnonedependant on the enclosed data types

Hopefully, gaining C++ knowledge will help me experience a smoother journey in my research of game programming and algorithms. If I enjoy C++, I may even use it in my projects. Time will tell (and I may make a follow up post).

At the time of writing, learncpp.com was temporarily unavailable. Fortunately, it is snapshotted on https://web.archive.org/.