Adventures in Game Development -- Day 11

14 comments



Today I'm going to update my progress on WEP Cracking: The Game. Unfortunately, life and learning C++ has gotten in the way, so I haven't made much progress on the game. Despite this, there has been at least a little progress.

First, I'll explain the progress I've made. Then, I'll post my source code so far.

So far I have the beginning output that explains what the game is and gives the player its first instructions. After receiving that instruction, the player is asked to "download" a copy of Backtrack Linux. If they type "download" correctly, a download is simulated. After that, the player is tasked with burning the copy of Backtrack Linux and inserting the burned CD. The simulation for the first task runs at the same speed as the download, but the disc insertion simulation is faster.

After that, the last command of booting the Live CD is outputted. Unfortunately, that's only as far as I have gone. I also only have commands for successful execution of the instructions, not for unsuccessful executions.

It's still a work in progress, but I plan on working on the game this week and updating on the progress here each day this week.


Source Code:


#include <iostream>
#include <ctime>
#include <string>
#include <windows.h>

using namespace std;

int main()
{
    string cInstall;
    
    cout << "Welcome to WEP Cracking: The Game. The goal of WEP Cracking: The Game is to teach computer users how to test the strength of their network security. Playing this game from start to finish will give you all of the information you need to attempt to crack the password on your own router." << endl;
    cout << "Let's begin" << endl;
    cout << "First, download a copy of BackTrack Linux by typing DOWNLOAD" <<endl;
    
    getline (cin, cInstall);
    cin >> cInstall;
    
    if((cInstall == "download") || (cInstall == "DOWNLOAD") || (cInstall == "Download"))
    {
          cout << "Beginning download" << endl;
          cout << "1 2 3 4 5" << endl;
          Sleep(150);
          cout << "6 7 8 9 10" << endl;
          Sleep(150);
          cout << "11 12 13 14 15" << endl;
          Sleep(150);
          cout << "16 17 18 19 20" << endl;
          Sleep(150);
          cout << "21 22 23 24 25" << endl;
          Sleep(150);
          cout << "26 27 28 29 30" << endl;
          Sleep(150);
          cout << "31 32 33 34 35" << endl;
          Sleep(150);
          cout << "36 37 38 39 40" << endl;
          Sleep(150);
          cout << "41 42 43 44 45" << endl;
          Sleep(150);
          cout << "46 47 48 49 50" << endl;
          Sleep(150);
          cout << "51 52 53 54 55" << endl;
          Sleep(150);
          cout << "56 57 58 59 60" << endl;
          Sleep(150);
          cout << "61 62 63 64 65" << endl;
          Sleep(150);
          cout << "66 67 68 69 70" << endl;
          Sleep(150);
          cout << "71 72 73 74 75" << endl;
          Sleep(150);
          cout << "76 77 78 79 80" << endl;
          Sleep(150);
          cout << "81 82 83 84 85" << endl;
          Sleep(150);
          cout << "86 87 88 89 90" << endl;
          Sleep(150);
          cout << "91 92 93 94 95" << endl;
          Sleep(150);
          cout << "96 97 98 99" << endl;
          Sleep(150);
          cout << "100%" << endl;
          Sleep(150);
          cout << "Download complete." << endl;
          
          cout << "Next, we have to burn our BackTrack Linux ISO to a disc." << endl;
          Sleep(100);
          cout << "Type BURN to burn a disc" << endl;
          
          string sBurn;
          
          cin >> sBurn; 
          
          if((sBurn == "burn") || (sBurn == "BURN") || (sBurn == "Burn"))
          {
                 cout << "Beginning disc burn" << endl;  
                 cout << "1 2 3 4 5" << endl;
                 Sleep(150);
                 cout << "6 7 8 9 10" << endl;
                 Sleep(150);
                 cout << "11 12 13 14 15" << endl;
                 Sleep(150);
                 cout << "16 17 18 19 20" << endl;
                 Sleep(150);
                 cout << "21 22 23 24 25" << endl;
                 Sleep(150);
                 cout << "26 27 28 29 30" << endl;
                 Sleep(150);
                 cout << "31 32 33 34 35" << endl;
                 Sleep(150);
                 cout << "36 37 38 39 40" << endl;
                 Sleep(150);
                 cout << "41 42 43 44 45" << endl;
                 Sleep(150);
                 cout << "46 47 48 49 50" << endl;
                 Sleep(150);
                 cout << "51 52 53 54 55" << endl;
                 Sleep(150);
                 cout << "56 57 58 59 60" << endl;
                 Sleep(150);
                 cout << "61 62 63 64 65" << endl;
                 Sleep(150);
                 cout << "66 67 68 69 70" << endl;
                 Sleep(150);
                 cout << "71 72 73 74 75" << endl;
                 Sleep(150);
                 cout << "76 77 78 79 80" << endl;
                 Sleep(150);
                 cout << "81 82 83 84 85" << endl;
                 Sleep(150);
                 cout << "86 87 88 89 90" << endl;
                 Sleep(150);
                 cout << "91 92 93 94 95" << endl;
                 Sleep(150);
                 cout << "96 97 98 99" << endl;
                 Sleep(150);
                 cout << "100%" << endl;
                 Sleep(150);
                 cout << "Burn complete." << endl;
                 Sleep(350);
          
                 cout << "Disc being inserted" << endl; 
                 cout << "1 2 3 4 5" << endl;
                 Sleep(50);
                 cout << "6 7 8 9 10" << endl;
                 Sleep(50);
                 cout << "11 12 13 14 15" << endl;
                 Sleep(50);
                 cout << "16 17 18 19 20" << endl;
                 Sleep(50);
                 cout << "21 22 23 24 25" << endl;
                 Sleep(50);
                 cout << "26 27 28 29 30" << endl;
                 Sleep(50);
                 cout << "31 32 33 34 35" << endl;
                 Sleep(50);
                 cout << "36 37 38 39 40" << endl;
                 Sleep(50);
                 cout << "41 42 43 44 45" << endl;
                 Sleep(50);
                 cout << "46 47 48 49 50" << endl;
                 Sleep(50);
                 cout << "51 52 53 54 55" << endl;
                 Sleep(50);
                 cout << "56 57 58 59 60" << endl;
                 Sleep(50);
                 cout << "61 62 63 64 65" << endl;
                 Sleep(50);
                 cout << "66 67 68 69 70" << endl;
                 Sleep(50);
                 cout << "71 72 73 74 75" << endl;
                 Sleep(50);
                 cout << "76 77 78 79 80" << endl;
                 Sleep(50);
                 cout << "81 82 83 84 85" << endl;
                 Sleep(50);
                 cout << "86 87 88 89 90" << endl;
                 Sleep(50);
                 cout << "91 92 93 94 95" << endl;
                 Sleep(50);
                 cout << "96 97 98 99" << endl;
                 Sleep(50);
                 cout << "100%" << endl;
                 Sleep(50);
                 cout << "Download complete." << endl;
                 Sleep(150);               
 }
          
          else
          {
                 cout << "Please type BURN" << endl;
          }
          
          system("pause");
          return 0;
    }
    
    else 
    {
         cout << "Please type DOWNLOAD" << endl;
    }
}

