======Project: "Under the Hood" of Super Mario Bros======
A project for HPC by Brett Krisher during 2013.
This project was begun on 3/17/2013 and is anticipated to take X AMOUNT OF TIME. (Upon completion you can correct this with the actual length).
=====Objectives=====
State the purpose of this project. What is the point of this project? What do we hope to accomplish by undertaking it?
With this project I want to learn how super mario bros does what it does. More specifically I want to learn how the code itself is structured and how it functions. By undertaking this project I will also try to learn how the game genie changes the code to better suite the player.
=====Prerequisites=====
In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:
* Souce Code [[http://cboard.cprogramming.com/game-programming/24232-source-code-super-mario-bros.html|CODE]]
* Useful Word Editing tool such as Nano, VI
* game-genie
* Playing the game a few times either on an emulator or on the real thing
* experience2
* etc.
=====Background=====
State the idea or purpose of the project. What are you attempting to pursue?
*It is a seemingly simple game that is soo much more, the name: Super Mario Bros. The code for this game is what I'm after and I have found it. At least something that I think is close. With this project I want to understand how the code itself works and how I can alter it to my advantage with a device such as a game-genie.
Upon approval, you'll want to fill this section out with more detailed background information. DO NOT JUST PROVIDE A LINK.
Providing any links to original source material, such as from a project page, is a good idea.
You'll want to give a general overview of what is going to be accomplished (for example, if your project is about installing a web server, do a little write-up on web servers. What is it, why do we need one, how does it work, etc.)
=====Scope=====
Give a general overview of your anticipated implementation of the project. Address any areas where you are making upfront assumptions or curtailing potential detail. State the focus you will be taking in implementation.
One assumption that I have is that this code (which is for the DOS edition) is similar in style to how the original game is coded. Im going to have to change a little bit on how I can implement a code changing device like a game-genie.
=====Attributes=====
State and justify the attributes you'd like to receive upon successful approval and completion of this project.
* Better Understanding of what it takes to make a game: Something tells me that I might have to change my mindset on coding when it comes to making a game. I like to cruise when it comes to coding but when working with other people I might need to speed up my understanding.
* The ability to write better code: I know this one is a long shot, but by reading other people's code and then reading mine I seem to be lacking a certain element that I still need to find.
* etc...
=====Procedure=====
The actual steps taken to accomplish the project. Include images, code snippets, command-line excerpts; whatever is useful for intuitively communicating important information for accomplishing the project.
*the first step was to find the source code for this game but with the helpful tool known as google I have gotten it
*after unzipping the file I see that there are a bunch of picture files in a specific format along with a few object files
brett300x@The-One:~/Emulators/Mario Bros Source$ ls
BGRND001.PCX BLOCK002.PCX GAMEDEFS.H LEVEL002.DAT MARIO.OBJ SMB.DSK SMB.OBJ XBMTOOLS.H XLINE.H XPBITMAP.OBJ XRECT.OBJ
BGRND002.PCX BLOCK003.PCX KEY.C LEVEL003.DAT MARIO.PCX SMB.EXE SMB.PRJ XBMTOOLS.OBJ XLINE.OBJ XPOINT.H XVSYNC.H
BGRND003.PCX BLOCK004.PCX KEY.H LEVEL004.DAT SCORE.C SMBFUNC.C TCDEF.DPR XLIB.H XMAIN.OBJ XPOINT.OBJ XVSYNC.OBJ
BLOCK001.PCX COIN.PCX LEVEL001.DAT LOGO.PCX SMB.C SMB.H TCDEF.DSK XLIB.OBJ XPBITMAP.H XRECT.H
brett300x@The-One:~/Emulators/Mario Bros Source$
*Next step it to dissect the three main files SMB.C, KEY.C, SMBFUNC.C
*Under further inspection this code is for the MSDos edition of the game but it still severs a purpose. when looking at SMBFUNC.C I see that the code is cut up into individual parts which each on does a different part.
1 //SET UP ALL OF THE GRAPHICS AND OTHER JUNK//////////////////////////////////
2 void init()
3 {
4 int loop;
5 x_set_mode(X_MODE_320x240,320); //SET MODE X//
6 x_set_tripplebuffer(240); //INSTALL TRIPPLE BUFFER//
7 install_new_key_handler(); //INSTALL KEYBOARD HANDLER//
8 x_install_vsync_handler(1); //INSTALL VSYNC HANDLER//
9 for (loop=0;loop<52;loop++) //ALLOCATE MEM FOR GRAPHICS//
10 if ((data.block[loop]=(char far *)malloc(258))==NULL)
11 exitgame();
12 for (loop=0;loop<3;loop++)
13 if ((data.coin[loop]=(char far *)malloc(258))==NULL)
14 exitgame();
15 if ((bcoin=(cointype *)malloc(sizeof(cointype)))==NULL)
16 exitgame();
17 bcoin->next=NULL;
18 if ((bscore=(scoretype *)malloc(sizeof(scoretype)))==NULL)
19 exitgame();
20 bscore->next=NULL;
21 for (loop=0;loop<2;loop++)
22 {
23 player[loop].lives=3;
24 player[loop].level=1;
25 player[loop].screenx=0;
26 }
27 }
*this particular function which is initializing everything. As you can see on line 23 it is possible to go in and change the code itself to give you say 50 lives
=====Code=====
Upon completion of the project, if there is an applicable collection of created code, place a copy of your finished code within
blocks here.
/*
* hello.c - A sample "Hello, World!" program
*
* written by NAME for COURSE on DATE
*
* compile with:
* gcc -o hello hello.c
*
* execute with:
* ./hello
*/
#include
int main()
{
printf("Hello, World!\n"); // Output message to STDOUT
return(0);
}
=====Execution=====
Again, if there is associated code with the project, and you haven't already indicated how to run it, provide a sample run of your code:
lab46:~/src/cprog$ ./hello
Hello, World!
lab46:~/src/cprog$
=====Reflection=====
Comments/thoughts generated through performing the project, observations made, analysis rendered, conclusions wrought. What did you learn from doing this project?
The only thing the main file has in it are calls to other files. Hmm interesting.
=====References=====
In performing this project, the following resources were referenced:
* cboard.cprogramming.com/game-programming/24232-source-code-super-mario-bros.html
* URL2
* URL3 (provides useful information on topic)
* URL4
Generally, state where you got informative and useful information to help you accomplish this project when you originally worked on it (from Google, other wiki documents on the Lab46 wiki, etc.)