![]() |
|
![]() |
|
|
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. I had a the basics done before, but found many problems so i had re-done the whole thing, which isnt too much. Here is what is done so far, let me kno what you think. #include <iostream.h>
int main()
{
int reset = 0;
int mStrength = 0;
int mIntelligence;
int mAgility;
int mPoints = 20;
char mName[15];
cout << "~=~Welcome to Monster fighter version 0.01!~=~\n\nThe basics of the game will be created in this portion of the text based game \ncalled 'Monster Fighter'. Although the name of the game may vary during the\nprocess, I would still appreciate you call it by the appropriate name.\n\nPress enter proceed to the character creation process...";
cin.get();
system("cls");
cout << "First of all, you must name your character: ";
cin >> mName;
do {
mPoints = 20;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter strength: ";
do {
cin.clear ();
if (cin.sync ());
mStrength = 0;
cin >> mStrength;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mStrength >= mPoints - 2 || mStrength < 1) cout << "Enter a value between 1 and " << mPoints - 2 << ": ";
} while ( mStrength > mPoints - 2 || mStrength < 1 );
mPoints = mPoints - mStrength;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter agility: ";
do {
cin.clear ();
if (cin.sync ());
cin >> mAgility;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mAgility > mPoints -1 || mAgility < 1) cout << "Enter a value between 1 and " << mPoints - 1 << ": ";
} while ( mAgility > mPoints - 1 || mAgility < 1 );
mPoints = mPoints - mAgility;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter intelligence: ";
do {
cin.clear ();
if (cin.sync ());
cin >> mIntelligence;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mIntelligence >= mPoints || mIntelligence < 1) cout << "Enter a value between 1 and " << mPoints << ": ";
} while ( mIntelligence > mPoints || mIntelligence < 1 );
mPoints = mPoints - mIntelligence;
cout << "You have " << mPoints << " left.";
system ("cls");
cout << "Congratulations, you have created your character successfully!\n\nHere is your character:\n\nCharacter name: " << mName << "\nStrength:------- " << mStrength << "\nAgility:-------- " << mAgility << "\nIntelligence:--- " << mIntelligence << "\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 ) {
system ("CLS");
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();
}
__________________
▄▄▄▄ 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! ▄▄▄▄ |
|
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3
![]() |
Why did you re-create the same thread???
|
|
|
|
|
|
#3 | |
|
Professional Programmer
|
i posted in C++ but then i saw this forum so im posting here now, not gona revive the old one.
__________________
▄▄▄▄ 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! ▄▄▄▄ |
|
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Cross posting is against the rules. Look before you post, I think the old saying goes.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 | |
|
Professional Programmer
|
So, because i didnt see this forum earlier it would be ok to post the progress i have made on the project and talk about my program in the C++ forums
. The rules create a conflict that a less bright individual such as myself would not understand.. I have pmed a mod/admin to delete my c++ post so maybe that gets me off the line..
__________________
▄▄▄▄ 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! ▄▄▄▄ |
|
|
|
|
|
|
#6 |
|
Expert Programmer
|
If PFO was UNIX like we coudl just make a symbolic link and everyone would be happy.
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Well, you can ask the mods to move the thread... amounts to the same thing, doesn't it?
|
|
|
|
|
|
#8 | |
|
Professional Programmer
|
Health/Mana, speed, and experience have been added and are ready to be implemented into the game. I am considering using a wc3 type intelligence, agility or strength hero system but havent decided on it yet. Name of the game is still pending incase anyone has any thoughts. I havent decided what I will work on next, but im sure it wont take too long to complete it as i have most of the basics down and have a rough 'picture' of what im planning on doing to finish this.. so you will have to see and wait what happends next, not like it really matters to anyone since this game is nothing special, just another test of my abilities.
#include <iostream.h>
double health, mana, speed, experience;
int main()
{
int reset = 0;
int mStrength = 0;
int mIntelligence;
int mAgility;
int mPoints = 20;
char mName[15];
cout << "~=~Welcome to Monster fighter version 0.01!~=~\n\nThe basics of the game will be created in this portion of the text based game \ncalled 'Monster Fighter'. Although the name of the game may vary during the\nprocess, I would still appreciate you call it by the appropriate name.\n\nPress enter proceed to the character creation process...";
cin.get();
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
system("cls");
cout << "First of all, you must name your character: ";
cin >> mName;
do {
mPoints = 20;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter strength: ";
do {
cin.clear ();
if (cin.sync ());
mStrength = 0;
cin >> mStrength;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mStrength >= mPoints - 2 || mStrength < 1) cout << "Enter a value between 1 and " << mPoints - 2 << ": ";
} while ( mStrength > mPoints - 2 || mStrength < 1 );
mPoints = mPoints - mStrength;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter agility: ";
do {
cin.clear ();
if (cin.sync ());
cin >> mAgility;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mAgility > mPoints -1 || mAgility < 1) cout << "Enter a value between 1 and " << mPoints - 1 << ": ";
} while ( mAgility > mPoints - 1 || mAgility < 1 );
mPoints = mPoints - mAgility;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter intelligence: ";
do {
cin.clear ();
if (cin.sync ());
cin >> mIntelligence;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mIntelligence >= mPoints || mIntelligence < 1) cout << "Enter a value between 1 and " << mPoints << ": ";
} while ( mIntelligence > mPoints || mIntelligence < 1 );
mPoints = mPoints - mIntelligence;
cout << "You have " << mPoints << " left.";
system ("cls");
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
health = mStrength * 12;;
mana = mIntelligence * 9;;
speed = mAgility * 18;;
cout << "Congratulations, you have created your character successfully!\n\nHere is your character:\n\nCharacter name: " << mName << "\nStrength: " << mStrength << "\nAgility: " << mAgility << "\nIntelligence: " << mIntelligence << "\n";
cout << "Health: " << health << "\nMana: " << mana << "\nAttack/Move speed:" << speed << "\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 ) {
system ("CLS");
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();
}
__________________
▄▄▄▄ 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! ▄▄▄▄ |
|
|
|
|
|
|
#9 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3
![]() |
looks good! Congratulations on validating the user input!
|
|
|
|
|
|
#10 | |
|
Professional Programmer
|
The monsters have been created with health and damage, random damage is done, between 2 set values (10 to 20 damage, 13 - 14 damage). I think i will do the experience system next, or work on the combat system, maybe both if im feelin like it. God damnit im having so much fun
![]() EDIT: forgot to add the code lol #include <iostream.h>
#include "mersenne.cpp"
double health, mana, speed, experience;
int main()
{
int32 seed = time(0);
TRandomMersenne rg(seed);
int reset = 0;
int mStrength = 0;
int mIntelligence;
int mAgility;
int mPoints = 20;
char mName[15];
cout << "~=~Welcome to Monster fighter version 0.01!~=~\n\nThe basics of the game will be created in this portion of the text based game \ncalled 'Monster Fighter'. Although the name of the game may vary during the\nprocess, I would still appreciate you call it by the appropriate name.\n\nPress enter proceed to the character creation process...";
cin.get();
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
system("cls");
cout << "First of all, you must name your character: ";
cin >> mName;
do {
mPoints = 20;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter strength: ";
do {
cin.clear ();
if (cin.sync ());
mStrength = 0;
cin >> mStrength;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mStrength >= mPoints - 2 || mStrength < 1) cout << "Enter a value between 1 and " << mPoints - 2 << ": ";
} while ( mStrength > mPoints - 2 || mStrength < 1 );
mPoints = mPoints - mStrength;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter agility: ";
do {
cin.clear ();
if (cin.sync ());
cin >> mAgility;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mAgility > mPoints -1 || mAgility < 1) cout << "Enter a value between 1 and " << mPoints - 1 << ": ";
} while ( mAgility > mPoints - 1 || mAgility < 1 );
mPoints = mPoints - mAgility;
system("cls");
cout << "You have " << mPoints << " left.\n";
cout << endl << "Enter intelligence: ";
do {
cin.clear ();
if (cin.sync ());
cin >> mIntelligence;
system("cls");
if (!cin.good ()) cout << "You must enter an integer: ";
else if (mIntelligence >= mPoints || mIntelligence < 1) cout << "Enter a value between 1 and " << mPoints << ": ";
} while ( mIntelligence > mPoints || mIntelligence < 1 );
mPoints = mPoints - mIntelligence;
cout << "You have " << mPoints << " left.";
system ("cls");
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
/* Skill points Skill points Skill points Skill points Skill points Skill points Skill points Skill points */
struct attributes{
int health;
int mana;
int speed;
int damage;
};
attributes Player_1;
Player_1.health = mStrength * 12;
Player_1.mana = mIntelligence * 8;
Player_1.speed = mAgility * 18;
cout << "Congratulations, you have created your character successfully!\n\nHere is your character:\n\nCharacter name: " << mName << "\nStrength: " << mStrength << "\nAgility: " << mAgility << "\nIntelligence: " << mIntelligence << "\n";
cout << "Health: " << Player_1.health << "\nMana: " << Player_1.mana << "\nAttack/Move speed:" << Player_1.speed << "\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 ) {
system ("CLS");
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 );
struct monsters{
int health;
int32 damage;
};
monsters frog; frog.health = 16; frog.damage = rg.IRandom(5,10);
monsters rabbit; rabbit.health = 25; rabbit.damage = rg.IRandom(8,15);
monsters seagul; seagul.health = 49; seagul.damage = rg.IRandom(12,19);
monsters cobra; cobra.health = 62; cobra.damage = rg.IRandom(17,22);
monsters farmer; farmer.health = 83; farmer.damage = rg.IRandom(26,38);
cin.get();
}
__________________
▄▄▄▄ 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! ▄▄▄▄ |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|