Adventures in Game Development -- Day 10

9 comments
While working through C++ Demystified, I found a cool little code example called "The Change Machine". Here is the code:

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

int main()
{
    int total, dollars, quarters, dimes, nickels, leftover;
    cout << "Enter number of pennies to make change for: ";
    cin >> total;
    
    dollars = total / 100;
    leftover = total % 100;
    quarters = leftover  / 25;
    leftover %= 25;
    dimes = leftover / 10;
    leftover %= 10;
    nickels = leftover / 10;
    leftover %= 5;
    
    cout << "Dollars: " << dollars << endl;
    cout << "Quarters: " << quarters << endl;
    cout << "Dimes: " << dimes << endl;
    cout << "Nickels: " << nickels << endl;
    cout << "Pennies: " << leftover << endl;
    
    system("pause");
    return 0;
}
As the name implies, this program works by having the user input a number, then the change that could be made out for that number (in dollars) is outputted. Compile in an IDE to test it out for yourself!

Adventures in Game Development -- Day 9

15 comments


Lately I've been having trouble following through with the books I'm reading to learn C++. My problem isn't with growing bored of the books, but instead I just find myself confused and disoriented with the examples about halfway through. 

For example, I tried reading -- the highly recommended -- "Without Fear C++". I was doing great with the book, until I got to around page 150. All of a sudden, the examples began using stuff that I wasn't familiar with. A few pages later, I had to drop the book because I was confused about what was happening. It felt as though I had skipped a chapter or something because nothing was making any sense to me. 

Without Fear C++ was about the third book I'd tried to read and had to end up dropping for the reason mentioned above. I probably haven't been reading the best C++ books available, but if this keeps continuing, my problem is going to get very frustrating. 

Today, I went to my local library and picked up two C++ books they had there: C++ Demystified, and C++: A Beginner's Guide. So far, I am 83 pages through C++ Demystified, and I'm following along pretty well. Nothing has jumped out and scarred me in the code, so I am optimistic  that this is the right C++ book for me. 

