Saturday 14 November 2009

Catch Up

Okay. So I haven't posted anything in a while. Really sorry about that. Finally entered university and I'm absolutely buried in work. Enough about me though, let's get to it. I've made some improvements in my programming and the beautiful thing about progress is when you make some, learning-wise, you look at your old code and laugh at your own naivety. I'll break it down to you over the next couple of weeks and explain how each language feature I demonstrate is done. For now, I'm just letting you know that I'm back in the game and hell-bent on letting you learn all I know in programming.

Oh and here's a list of some stuff I now know, since I last posted
1. Pointers
2. References
3. Array manipulation
4. Classes (still learning this one though, not in the advanced stage yet)
5. Header file creation and use
6. Functions

Thursday 18 June 2009

Break time

Alright, now I'm taking a break from stuffing info in my brain and have decided to try out a few things I've learned so far. I'm creating a minigame. I say game because it has a plot, upgradeable variables (like health, powers) and stuff. But I say mini because, so far, it has no graphics, no enemies, and i'm still trying to come up with problems for the protagonist to overcome. Oh what the heck, I'll just present the code and let you see what it looks like so far. Note: I only started doing it last night. I'm writing this the next morning. Oh and no laughing, I'm still learning here.

#include
#include
#include

using namespace std;

int main()
{

cout << "Twenty seven centuries ago, an upper-level demon known to few as Klarius"<< endl;
cout << "stumbled on a fallen angel, raped her and left her for dead. She survived and"<< endl;
cout << "was pregnant. Ten years later, she gave birth to an omen. A creature with"<< endl;
cout << " the might of heaven and hell and a powerful thirst for the souls of men." << endl;
cout << "His name was called.....'Naftali'.\n";

int Powers(100);
string identity;

identity = "\nName: Naftali Warren\n";

cout << identity << endl;
cout << "\nPowers: " << Powers << endl;//Naftali's overall game health

vector souls;
vector::iterator profile;
profile = souls.begin();

souls.push_back("1. James Craddock");
souls.push_back("2. Rebecca Romain");
souls.push_back("3. Michelle Rooney");
souls.push_back("4. Sally Gavin");
souls.push_back("5. Ezeikel DePrain");
souls.push_back("6. Phil Senton");
souls.push_back("7. Ryan Gates");
souls.push_back("8. Elizabeth Wank");

cout << "\nYou currently possess " << souls.size() << " souls.\n";

cout << "\nSouls possessed:\n" << endl;

for (int i = 0; i < souls.size(); ++i)
cout << souls[i] << endl;

string change, activity;
string answer;


cout << "\nPick an activity\n";
cin >> activity;

int transform = 0;


while
(activity == "change")
{cout << "Enter a number to assume the identity of a soul\n";
cin >> answer;

if (answer == "1")
identity = souls[0];//Reassign 'Naftali's' identity to one of vectors shown

if (answer == "2")
identity = souls[1];

if (answer == "3")
identity = souls[2];

if (answer == "4")
identity = souls[3];

if (answer == "5")
identity = souls[4];

if (answer == "6")
identity = souls[5];

if (answer == "7")
identity = souls[6];

if (answer == "8")
identity = souls[7];

while (answer != "1"&& answer !="2"&&answer !="3"&&answer !="4"&&answer !="5"&&
answer !="6"&&answer !="7"&&answer !="8")
{cout << "Sorry, incorrect entry. Please try again" << endl;
cin >> answer;}

cout << "++++++++++++++++++++++++++++++++++++++++++" << endl;
cout << "You have now transformed into soul number " << identity << endl;
++transform;
Powers -= 15;
cout << "\nThis is your transformation number " << transform << endl;
cout << "\nPower level: " << Powers << endl;
cout << "++++++++++++++++++++++++++++++++++++++++++" << endl;
cout << "\nPick an activity\n";
cin >> activity;
if (Powers <= 0 && activity == "change")
cout << "Your power levels are too low to make any more transformations" << endl;
cout << "Pick an activity" << endl;
}

while (activity == "meditate")
{
if (Powers < 100)
Powers += 10;
cout << "You have spawned back 10 points of your powers and now have " << Powers << " points" << endl;
cout << "Pick an activity" << endl;
cin >> activity;

}
if (Powers >= 100)
{
cout << "Your power levels are at their fullest and cannot be spawned any further" << endl;
cout << "Pick an activity" << endl;
cin >> activity;
}

system("PAUSE");
return 0;
}

Game Summary: Its basically about a half-angel, half-demon with the power of heaven and hell who can devour souls and assume their identities and talents. He can also heal from just about any injury and has all other kinds of cool abilities. I'm just working out what obstacles he has to overcome.

About a bajillion bugs are in this code, but debugging it is what is teaching me new things and reminding me all that I've learned so far so I don't forget. And next time, I think I'll stick to a plan. This code keeps evolving and developing a mind of it's own.

