Adventures in Game Development -- Day 20

Next week I have exams, so this week is boring, with very little game development going on. As I have to spend a lot of time studying, I have only a little bit of time to read about C++, but not implement anything.

Tomorrow though, I will discuss prototyping functions, which is something I just recently learned.

Thank you for continuing to follow and comment on this blog. Once the next two weeks are over, I'll be on summer vacation and in game development overdrive :)

Adventures in Game Development -- 19

Hey guys, unfortunately I don't have a great update for today. Instead, I have a pretty boring update.

Today was spent learning more C++. I have pretty much mastered all of the C parts of C++. For most that probably sounds stupid, so I'll explain it.

C++ is a language that sort of has two sections. The first section -- the C part -- is the procedural aspect of the C++. This is pretty much all of the stuff I've covered so far in this blog. The second section of C++ is object oriented. I don't know much about object oriented programming -- yet -- so I'll just tell you that this portion of C++ allows for jumping around the program.

Considering C++ was originally called C with Classes, object oriented programming is a very important part of C++ and something that I need to start learning right away.

Adventures in Game Development -- Day 18

Today I took me first steps in learning Python. I didn't know much about the language before stepping in, other than it was easier than C++. Now, after having learned some of the language, I can safely say that it is much easier.

Here are some examples of how Python is easier than C++:

To declare any variable in C++, you have to precede the variable name with a type, like

Int variablename;
Char variablename;

But in Python, you don't need to give a type, the language figures that out itself. So for example, this is how you declare a variable in Python

Variablename = 10

As you can see from above, Python also doesn't need anything to represent ending a line. So while you type a semi-colon is C++ to end the line, you type nothing and just move onto the next line in Python.

Outputting to the console is also much easier in Python. Here's some basic output in C++

Int variablename = 10;

cout << "The variable name equals " << variablename << endl;

The same in Python is

variablename = 10

print "The variable name equals", variablename

Finally, if/elseif/else statements are also easier in Python. An if/else statement in C++ is written like this

if(variablename > typename)
       cout << "variablename is greater than typename << endl;
       cout << "variable name is not greater than typename << endl;

The same exact statement in Python is

if variablename > typename:
       print "variablename is greater than typename
       print "variable name is not greater than typename

This is why I really like Python. While it may be slower than C++ and other programming languages in execution, its very English-like syntax makes it quite easy to write.

Follow My Other Blogs

While I always enjoy blogging about my experiences learning to program, I also enjoy blogging about other things. Because of this, I have started two other blogs.

You can click the links below to follow my other blogs:
Thank you in advance for supporting my other blogging endeavors.

Adventures in Game Development -- Day 17


Today I embarked on learning some of the Python programming language. Python is a scripting language which makes it great for implementing into C++. Because of this, I feel that it is good to know while I'm finishing up learning C++

So far Python has been quite easy. Python aims to be more like English than C++, which makes learning it fast quite easy.

I hope to learn Python quickly and mabey pickup Pygame (an off-shoot of SDL for Python) before I beging writing a game with regular SDL and C++.

Adventures in Game Development -- Day 16

After making my WEP cracking game more efficient, I decided to take a little break from it by working with SDL. For those who don't remember, SDL is the graphics API for C++ that will allow me to make graphical games. Unfortunately, there is quite a learning curve for SDL.

So far, I've had lots of trouble trying to learn SDL. My biggest problem is that there aren't many good tutorials that guide you through all of the SDL functions. I can learn the syntax of C++ and the syntax of SDL, but I'm having trouble gluing them together.

The tutorials I've used so far have been unsuccessful. However, I found a tutorial website that looks to be better than what I've found so far. For the next week or so, I'll be covering one tutorial from the SDL portion of the site  per day.

Here's a link to the site for anyone who wants to check it out:

Adventures in Game Development -- Day 15

Today was all about the for loop. In my previous code examples I showed how I was simulating a download progress bar in the command prompt, but it wasn't very efficient. This has been solved with the use of the for loop. Here's the new code using the for loop:

     cout << "Beginning download" << endl;
     int begin = 1;
          for(begin; begin <=100; begin++)
                    cout << begin << endl;
Basically, this loop is given three commands. The first command tells it that the integer  "begin" is being used. The second command tells it to display what is inside the loop while it is less than or equal to 100. The final statement tells the program to increment each time the loop is passed. Inside the loop, the integer "begin" is displayed, and the compiler sleeps for two milliseconds in between each display.

Once compiled and run, this loop displays the numbers 1 through 100, with a two millisecond delay in between.

Adventures in Game Development -- Day 14

So today I'm going to tell you how what the code from yesterday means. Opposed to going line by line, explaining everything, I'm instead just going to explain what the major parts of the program mean.

