How much c++ knowledge to program a simple game?

Hey guys! I've started programming about 3 days ago and I was curios as to how much programming knowledge one person needs to have to program a very simple pickin sticks 2D game with Allegro engine, a simple sprite editor and visual studio ultimate 2013. Like, what does the person have to know? (Variables, loops, functions, etc.) Many thanks!!! :)
closed account (N36fSL3A)
First off, I wouldn't recommend Allegro, but SDL 2.0 which has been proven in the industry. (Valve uses it for their Steam client, Civ 5 used SDL 1.2 I believe). If you don't like SDL 2 then try SFML 2.1.

You need to know pointers, variables, loops, and simple math. Learn OOP concepts to make your life easier.
Why not use Allegro? Its a perfectly good library which I have heard good things about: Its got everything you need for a simple game.

As for what you should know, you should also need to know functions, probably arrays, and also things like classes. The most important thing in a game that I've found, though, is rather to know how to link all your classes and things together in a way that doesn't excessively couple them: In other words, though it doesn't matter too much for a simple game, you should know how to write code that allows for easy debugging and unit testing.
You need to know pointers, variables, loops, and simple math. Learn OOP concepts to make your life easier

That's it? I mean, I've learnt everything but pointers which I chose not to because I just picked up a book and decided to start all over and get deeper into each command :O
And yes, a game isn't as hard as people make it out to be. Its only once you get in depth games that things get complicated, due to things like concurrency and networking. Also, pointers are useful, and you should learn them, but not nearly as useful as people can make out. In more modern C++ program, raw pointers can be avoided as much as possible - though admittedly, game development can be an example of a field where raw pointers will sadly still be used as if on reflex.
Also, pointers are useful, and you should learn them


I will, I just chose to follow my book which is teaching me way more things that I thought. Like, it's not just about the practical stuff this book is full of interesting things about how the computer reacts to these codes and stuff. Also, what are pointers? I'm guessing they are what makes an object move? I could be wrong.
Not really. In basic terms, a pointer is simply a bit of data the 'points' to a location in the computers memory, like a reference to that bit of memory. This means that, for example, you can have multiple functions all modifying the same variable without that variable being global or part of a common class. They can be used for other things, too, such as polymorphism or dynamic memory allocation.
Not really. In basic terms, a pointer is simply a bit of data the 'points' to a location in the computers memory, like a reference to that bit of memory. This means that, for example, you can have multiple functions all modifying the same variable without that variable being global or part of a common class. They can be used for other things, too, such as polymorphism or dynamic memory allocation.


I see. If that's so, then what allows me to do what I just said above? I mean, to make something happen after a key is pressed. if ( ??? )
if we difine a variable:
int var1 = 13;
int is there to give the pc the information, what type of "integer" our number(13) is; like in math 13m, cm, kg, g, C*,[???] etc...
Int stands for an interger number.
-----------------
if we difine the variable:
int var1 = 13;
it save the integer "13" into var1.
always from right to left.
var1 stands for an adress.
like the postman that have to find your adress to give you your "integer";
the pc (compiler?) needs to know where ever your integer is.

if we
cout << &var1;
we can could out the address of the integer;
if we
cout <<var1;
we gets whats inside the "letter" or whats in var1 = 13; or the integer, call it as you like
----------------
So the pointer can can be placed on many adress (var1, var2....), showing you the inside or chaning it(the letter, integer, what ever you defined earlyer in your variable(var1,var2..)
------------------------
if we define pointer = var1,,
pointer is like var1(got there adress) and can do all the same things like var1 expect that the pointer can also change the adress.
for examplte towards var2!;
----------------------


Kiddolioable wrote:
I see. If that's so, then what allows me to do what I just said above? I mean, to make something happen after a key is pressed. if ( ??? )
It depends on which library you use. Just pick up a decent tutorial on SDL (or SFML, or Allegro), and you should learn how to do this.

I should also point out that functions along with OOP should be used in any C++ game.
Last edited on
It depends on which library you use. Just pick up a decent tutorial on SDL (or SFML, or Allegro), and you should learn how to do this.

I should also point out that functions along with OOP should be used in any C++ game.


Yup. Been literally spending ALL day trying to make SDL and Allegro work. FINALLY got SDL to work but there are like no tutorials on it so that's scrapped, Allegro doesn't even work, keeps giving me the stupid "Unable to run application (0xc000007b)" error agh so frustrating! :(
Last edited on
If you're going to use a multimedia library, use SDL2. It's been proven in so many areas.

I highly recommend SDL, mainly because of it's simplicity. It's portability is simply a plus (can run on pretty much anything).

In another topic you made (still alive atm), I recommended lazy foo's tutorials. His tutorials are much better than any other you'll find on the internet at this time due to the age of the new version, and back when I learned SDL (in the 1.2 days :P), his tutorials helped me more than any others I could find on the web (well that and the cplusplusguy on youtube, but he only has SDL 1.2 tutorials).
Last edited on
In another topic you made (still alive atm), I recommended lazy foo's tutorials.

Yeah I tried to do his tutorials (AWESOME btw) but I can't understand anything. It must be because of my lack of C++ knowledge. Back to my book it is!
Topic archived. No new replies allowed.