Sunday 17 May 2009

Good Incentive

Hey guys, need incentive to program games? Here's what the job's all about! Check out the whole site, it has a lot of useful info.

http://www.sloperama.com/advice/lesson15.htm

Topics Covered



1. Data types, Variables and Standard I/O: I covered this one a while back. I learned basic concepts like C++ and the details of a 'Hello, World!' code. I just wish I could learn more about the preprocessor directive (#include) but apparently I will in the future when I'm ready. I found this great site that's got data types in detail is from cplusplus.com

http://www.cplusplus.com/doc/tutorial/variables/

2. Truth, branching and game loops: Ah, now I'm getting warm. I finally cover the basics of what I believe I'll be using a lot in game programming. Note to self - Must pick up randomizers quick. Logical operators, switch statements and basic loops (if, while, do) are the order of the day.

3. For loops, strings and arrays: Call me dumb, but arrays have always been the bane of my existence. But since I started taking my training seriously, I realized they are not so bad. Even multidimensional arrays don't trouble me anymore. All it takes is focus and practise. For loops, I hear, are some of the most used devices in the game programming industry.

4. Standard Template Library: I'm still in this chapter. All (good) compilers usually grant the users access to a library of codes for future use. APIs like DirectX and OpenGL also make use of this concept but also offer images and soud for game programmers, but I digress. For now, I'm happy with a basic library, just to know what the hell I'm doing. I covered drawing on the library for components such as randomizers (ctime, cstdlib) and containers like vectors.
A good site for downloading great templates is SourceForge -

http://sourceforge.net/search/?type_of_search=soft&words=c%2B%2B

I just got into Algorithms. If you are tired of long-ass blog entries, never fear. I was simply filling you in on what's been done so far (see entry topic), so bring on the late nights and throbbing headaches. I was born for it!

Thursday 14 May 2009

So Far

Right now, I've got about 4 months to get up to speed before university woes ensue. My focus is the C++ Programming language. I've got so much material on C++, but very few of them actually make any kind of sense to me. At a glance, my library contains
- Jamsa Klander's C/C++ Programmer's Bible
- Beginning C++ Through Game Programming (Second Edition by Michael Dawson)
- NIIT's Programming in C++ Vol 1
- The C++ Programming Language (Third Edition) (by the creator of C++ - Bjarne Stroustrup)

and a plethora of site links, which I will fill you in on as I progress. Over time and trial and error, I have come to the conclusion that the absolute best start based on my resources would be Beginning C++ Through Game Programming. It's like £25 brand new and £15 fairly used, but you must get it with the CD which contains all the tutorial codes (http://www.amazon.co.uk/Beginning-Through-Game-Programming-Second/dp/1598633600/ref=sr_1_1?ie=UTF8&qid=1242298458&sr=8-1)

The book starts real slow which suits me to a point (hey, self taught C++ ain't no walk in the park you know) but picks up speed about three chapters in and just keeps gathering speed. It's important that you don't miss anything or skip any chapters to avoid getting stumped later.

When I'm done with this book, I believe I will be decent enough to proceed with Jamsa Klander's book. For now, I've got work to do (no I mean real, part-time Debenhams work. Night Shift can be a real energy burner) Next time, I'll go into detail on my training. For now, ciao!

Introduction

Hey all! Let me start by stating for those who are under the impression that this is a blog for a professional or even decent programmer that it in fact is not. I am a 21 year old who's only programming languages include Visual Basic, C# and C++. And even those, I'm not particularly profficient at.

In Visual Basic, I have only created the following: A word processing application, A calculator, A web browser, A client registration application for an insurance company and a couple of interactive novels (all incomplete). In C#, I am only that less profficient and let's just say that my C++ skills are at a work in progress stage. I was introduced to the world of computing at a relatively advanced age (17), but have developed a passion for it. I particularly love videogames and know that my love of programming was only taking me down one lane: Game Programming.

Now, if you are reading my blog, I can only assume two things, you love programming or you are a curious acquaintance of mine. For the latter, I say 'Hey there, what's crackalacking!', but for the former, you would be well aware of how challenging game programming can be. Right now, many would be thinking, how can a guy with 4 years experience with computers and a so-called passion still possess such relatively mediocre programming skills and then delude himself on a desire to become a game programmer. To those guys, I'll only say this once, I wasn't always so level-headed. I used to be a slacker and a day-dreamer. My acceptance into the University of Nottingham for a degree in Computer Science has changed all that.

This blog will encompass my journey from 'rookie' to 'programmer', however long that takes. I hope that for those of you out there who also hope to become programmers or any other kind of software developer, you can draw inspiration from my adventures (or misadventures) depending on the circumstances. For now, I simply say - "Buckle your seatbelt, darling! It's gonna be a bumpy ride!"