First, "cin" means console input. This is where people type into the console.

"if(selection == 1)"  means that if the user inputs one as their selection, the following code will execute.

"cout" means console output. This is all of the stuff that gets displayed in the console window.

"Sleep()" is a function I have explained before. Basically, it pauses the output in the console.

"endl;" ends the line. This pretty much simulates pressing the "enter" button in the console output.

Any text between quotation marks are strings.

"else" is what executes if the user types anything other than 1 (more options will be added soon).

"char" is a character.

"||" is an or operator.

Hopefully I've explained everything that may be foreign to someone who doesn't know C++. If you use the above as a guide, you should be able to piece together at least a basic understanding of what is happening. Trust me, none of this is advanced so anyone with at least a little bit of knowledge in C++ won't even need the above information. If you have any trouble understanding what is happening, I recommending reading a basic C++ tutorial online.

Adventures in Game Development -- Day 13

As promised, here is how the content of yesterday's blog will be implemented into WEP Cracking: The Game.

 cin >> iSelection;
                 if (iSelection == 1)
                    cout << "BackTrack Linux is starting." << endl;
                    cout << "Starting up__" << endl;
                    cout << endl;
                    cout << "sd 2:0:0:0: [sda] Assuming drive cache: write through." << endl;
                    cout << "sd 2:0:0:0: [sda] Assuming drive cache: write through." << endl;
                    cout << "Loading, please wait..." << endl;
                    cout << "Setting preliminary keymap...";
                    cout << "done" << endl;
                    cout << "Setting the system clock." << endl;
                    cout << "Starting basic networking...done." << endl;
                    cout << "Starting kernel event manager...done." << endl;
                    cout << "Loading hardware drivers...done." << endl;
                    cout << endl;
                    cout << endl;
                    cout << ". " << endl;
                    cout << "Setting the system clock." << endl;
                    cout << "Loading kernel modules...Loading manual drivers...done." << endl;
                    cout << "Setting kernel variables (/etc/sysct1.conf)...done" << endl;
                    cout << "Setting kernel variables(/etc/sysct1.d/10-console-messages.conf)...done." << endl;
                    cout << "Setting kernel variables(/etc/sysct1.d/10-network-security.conf)...done." << endl;
                    cout << "Setting kernel variables(/etc/sysct1.d/10-process-security.conf)...done." << endl;
                    cout << "Setting kernel variables(/etc/sysct1.d/wine.sysct1.conf)...done." << endl;
                    cout << "Starting early crypto disks...done." << endl;
                    cout << "Starting remaining crypto disks..." << endl;
                    cout << "done." << endl;
                    cout << "Checking file systems..." << endl;
                    cout << "fsck 1.41.3 done." << endl;
                    cout << "Mounting local filesystems...done." << endl;
                    cout << "Activating swapfile swap...done." << endl;
                    cout << "Skipping firewall: wfw(not enabled)...done." << endl;
                    cout << "Setting up console font and keymap..." << endl;
                    cout << "done." << endl;
                    cout << "Loading cpufreq kernel modules..." << endl;
                    cout << "done." << endl;
                    cout << "Loading ACPI modules..." << endl;
                    cout << "Starting ACPI services..." << endl;
                    cout << "Starting system log daemon..." << endl;
                    cout << "Doing Wacon setup..." << endl;
                    cout << "Starting kernel log daemon..." << endl;
                    cout << "done." << endl;
                    cout << "Starting system message bus: dbus." << endl;
                    cout << "CPUFreq Utilities: Setting ondemand CPUFreq governor...disabled, governor not available...done." << endl;
                    cout << "xserver-xorg postinst warning: overwriting possibly-customized configuration" << endl;
                    cout << "             file: backup in /etc/X11/xorg.conf.200911261994438" << endl;    
                    cout << "Starting Hardware abstraction layer: held" << endl;
                    cout << "Starting System Tools Backends: system-tools-backends." << endl;
                    cout << "Starting periodic command scheduler: crond." << endl;
                    cout << endl;
                    cout << "Backtrack 4 Penetration Testing and Auditing Distribution" << endl;
                    cout << endl;
                    cout << "Type 'startx' (without quotations)" << endl;
                    long istartx;
                    cin >> istartx;
                    if(istartx == 'STARTX' || istartx == 'startx')
                               cout << "root9bt:~# " << istartx << endl;
                               cout << endl;
                               cout << "X: warning: process set to priority -1 instead of requested priority 0" << endl;
                               cout << "X.Org X Server 1.5.2" << endl;
                               cout << "Release Date:10 October 2008" << endl;
                               cout << "X Protocol Version 11, Revision 0" << endl;
                               cout << "Build Operating System: Linux 2.6.24-19-server i686 Ubuntu" << endl;
                               cout << "Current Operating System: Linux bt #3 SMP Mon May 25 18:50:05 EDT 2009 i686" << endl;
                               cout << "Build Date: 09 March 2009  10:48:54AM" << endl;
                               cout << "xorg-server Z:1.5.Z-Zubuntu3.1 (builddProthera.buildd)" << endl;
                               cout << "            Build reporting problems, check" << endl;
                               cout << "            to make sure that you have the latest version" << endl;
                               cout << "Module loader present" << endl;
                               cout << "Markers: (--) probed, (**) from config file, (xx) default setting," << endl;
                               cout << "         (++) from command line, (!!) notice, (II) informational," << endl;
                               cout << "         (ww) warning, (EE) error, (N1) not implemented, (??) unkown." << endl;
                               cout << "(==) Log file: '/var/log/Xorg.0.log', Time: Thu Mov 26 19:44:47 2009" << endl;
                               cout << "(==) Using config file: '/etc/X11/xorg.conf'" << endl;
                               cout << endl;
                               cout << endl;
                     cout << "GAME OVER: You made the wrong selection" << endl;
                     cout << "Press X to exit" << endl;
                     char letter = 'X';
                     cin >> letter;
                     cout << "Type 'X' (without quotations) to exit" << endl;
                     if (letter == 'X' || letter == 'x')
                        cout << "Exit" << endl;

