Here's my little RPG text-based game.
Please tell me what you think!
Printable View
Here's my little RPG text-based game.
Please tell me what you think!
Not bad, but you delay too much. It slows down the game to the point where I started to lose interest. Is the source open for comment?
-Prelude
Nice game, but when will i get out of Karak Plains... :D
Pretty kewl, but as said the delay is too long...
Yes i know, there are too much delays....
Oh and there is a 2% chance to find the next area.
I think i will increase it to 3%
Okay. I doubt anyone will want to read the source code. I'm not good at programming so it became 1500 lines of code but anyways, here's an update and the src code:
arrrgh....i'm confused......sometime during the loading all the area switches just turn to 0.....
How come i nevr have money to by anything, and i don't go elsewhere except Karak Plains
1)you need to kill monsters for gold or you can find some randomly when exploring
2)hes having problems with the area switches
Ok here's and update that actually works for you people.
I forgot that the defensive spell names had spaces in them.
You can't use your old saves though.
Oh and in case you are wondering. predato0r is sort of making the game with me. He comes with too hard to program suggestions all the time.
And then i forget the update :rolleyes:
Hehe, this is a neat little game. I like the attacking alot with the colored HP bars. Those hellbirds are nasty. Anyway, I agree that some of the things are a little to slow. Mainly the menus.
I will enjoy looking at your code. Good luck with the rest of the game.
Well I glanced through your code (just a once over to get a deal how you did things). I have some tips for you:
- Break it up into multiple source files. People hate scrolling forever to find out information about functions and what not
- Abide by the 'One Screen' rule which basically says don't let a function be larger than a screenful of code. You should be able to see the beginning and ending of a function without scrolling.
- For the introtxt() function, instead of passing just one character, why not just pass a whole string and let the function parse out and display each letter in that cool manner? Something like this:
Changing that around will make your code a little nicer.Code:void introtxt(char *string)
{
while( *string != '\0')
{
cout << *string++;
Sleep(25);
}
}
- Your CHARACTER structure is pretty big. Maybe make other structures (like a SPELL structure or something?) and include those into the CHARACTER structure.
- Comment more. Everytime you declare a variable you should have a comment next to it saying what it is used for. Same with functions, you should comment before a function and tell what it does with what arguments and what it returns, etc..
You guys did a good job, though. :) You rock for including Kobolds :p but I can't believe you made them level 6 monsters! They are definatley level 1 or 2 monsters.
What compiler(s) were you guys using?
EDIT:: Oh yeah, I forgot to add. You guys should consider encrypting the save-game file. It is way to easy to cheat by just editing the file to give me 1000 gold. Just a thought, I know you aren't going to release this or anything.
i cant take credit for any of the programing of it i only helped by giving him ideas on stuff to program into the game and by writing a storeyline to the game (sould apear in the next update) and we already knew about how easy it is to edit the caracter info i was haveing fun with it before
I'm using Bloodshed Dev C++.
How should we encrypt the file then?
Where is lvltext.h?
I wanna find out how u can make that typing effect.
you can make a function that takes a string and adds 1 to each character in it change a to b c to d or you can make it bigger by doing it times 2 or some then save it to a file its been done on this board just search for it
I don't really understand what you mean sorry.
personally i use this function(i made):
just type typing("What you want to say here", what speed you want it to go at);Code:typing(char* Text, int speed){
for (int i = 0;Text[i] != '\0';i++)
{
cout << Text[i]<< flush;
Sleep(speed);
}
return 0;
}
ie:
typing("Hello", 50);
Hi,
After some minor fixes your function works. But is there anyway to do the same thing but not using any delay functions like sleep() ?
thnx, just wondering
Why would you want to do that. Oh and i use the same as Denethor.
Or, well, except for the lvltext cause then i didnt know about that func so i did it like this:
Code:void type(char* letter) {
cout << letter;
Sleep(25);
}
// and then in main:
type("D");
type("a");
type("m");
type("n ");
type("S");
type("l");
type("o");
type("w");
Ok newbie question here.........you see where you have that save character settings and then load character settings, how do you do that. Let's say I want to save the settings of a specific character let's say Mr. X.....and then I want to load it, how would the code for this look like?
anybody?
elchulo: here's some general idea since i dont have the code of the game.
1. you create a player
2. play the game
3. in between the game somewhere it asks for savegame
4. if you say yes it writes all the data that the player uses like
name,level#,htpoints,injuries etc into file
5. next time you run the file it asks for load saved player
6 if yes it reads from the file and sets the default values to those
in the file
hope this helps
:)
Ok, but the part that I am having problems with is saving the data on a specific order so then I can load it up when I open the file and have it all match.........he has in on his game, I just don't know how to do it.
use structures and read/write to store data in file.
just keep the structure variables same
When reading from a file it stops when a new line (or a whitespace?) comes up. So i just did it like this:
ehh? You can just write away the structure!?!?!?!?!?!!!Code:// make instances of classes for using files
ofstream fileout(filename/*the variable that the user types in*/,ios::out|ios::trunc);
ifstream filein(filename);
//save
fileout << variable << "\n";
fileout << variable2 << "\n";
fileout << variable3 << "\n";
//load
filein >> variable;
filein >> variable2;
filein >> variable3;
AAAAAAAGH!!!!!!!! And i didn't know....
Hy there, like the game. I encountered some bugs though.
1) I accidentally pressed ` in the spellshop and it crashed.
2) After gaining level 3, my point and coin upgrades didn't register. So I would gain some points and/or coins and they wouldn't be saved. I can't really reproduce it, but it happened.
And about the encryption, just do some cool stuff with bitshifting and nobody will be able to read it.:)
What do you mean with that "point and coin upgrades" thing you were talking about?
Oh and how do i do bitshifting?
I mean, experience points and golden coins. U know, the things u get after you've won a battle.
Bitshifting: >> and <<, just look it up. Its an operator.
Just to be a bit more contsructive, try this:
Code:#include <iostream.h>
int loop()
{
int a;
char b, c;
cin>> b;
a = int(b);
cout<<a<<endl;
a<<=1; // bitshift with 1 to left
cout<<a<<endl;
a>>=1; // bitschift with 1 to right
cout<<a<<endl;
c = char(a);
cout<<c<<endl;
loop();
return 0;
}
int main()
{
loop();
return 0;
}
if for example, you type "g", that reads 103, when you bitshift 103 1 to the left, you get 206. If you bitshift 206 back 1 to the right, you get 103 again, which is "g".
So what you do is, when saving, bitshift every character you write to the file, to the left or the right by a certain amount. In the case of a "g" you would get 206. That's what you write to the file. So you only end up with numbers. When you then load the file, you do the same thing, but in the other direction and you end up with a "g" again. May take some time, but nobody will understand what the file contains. :)
im not sure, but it think when you pick up the old lady you don't actually get the 15 exp.... i just looked at my stats (i had 345 exp) then explored, picked up the lady, but i still only had 345 exp
also... when you ask questions such as "do you wish to drink it?" (the potion) you should give a format for the answer. so it would look like "do you wish to drink it? (yes or no) " i had a problem at first trying to figure out what you wanted there.
try applying this to the save-files (youll have to modify it, though)
#include <io.h>
#include <fcntl.h>
#include <iostream.h>
void main()
{
int i, j = 0;
int key_length;
int fh_in, fh_out;
long buffer_length;
long bytes_read = 0, file_length;
char in_buf[65536], out_buf[65536];
char infile[256], outfile[256];
char key[64] = {0};
cout << "SRC: ";
cin.getline(infile, 256, '\n');
cout << "DST: ";
cin.getline(outfile, 256, '\n');
cout << "PSW: ";
cin.getline(key, 64, '\n');
fh_in = open(infile, O_BINARY | O_RDONLY);
fh_out = open(outfile, O_BINARY | O_WRONLY | O_CREAT);
file_length = filelength(fh_in);
for (i = 63; i > 0; i--) if (key[i] == 0) key_length = i;
while (!eof(fh_in))
{
buffer_length = file_length - bytes_read;
if (buffer_length > 65536) buffer_length = 65536;
read(fh_in, in_buf, buffer_length);
for (i = 0; i < buffer_length; i++)
{
out_buf[i] = in_buf[i] ^ key[j];
j++;
if (j == key_length) j = 0;
}
write(fh_out, out_buf, buffer_length);
bytes_read += buffer_length;
}
close(fh_in);
close(fh_out);
}
:D :eek: :D
Fun game. Good job.
Thanks for sharing your opinions with me people!
I'll try and fix those bugs that you encountered...
Oh and big thanks for showing me the encryption thing Mbrio!
Oh, you could think of anything. Any algorithm will do.
without indentation its kinda hard to read all of that code :)
Yeah i know it became a bit large =)
hehe =) Anyone who has seen "The Matrix" knows what this is:
haha that matrix thing is cool...couldnt you make it so it loops instead of running one time? :D
it says it cant find a few of the header files:
conio.c
and others...what do i do?
So when is the next update going to be? I found the game to be quite fun :)
Make a map of the area and display it on the screen in a simple form.
Hey Paro: I'm using Dev C++ which has its own headers and i have also made my own header so you wont be able to compile it.
And to blackwyvern: That sounds hard =(
btw 500+ views!!!!:eek: :eek: :eek:
Good game, just a few comments. You should go easy on the delays for one thing. When you first create a character, the three ... followed by DONE is not really needed. I know it looks professional but nothing is really loading. And please use some clrscr()! Instead of having a big long line of words, it looks nicer to keep the screen clean. Got a bit repetitive. Good overall though.
Kyoto Oshiro
Horizon Games
http://www.angelfire.com/realm2/horizon/files.html
Great game. The only thing I found wrong with it is I can't buy any spells. I had like 100 gold and it said I didn't have enough to buy minor healing (?) which costs 50!
Great game none the less.
AWESOME GAME :D
its not just good its awesome!
i passed it out to the people around my comp in class and everyones playing it hahaha :D
i cheated so i could recieve the full extent of the game...and for some reason when i got an old lady its like you gain 190000 exp but i never gained that much... :D
if you could re-check the code for the old lady that would be great!
please update tonight so i can bring another version to school...
too bad i cant compile it :(
i wanted to add to it heheh...
darn MSVC++ ;)
another thing i noticed... when i used that code where it displays a character at a time with a certain amount of sleep....
when i do it in MSVC++ for some reason it doesnt do it right...it sorta adds all the sleeps together then burps out all the letters at once... it compiles perfectly just doesnt run like i want it to...is it msvc++ or the way i coded? :(
and another thing...
im a newbie programmer, and im not even sure if this is possible...
but when i was saving i made a spelling error and saved it as a ".tt" file... well... it saved as .tt haha, maybe you should say to save it as .txt? well i dunno just reportin
sorry for another post but i gotta keep reportin what i think as i play or ill forget...
i made my way to the Sedra Forest, and well, im a lvl 1 and i got my ass kicked by an orc...
anyways, i died, yes thats right i died!
and for dieing i lost a total of 1 experiece! for some reason i thought i was like.. dead forever, which i should have been, but i only lost 1 experience...
maybe you should make it so you lose something more then that? just to make it more interesting...
btw
i really like your game and it seems really really large which is cool :D
btw#2
how could this be your FIRST GAME?
my first game was a crappy slot machine... :D
another report:
i really like the way you can hit any key to keep exploring...
because what i do is go to the easy area and type:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
and i can just chat while i gain levels :D
but people should be able to hit "n" to go back to town instead of the whole word "no"
btw
to everyone, level 4 is a good level to head over to the sedra forest in my opinion
EDIT::
i just found the Haunted hills and i easily make it through the monsters at level 4 :D
i notice that the monsters are doing like 4 damage to me and im doing about 10 to them...maybe that has something to do with skill points? but i think they should be doing as much damage to me or more when they hit me (which isnt often)
EDIT2::
ok, im lvl 6 now and in the Ancient Ruins and im starting to get hit a little harder :D
new question:
ok, ive got like 3000 gold... what do i do now? is there anything im supposed to do with all that money? all offensive spells do less dmg then my main attack so i dont get them...
what you think?
Yikes Paro you like my game huh :D
Big thanks for all the help you are giving me.
Especially Paro :)
Oh and it really doesnt matter which format you save in.
Well i'm going to school now but I'll come back later and finish all of these probs.
I dunno what the hell is wrong with that old lady......
Or maybe i have changed it already cause my code looks perfectly allright
Here's an update with many of the small things (including the lady i hope) fixed.Code:if(chr.lvl<6) {
helpExp = chr.lvl * 25;
} else {
helpExp = chr.lvl * 50;
}
chr.exp = chr.exp + helpExp;
EDIT:: Isn't there a weapon shop?
or maybe you have the best weapon.
Cause if there isn't a weapon shop with that one you are using you have something too look forward to though =)
In that case add seven 0's in the end of your savefile.
um, i think i found another error :D
im level 7 now, and last time i leveled i was supposed to gain 12 hitpoints...but it says i only have 27 now, im pretty sure i had more then 15 hitpoints last level...maybe you could check that out :D
lol :D
yea i like the game :p
i think i see the problem with the old lady...i cheated with the character text file, and i was like level 30, which by your code would give me 1500 exp...but it gave me almost 200000... hmm maybe i changed something else on the file that screwed it up :D
ill download your update and continue playing :D
Maybe it works in the update...Code:chr.hp = chr.maxhp + chr.lvl * 2;
chr.maxhp = chr.hp;
EDIT:: Hey maybe i was storing it in an int...
Isn't int limited to max 36000 something?
oh darnit,
i downloaded the update but it seems im going to have to make a new character because when it loads the old one it sets the weapons as my old exp and gold and leaves my new exp and gold as Zero! :mad:
oh well, this way i will be able to find more errors heh :D
nice prologue its a great addition and same with the autoloader its so cool! :D
Hey i made like, i character creating sheet.
Here ya go
EDIT:: i found out what was wrong with the dying thing =D
The exp you lose is lvl*lvl*lvl*lvl
in other words, on lvl 1, 1*1*1*1 =D
LMAO :D
i see you've fixed my way of power leveling! hahaha :D
now i have to pay attention while i play ;)
that weapons shop with different areas is really cool btw, keep up the awesome work!
one suggestion:
maybe you could have an option where you could go back to the main screen so you could load a different game or set the autoloader again? it might be helpful :D
hmm, i made my way to the second area, but i cant go to the 2 second area weapons shop? is there some special requirement? ill edit this if i figure it out...
No you have to find it in the second area. i think its a 5% chance.
oh and another suggestion, possibly an AutoSave which is exactly like the Autoload except for saving, would save me from typing in c:/programming/char.txt ever single time :)
woops! i think i noticed another error, i drank a potion that damaged me for one point and i was SURE that i only had 12/13 to begin with unless i regained my health from going to the fields of fatigue... hmm...:D
EDIT::
confirming that it doesnt take off my hitpoints because i got the same potion again and im still at 12/13... it could possibly be putting me back up to full and taking off 1 again? that could be the problem...either that or its not taking off hp
hey... :mad:
i just found 13 gc from something in the fields of fatigue... then i found the weapons shop, so i went back to town and to the weapons shop and it says i have 0 gc!!!!!! :eek: (had 0gc when i headed out to the fields btw but i should have had 13 when i returned)
maybe its not adding it or something :confused:
Weird. Anyways i have to go to school now.
Here's an update with the main menu quit thing added.
btw try typing 42 in the explore/shop/quit menu
Me not like forgetting attach
All your base are belong to us
AHAHAHAHHAHA :D
ah, very minor minor error...
when i quit to main menu, i clicked on autoload, and it would load then clearscreen and im still in the main menu...but then i hit autoload again and it works perfectly... i did this twice to make sure and it does the same thing...
like i said this is a minor minor error that doesnt even disrupt gameplay just thought like tellin ya :)
suggestion::
maybe you could add a "return to town" option when you are choosing what area you would like to explore.
just another suggestion from paro :D
arg, i drank another potion and it was supposed to deal me 2 damage but didnt, i still have 50/50 hp so maybe you could check out the code on that :D
this is a non-game related question....
i'm using bloodshed as well and i have a problem when i execute. the ms-dos execution screen pops up and then immediatly closes and i can't execute the program. any ideas to fix this problem?
you lucky you can even execute...i cant even compile with msvc++ :D
Haha! I have fixed the darn potions and the autosave (that one was weird. Dunno why...) and some other stuff.
Oh and mike, if your program contains only couts or something like that. It will get finished as soon as you start it.
The computer prints out text really fast so if there isn't any pauses it will get to the end of main and close down the prog immediately
cool :D
im going to school, where i will give the game for my friends to play while my teacher goes "blah blah, class this struct that" and maybe they will find some error i missed :D
cya
hey this is paro
im at school and i found another error..
when im in the fields of fatigue i found some gold while exploring but it didnt add to my total...:D
i know this because after finding about 50 gold i went back to town to heal but i only had 8 gold..
:D
me again, i found another quite large bug...
if i go to the store and attempt to buy a weapon i dont have the money for it asks me if i want to sell my old weapon...well if i still dont have enough it will say: "not enough money"... well when i come back to the store i still have the money from selling my sword so if i repeat i can get more and more money hehe :D
big bug, fix this one quickly :P
Fixed both of them...
You now get Fists (0-2) after selling your weapon.
I think you should make a credits and make Paro "Game Testing" lol
If this is your first game, I see a great future in your work. My first game was tic tac toe! It's been a while since I played a text game that actually was fun.
I bought some double daggers, and when it asked if I wanted to sell my dagger for 10gc, I typed yes, then one of those windows things with the red circle and a X in it, with close and details came up! I tried again, and the same thing happened!