![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 | |
|
Professional Programmer
|
Text based game
Well, im about to embark on my very first program that will actually take some effort, well.. newb effort. This is going to be the hardest thing i've accomplished and i know i will finish because i never start something i wont finish because i believe its a waste of time if i dont finish, and i love programming! So.. here is the basics of the game:
Evil monsters Poisonous frog Fanged rabbit Seagul King cobra Toothless farmer(Boss) The game will consist of a hero(you) and there will be an experience system, health, mana, damage, and stats[Strength, Health, Agility]. It is a rpg type game that will simply let you level up to level 5, then you will face the farmer boss. Any help will be accepted, if your skills are needed.. not too much to help with though since its just text and im pretty sure i know how to do all of this on my own.. since it is infact another test for me. Any ideas will also be accepted if they appeal to me. I will update this thread daily, maybe every 2 days with the source, so people know what i've completed. The main purpose of this is so that i will understand more clearly the basics of a game platform, and how the system works in general. Hopefully will help other people once i get posting the first couple segments of code. The Stats system i first created will be used in this game, although it might be tweaked slightly, since it did work.. but there were definately some small problems with it. P.S The games name needs to be determined, so let me know if you have a name for it and it will most likely end up being called the name you decide, unless its something like "text game".. im looking for a little bit of a serious name.
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ Last edited by jayme; Nov 19th, 2005 at 8:39 PM. |
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
i would suggest using a pen and paper to carefully plan things out. as the program grows and you test it out, you'll discover most of your own mistakes and just crap you forgot or other stuff that would be neat to do. build piece by piece and get your basic framework up and running. after it "works" then you can tweak it ad nauseum. good luck!
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
BN's right - pencil and paper are the best way to go. Don't be afraid to get messy. I would personally start by drawing the GUI, then pull out every single element (both tangible, such as the player, enemies, and inventory, and non-tangible, such as movement, combat etc.) and detail exactly how they work. If you'll be using a database, draw an Entity-Relationship diagram. Draw pictures, write pseudocode, and do anything else you think might help before you even touch the compiler.
|
|
|
|
|
|
#4 | |
|
Professional Programmer
|
Here is the first part, the character creation process. It is based off the one i made when i first came here, but it has been fixed a bit so that there is now reseting, so that you can reselect your skill points if you dont like what you have. Also now you cant be stuck at 0 skill points when you reach intelligents, or agility even.. I think this part is pretty close to complete except for a few minor errors.
#include <iostream>
using namespace std;
int main()
{
int reset = 0;
int Points = 20; // These are the max points you can spend on your skills (agility, strength, and intelligents.
int Str; // This is your characters strength skill level.
int Int; // This is your characters intelligents skill level.
int Agi; // This is your characters agility skill level.
char Name[15]; // This is your characters name.
int Frog;
cout << "Welcome to Monster Fighter!\nThis is a text based game based on the RPG game-type.\n\n";
cout << "Created by: Jay[dX], www.deceptiondesigns.com\n";
/* Stats System */
cout << "Press enter to continue to the character creation proccess.\n\n"; // This is the initialization of the program. It tells you whats going to happen.
cin.get();
system("cls");
cout << "Name your character: "; // Character naming process.
cin >> Name;
cout << "Ok, so now we have your characters name.\n\n";
cout << "Now we will continue to your character's stats. You only have 20 points, so use them wisely.\n\n"; // Point system, add skill points to your abilities with these points.
system("cls");
/* This is the Strength skill code.*/
do {
do{ // This is the strength loop, if you enter a number larger than 20 or less than 1, you will be taken back to this step.
Points = 20;
cout << "Enter your strength: ";
cin >> Str;
if ( Str < 1 ) { // If the input is less than 1, the string below is executed and you will be asked to input a new integer.
cout << "You Must spend at least one point!\n\n";
}
if ( Str > Points - 2 ){ // If the input is greater than the existing points, the string below will be executed and you will be asked to input a new integer.
cout << "You don't have enough points!\n\n";
}
} while ( Str > Points - 2 || Str <= 0 );
cout << "Strength leveled up to " << Str << "!" << endl; // Lets you know that your selected integer was successfully added.
Points = Points - Str; // Adds the selected points on to strength and reduces that same amount from your remaining skill points.
cout << "You have " << Points << " skill points remaining.\n\n";
/* This is the Agility skill code.*/
do{ // This is the agility loop, if you enter a number larger than 20 or less than 1, you will be taken back to this step.
cout << "Enter your agility: ";
cin >> Agi;
if ( Agi < 1 ) { // If the input is less than 1, the string below is executed and you will be asked to input a new integer.
cout << "You Must spend at least one point!\n\n";
}
if ( Agi > Points - 1 ){ // If the input is greater than the existing points, the string below will be executed and you will be asked to input a new integer.
cout << "You don't have enough points!\n\n";
}
} while ( Agi > Points - 1 || Agi <= 0 );
cout << "Agility leveled up to " << Agi << "!" << endl; // Lets you know that your selected integer was successfully added.
Points = Points - Agi; // Adds the selected points on to agility and reduces that same amount from your remaining skill points.
cout << "You have " << Points << " skill points remaining.\n\n";
/* This is the Intelligents skill code.*/
do{ // This is the intelligents loop, if you enter a number larger than 20 or less than 1, you will be taken back to this step.
cout << "Enter your Intelligents: ";
cin >> Int;
if ( Int < 1 ) { // If the input is less than 1, the string below is executed and you will be asked to input a new integer.
cout << "You Must spend at least one point!\n\n";
}
if ( Int > Points ){ // If the input is greater than the existing points, the string below will be executed and you will be asked to input a new integer.
cout << "You don't have enough points!\n\n";
}
} while ( Int > Points || Int <= 0 );
cout << "Intelligents leveled up to " << Int << "!" << endl; // Lets you know that your selected integer was successfully added.
Points = Points - Int; // Adds the selected points on to intelligents and reduces that same amount from your remaining skill points.
cout << "You have " << Points << " skill points remaining.\n\n";
/* This is the last segment of the code, it prints to the screen the name of your new character and your characters stats. */
system ("cls");
cout << "Congratulations, you have created your character successfully!\n\nHere is your character:\n\nCharacter name: " << Name << "\nAgility:-------- " << Agi << "\nStrength:------- " << Str << "\nIntelligents:--- " << Int << "\n\n\n\n\n\n\n\n\n\n";
cout << "Enter either 1 to reselect hero skill points, or 0 to finish.";
do {
cin >> reset;
if ( reset > 1 || reset < 0 ) {
cout << "To reselect hero skill points enter\n1 = Yes, reselect skills.\n0 = No, they're fine.\n\n";
}
} while ( reset > 1 || reset < 0 );
system ("cls");
} while ( reset == 1 );
cin.get();
system("PAUSE");
}
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#5 | |
|
Caffeinated Neural Net
![]() Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,031
Rep Power: 5
![]() |
Quote:
@jayme: There are two things that will improve that code a lot. First, you should use a function to get the user's input, rather than hard-coding it for each attribute. For example: // assumes you have a variable called pointsRemaining that // is properly initialized cout << "Please enter your character's strength: "; strength = getStat(pointsRemaining); // get the strength score pointsRemaining -= strength;// reduce the number of points left Second, every time (this means every time!) that you get input from the user, verify that it's valid. Sometimes this means checking to make sure it's the right type of data (I guarantee your program will choke if the user enters "abc" for their strength score), and other times it means validating that the data falls within acceptable limits (is a number from 1 to 20, for example), or matches a pattern (useful when checking if something is, say, a valid postal/ZIP code, email address, or whatever). Minor nitpick: it's 'intelligence', not 'intelligents'. ![]()
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick Last edited by lectricpharaoh; Nov 21st, 2005 at 5:27 PM. |
|
|
|
|
|
|
#6 | |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Quote:
![]() |
|
|
|
|
|
|
#7 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
"G" stands for "gay" :p
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
|
|
#8 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
GUI -> Gay User Interface
LOL |
|
|
|
|
|
#9 | |
|
Professional Programmer
Join Date: Mar 2005
Location: Student of University of Mumbai, Maharashtra State, India
Posts: 344
Rep Power: 4
![]() |
Quote:
Graphical User Interface and google wud find the definitions http://www.google.co.in/search?hl=en...e%3A+GUI&meta= and..webopedia http://www.webopedia.com/TERM/G/Grap...rface_GUI.html Have fun reading!
__________________
Visit: http://www.somaiya.edu |
|
|
|
|
|
|
#10 |
|
Programmer
Join Date: Oct 2005
Location: UK, South West
Posts: 33
Rep Power: 0
![]() |
no thats only if it's programmed in java.
Your code looks well organized, and programming syntax is good. apart from the systems options, i have always been told to trie and avoid these, as it can cause cross platform programming problems. use getch(); instead. Keep up the good work.
__________________
The GNU documentation says that this bit is set when the stream is "unusable". Presumably the intent is that once this bit becomes set, all bets are off on that stream forever. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|