For those who aren't C++ programmers, I'll explain what this all means tomorrow.

Adventures in Game Development -- Day 12

Today I made some more progress in WEP Cracking: The Game. The progress made today was in recording what happens when booting into BackTrack Linux. For those who have never used BackTrack Linux, there is a command prompt at the beginning and it is full of computer jargon. Unfortunately, I had to copy it all down... and it took a while.

Here's what I wrote down:

sd 2:0:0:0: [sda] Assuming drive cache: write through.
sd 2:0:0:0: [sda] Assuming drive cache: write through.
Loading, please wait...
Setting preliminary keymap...done.
Setting the system clock.
Starting basic networking...done.
Starting kernel event manager...done.
Loading hardware drivers...done.

Setting the system clock.
Loading kernel modules...Loading manual drivers...done.
Setting kernel variables (/etc/sysct1.conf)...done.
Setting kernel variables(/etc/sysct1.d/10-console-messages.conf)...done.
Setting kernel variables(/etc/sysct1.d/10-network-security.conf)...done.
Setting kernel variables(/etc/sysct1.d/10-process-security.conf)...done.
Setting kernel variables(/etc/sysct1.d/wine.sysct1.conf)...done.
Starting early crypto disks...done.
Starting remaining crypto disks...done.
Checking file systems...fsck 1.41.3 done.
Mounting local filesystems...done.
Activating swapfile swap...done.
Skipping firewall: wfw(not enabled)...done.
Setting up console font and keymap...done.
Loading cpufreq kernel modules...done.
Loading ACPI modules...
Starting ACPI services...
Starting system log daemon...
Doing Wacon setup...
Starting kernel log daemon...done
Starting system message bus: dbus.
CPUFreq Utilities: Setting ondemand CPUFreq governor...disabled, governor not available...done.
xserver-xorg postinst warning: overwriting possibly-customized configuration
file: backup in /etc/X11/xorg.conf.200911261994438
Starting Hardware abstraction layer: hald
Starting System Tools Backends: system-tools-backends.
Starting periodic command scheduler: crond.
Backtrack 4 Penetration Testing and Auditing Distribution

Cin startx

X: warning: process set to priority -1 instead of requested priority 0
X.Org X Server 1.5.2
Release Date:10 October 2008
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24-19-server i686 Ubuntu
Current Operating System: Linux bt #3 SMP Mon May 25 18:50:05 EDT 2009 i686
Build Date: 09 March 2009 10:48:54AM
xorg-server Z:1.5.Z-Zubuntu3.1 (builddProthera.buildd)
Build reporting problems, check
to make sure that you have the latest version
Module loader present
Markers: (--) probed, (**) from config file, (xx) default setting,
(++) from command line, (!!) notice, (II) informational,
(ww) warning, (EE) error, (N1) not implemented, (??) unkown.
(==) Log file: "/var/log/Xorg.0.log", Time: Thu Mov 26 19:44:47 2009
(==) Using config file: "/etc/X11/xorg.conf"
The few "Sleep()" functions and such are added in by me for future reference to help me simulate the experience in the game. However, the rest of it is exactly how it appears when booting BackTrack Linux.

Tomorrow I'll blog about how the above is implemented into the code.