However, the book doesn't look to cover the advanced parts of C++ and only dabbles into object-oriented programming -- one of the biggest, if not the biggest part of C++. This is where C++: A Beginners Guide looks to jump in as it covers everything from object-oriented programming to polymorphism. 

Now a question for you readers. Is there any great C++ books you would recommend. I'm looking into getting C++ Primer 5th Edition, as I've heard good things about it. If there are any C++ books you want to recommend, please leave them in the comments and I'll look into them. 

Adventures in Game Development -- Day 8

15 comments



Today I learned a pretty cool function in C++. Unfortunately, this cool function isn't as awesome as it could be as it isn't cross-platform.

The function is the the "sleep function". To use it, you simply type "Sleep()" (capitalization is important) along with a number in between the paranthesis. The number between the parenthsis determines how long the code "sleeps" before it begins again.

I used this function in WEP Cracking: The Game to better simulate downloading a copy of BackTrack Linux. Here's some example code:




    getline (cin, cInstall);
 
    if((cInstall == "download") || (cInstall == "DOWNLOAD") || (cInstall == "Download"))
    {
          cout << "Beginning download" << endl;
          cout << "1 2 3 4 5" << endl;
          Sleep(150);
          cout << "6 7 8 9 10" << endl;
          Sleep(150);
          cout << "11 12 13 14 15" << endl;
          Sleep(150);
          cout << "16 17 18 19 20" << endl;
          Sleep(150);
          cout << "21 22 23 24 25" << endl;
          Sleep(150);
          cout << "26 27 28 29 30" << endl;
          Sleep(150);
          cout << "31 32 33 34 35" << endl;
          Sleep(150);
          cout << "36 37 38 39 40" << endl;
          Sleep(150);
          cout << "41 42 43 44 45" << endl;
          Sleep(150);
          cout << "46 47 48 49 50" << endl;
          Sleep(150);
          cout << "51 52 53 54 55" << endl;
          Sleep(150);
          cout << "56 57 58 59 60" << endl;
          Sleep(150);
          cout << "61 62 63 64 65" << endl;
          Sleep(150);
          cout << "66 67 68 69 70" << endl;
          Sleep(150);
          cout << "71 72 73 74 75" << endl;
          Sleep(150);
          cout << "76 77 78 79 80" << endl;
          Sleep(150);
          cout << "81 82 83 84 85" << endl;
          Sleep(150);
          cout << "86 87 88 89 90" << endl;
          Sleep(150);
          cout << "91 92 93 94 95" << endl;
          Sleep(150);
          cout << "96 97 98 99" << endl;
          Sleep(150);
          cout << "100%" << endl;
          Sleep(150);
          cout << "Download complete." << endl;


Now for the bad...

This function requires the windows header file, which means it is not cross-platform. This is enough for me to NOT use it in the final product. I have it in there now because I was learning about it, but before I'm finished, I'll be swapping it with a cross-platform alternative.

It really sucks because "Sleep()" is quick, easy, and fills a specific need. Hopefully the alternative I find is just as easy.

Adventures in Game Development -- Day 7

14 comments
The beginning of WEP Cracking: The Game

Today I decided to take a break from C++ and apply my current programming knowledge to start making a small console application game.

The game, tentatively titled "WEP Cracking: The Game" (I know, it's so original), is meant to teach people how to test the security of their home networks by attempting to crack the WEP code on their wireless router. The game is unfortunately quite simple and will only really be able to be played once per player. However, that is fine for my very first game.

My goal is from now on is to continue learning C++ and continue developing "WEP Cracking: The Game". From there, I plan to either move onto -- the pesky -- Allegro 5 and build some graphical games or stay with console applications for one more game and create a simple text adventure.

Either way, games are being made and I am happy :)

Adventures in Game Development -- Day 6

10 comments


Another day, another C++ lesson.

Today was a bit of a miss for learning C++. I'm still very motivated to learn, but other, more important things got in the way. Despite that, I did learn two new things.

The first was functions. In my previous programming experience with RobotC, we called these sub-routines. Basically, functions allow you to constuct some code and call on it easily throughout your program with a simple declaration statement. This makes pieces of code that need to be repeated throughout a program much easier to write and manage.

The second thing I learned, which is tied to functions, is recursion. Recursion isn't very easy to explain, so I won't bother trying. The concept is fairly easy to pick up, but it's one of those things that I'm not really confident in my knowledge of it. Tomorrow I'm going to go over recursion once again and make sure it sticks in my head.

The amount of stuff that I'm eager to learn is a bit overwhelming, but I just have to keep reminding myself: "slow and steady wins the race".

Adventures in Game Development -- Day 5

24 comments


Today was another C++ day.

I've pretty much mastered the basics of C++. From memory, I can structure a C++ document, input and output information from the console, declare and give value to variables, create while, do, and for loops, and if/else statements.

While I have mastered that much, it's only a small amount of the language. There is still LOTS I have to learn.

 The newest thing I learned today was how to create random numbers. I only learned how to use the simplified rand() function, but it will serve me well for now. There is a much more complex way of producing random numbers, which also produces a better result, but that is past my current skill level.

Adventures in Game Development -- Day 4

6 comments


Today started with me spending some more time with Allegro. After a few hours of messing with Allegro, I've decided to go back and learn some more C++

That's pretty much it for day 4. Sorry for the small blogpost, but there isn't any more to say. Hopefully tomorrow I will learn some cool things in C++ that I can discuss tomorrow.

Adventures in Game Development -- Day 3

8 comments


After my terrible failures yesterday in regards to installing SDL and Allegro, today turned out to be 100% better.

My main focus of the day was to get Allegro up and running. I started early this morning and was determined to not stop until Allegro was fully functioning. About three hours later, Allegro 5 was fully installed with Visual Studio 2010 and I was happy.

But not everything is sunshine and rainbows.

While being able to work with the latest and greatest Allegro 5 is great, it is so new that there are barely any tutorials for it. Books, such as the popular "Game Programming All in One" only support Allegro 4. I'm now stuck trying to decifer how to use Allegro 5 with barely any guidance.

It is becoming quite clear that this is going to be a difficult journey, but I'm ready for it.

Adventures in Game Development -- Day 2

9 comments



To start day 2, I read up on some more of the basic C++ topics. I didn't get too far into reviewing the topics though before getting bored. I decided to take a break from basic C++ and move over to using SDL.

I attempted to install SDL with Dev-C++ using this guide at LazyMonkey. Unfortunately, it didn't work out as planned and I kept getting an error. Thinking it was just Dev-C++, I moved over to Visual Studio 2010 and attempted to install SDL there. Once again though, I failed. Finally I went out on a limb and tried using SDL with Eclipse. The guide at LazyMonkey shows how to install SDL with Eclipse, but the guide is outdated and the location of some settings have changed.

So to summarize the above paragraph, I'm a colossal failure.

Frustrated, I decided to go back to learning C++. I spent the rest of my day switching between learning C++, and trying to install the Allegro API. Much like SDL, I failed multiple times trying to get Allegro working.
Hopefully tomorrow I can get SDL or Allegro working so that I can begin working on games. But for now, I'm going to continue learning C++.

Adventures in Game Development -- Day 1

11 comments


Day 1 consisted of me learning C++. As I said in my introduction, I have a programming background, so going through the basics of C++ was review for the most part.

Some of the topics I went over were:

  • Compiling and executing code
  • Comments
  • Whitespace
  • Main function
  • Input/Output
  • Namespaces
  • Including header files
  • Variables
  • Variable conversions
  • Constant variables
  • Macros
  • Scope
  • Arithmetic operations
  • Operators
  • If/ Else statements
  • Switch statements
  • While loops
  • Arrays

It's so far, so good concentration-wise. When I tried to learn Visual Basic, I found it so boring that my mind was wandering and I couldn't focus. I made my way halfway through VB 2010 and just gave up. But with C++, I feel so much more motivated and interested. Plus, my productivity is so much better with C++  Hopefully my love of C++ grows and I don't end up getting bored.

That's all for today. Tomorrow I plan on learning more C++ and experimenting with some 2D game engines in between learning sessions.

Cha Cha Cha Cha Changes

3 comments



So, only a little over two weeks in and I've decided that tutorial making isn't for me. I sort of enjoyed making them, but planning, recording, editing, etc. takes a long time. Plus, I wasn't completely happy with the product I was putting out.

Now that I've covered why I'm changing, we need to discuss what I am changing to.

Starting the other day, I decided to take up learning C++ and video game development. I've previously learned HTML and CSS, and I've dabbled in the incredibly boring and monotonous Visual Basic, so I'm going into C++ with previous programming experience.

From here on out, I'll be writing a daily blog about my adventures with video game design. As part of this shakeup, I'll be deleting my old posts (whenever I get around to it) and more importantly, changing my blog name. I'm not sure what to change my blog name to, so I'm letting the commenters on this blog to pick. 

So there you have it. A new blog style, a new blog name, a new blogger (as in person who blogs, not the name of this service). I hope the fans of my tutorial videos stick around and follow me through my game development adventures.

Thanks for reading.