Saturday, November 28, 2009

Decided to keep a blog.

A friend of mine mentioned to me today that I should keep a blog of my journeys on becoming a video game programmer; I have been accepted to my top choice college: DigiPen! I'm ridiculously excited to start school there next August! I'll be starting in a Bachelor's Degree of CS in Real Time Interactive Simulation (RTIS). Here is a link to DigiPen's site: https://www.digipen.edu/



The goal of this blog is to keep a detailed and prolific log of what it is like to start from no programming experience, to becoming a professional programmer.


Sadly, I already have a small amount of programming experience. My first language I ever built a program in was AS3, which is the language behind Flash. This was the ever popular Hello World program. From this point, I ventured into forums and online tutorials, and within a couple weeks of study I was able to create a simple game (which I currently still have on my flash drive), and then continue additions to the game once the tutorial was over.


I couldn't, even if I wanted to, recode this game from scratch -I only had a deep enough understanding of AS3 to modify pre-existing code from the tutorial. So, the goal of this blog is still attainable!


After this little flash game, I stopped coding altogether.


Now, two years later, I am accepted to a great college, am learning C++ from the ground up on my spare time, and finishing up my senior year of highschool.


The reason I have chose to spend my time learning C++, is because the language that 90% of video games are made with is C and C++, not to mention C and C++ are taught extensively at DigiPen, so anything I learn now will be very valuable during college.


I've spent two days reading through the tutorial found on this website http://cplusplus.com/, and I've gained a working knowledge of all categories up to Classes(1). I've learned to use variables, constants, basic input/output via cin and cout, control structures (like for and while loops, if and else statements) , arrays, pointers, dynamic memory, and data structures.


While progressing through this tutorial, I take effort into not only understanding the concepts taught by the examples, but I go and create my own programs similar to the examples from scratch best I can.


Over these two days, I have written two console programs. Here is the code for the my first program created during this tutorial, it's function is to have the user guess what number the number input by the user is being muliplied by. It only works with integers:






#include <iostream>
using namespace std;

int subtraction (int a)
{
    int r;
    r = a*5;
    return (r);
}

int main ()
{
    int x, y, z;
    y = 5;
    loop:
    cout << "Enter a number into the secret equation." << '\n';
    cin >> x;
    cout << "Now I will modify the number you entered; it is now:" << '\n';
    cin.get();
    cout << subtraction (x) << " - Press enter to continue" << '\n';
    cin.get();
    cout << "Can you guess by what number I multiplied yours by?" << '\n';
    cin >> z;
  
    while (z != 5)
    {
          cout << "You guessed the wrong number!" << '\n';
          goto loop;
          }
        
    return 0;
}






Here is the code for my second program created while running through this tutorial. This program stores strings entered by the user, and then spits them back out:





#include <iostream>
#include <string>
#include <sstream>
using namespace std;

struct animals_t {
    string danger;
    string size;
}dog, mouse, alligator;

void printdetails (animals_t details)
{
    cout << details.danger << '\n';
    cout << "And this large: ";
    cout << details.size;
}

int main ()
{
    string input;
  
    cout << "How large is a dog!? ";
    getline (cin,dog.size);
    cout << "How dangerous is a dog!? ";
    getline (cin,dog.danger);
    cout << "How large is a mouse!? ";
    getline (cin,mouse.size);
    cout << "How dangerous is a mouse!? ";
    getline (cin,mouse.danger);
    cout << "How large is an alligator!? ";
    getline (cin,alligator.size);
    cout << "How dangerous is an alligator!? ";
    getline (cin,alligator.danger);
    cout << '\n';
  
    cout << "A dog is this dangerous: ";
    printdetails (dog);
    cout << '\n' << '\n';
  
    cout << "A mouse is this dangerous: ";
    printdetails (mouse);
    cout << '\n' << '\n';
  
    cout << "An alligator is this dangerous: ";
    printdetails (alligator);
    cout << '\n' << '\n';
  
    cin.get();
  
    return 0;
}



I'm finding that coding in C++ is actually extremely rewarding! Just creating these two programs, from scratch, without any help has revitalized me and peaked my interest of programming even more so than it was before!


I am now currently reading an article about 2d physics engines here: http://www.gamedev.net/reference/programming/features/verletPhys/ and should finish reading it before I finally get to sleep. The article is fairly simple in terms of concepts, but the actual code is way over my head.. Ugh. I can understand the math and the concepts, but I can't wrap my head around every bit of code presented.


Here is an extremely useful podcast about becoming a game programmer (right click save target as): https://www.digipen.edu/uploads/media/digipen_podclass_issue_37.mp3


My goal is to submit a daily entry here. Once college starts, that may change.

7 comments:

  1. What program do you use to open these programs?
    Also how/where did you learn C++

    ReplyDelete
  2. I am right now learning C++. I really haven't learned much yet. Here is where I've learned all I know about it: http://cplusplus.com/doc/tutorial/

    And also, to compile (which is to use the code and convert it into machine code, so the computer can run it as a program) the code, you need a compiler. Here, read this: http://www.cplusplus.com/forum/articles/7263/

    I suggest using wxDev-C++. Once you install this, just select File >> New >> Console Application. After that, you can copy//paste my code, and it will work. Also, all the code at the cplusplus.com tutorial is composed of console applications.

    ReplyDelete
  3. Is C++ worth the time?
    How complicated is it? Is it Fun?

    ReplyDelete
  4. C++ is completely worth the time if you are interested in becoming a programmer. C++ programmers are the best there is, because when you learn C++ extremely well, you understand the hardware at a very intimate level, and nothing is hidden from you.

    Also, C++ is what 90% of the games industry uses to code games. If you want a bit of info about C++ and why it is awesome, check out this link: http://www.gamedev.net/reference/start_here/

    ReplyDelete
  5. So, where are the boundaries of what you can do with C++?

    ReplyDelete
  6. C++ is the most versatile language there is. Some things are easier to do in other languages, like very small simple jobs, which many people use scripting languages for. Although, you won't have a need for a scripting language for a while, if your goal is to make games with C++.

    ReplyDelete

Note: Only a member of this blog may post a comment.