Romz Mark Lessons
editHey, Romz. First, let me note that I want to HELP (not teach) you into becoming a C++ game programmer. I feel you're dedicated because day after day, you come back and try to do better and fix problems. This is why I want to help you. But...
Please just be aware that the kind of help I am giving and have given is time consuming and if I were giving it to someone more local to me, I could easily be charging $20 an hour. You're lucky to have such support, and for free. As you know, I have a lot of patience and will help you as much as I can.
On method
editMost teachers tells you the knowledge you need and have you practice. Then they call it a day. This means you are not meant to learn through experience or practice and never learn to learn on your own. Learning should come THROUGH practice and gained along side experience. I will give you little knowledge and expect you to figure out things that, although are common sense to me, may be foreign to you. I'll assign Quickies, which are just suggested programs to try but you don't need to, and real assignments, which if you did the quickies successfully, you should have no excuse for not being able to do. I want to see your source and output for assignments. I won't help you figure them out, but I will help you understand the philosophical backing.
I'm doing this because I think it's a better way to learn. It will be harder. When I push you, I expect you to push back.
I will expect documentation of UNOBVIOUS THINGS. "int x; // It's an in" will not be apreciated. "int x; // The value of the sum." will, however "int sum;" with no comment would be even better because it's obvious.
I really want propper indentation here. I'll correct you wherever I see a problem.
BEGIN
editBeginer Stuff
editI want to start with things you should be able to do already. They may seem redundant, but I don't want to skip steps as your areas of lacking are seemingly random. That means it's fine if you can't do them.
Quicky: Make a program that inputs three numbers, X, Y, and Z, and outputs their product (X*Y*Z).
Quicky: Do the same as above, but change X, Y, and Z into an array.
If you have trouble with this, consult a tutorial. If you consult me, I'll suggest a tutorial. If that doesn't work, we'll see.
Assignment! Make a function that accepts an array of ints and the number of elements of that array. It should, in one swoop, print the array, find the sum, product, and average of the elements in that array and print those to the screen.
Quicky: Do the above assignment, but make it so instead of accepting an array, it accepts a pointer and the number of elements. Note how this changes your program. Note the relationship to arrays and pointers.
Quicky: Read up on type casting. Create an int and assing it a value. Print it to the screen. Cast it to a float. Add to it by a decimal number (like 1.4352). Print to the screen. Convert it to an int and print to the screen. Note how variables behave when type-casted.
Extra credit! Play around with unsigned ints. Try to assign -1 to an unsigned int. Note what happens. We can discuss why.
Assignment!: Try to pass an array of floats to this function. Note what happens and try to answer why.
This might not be apparent and you might not have the background to answer it. That's fine. Think it over for a while and we can discuss it.
Look up function overloading for the next one.
Assignment! Overload the previous function to be able to accept an array of floats.
Assignment! Now, you have two versions of the same function. One that accepts an int array, one that expects floats. Make an array of floats and an array of ints in main(), then call each array's respective function.
Objects 1
editI've heard my old C++ teacher complain about wishing he could just teach objects from the beginning, all the while wondering "well, why didn't you?" So, here you go.
Preparation: Make a Vector record structure (C++ keyword struct). These are very helpfull to games. Basically, every object has an an offset from the Point of origin <0,0>. The syntax for a vector is <x,y>. A vector <5,23> is five units on the X-axis from the origin, and 23 on the Y-axis.
Assignment! Overload the function you've been working with this whole time for your Vector struct.
Extra Credit! Test how fast the different functions are. By #including <time.h>, you get access to the time() function (input NULL into it) which will return an integer-type, time_t, representing the number of seconds since Jan 1, 1970. By subtracting two of these, we get how long since each was created. But, this means we need to make the function take over a minute to process. We can do that by having it process un-ordinarily long arrays and putting it in a for loop for thousands of iterations. We can test every function for efficiency this way. Although it doesn't tell us how efficient a function is, it can tell us how efficient one is compared to the other.
Alternatively, if your IDE tells you how long your program took, you can just use that and test each function individually.
Put "inline" on the line before the least efficient version of the function. I'll explain what it does, but see how it effects the time it takes to complete.