View Full Version : A Little Rpg
chickenman
21-08-2005, 10:15 AM
I am working on a small text based fantasy RPG for Linux and Windows.
The game is about 30% complete so i hope to get it done in a week or two, i may get time later to post a screen shot of the menu.
A few testers will be nice.
:ok:
punch999
21-08-2005, 06:07 PM
ohhh wooopie a screeny of the code!
chickenman
21-08-2005, 06:07 PM
Here it is what you have all been waiting for, A screenshot :P
(154KB)
More coming soon. :cheers:
chickenman
21-08-2005, 06:08 PM
oooops, some one delete the top one
[edit] There we go :P
chickenman
21-08-2005, 06:12 PM
And just to let you know, this is open-source under the GNU GPL license ;)
if you want to see the source just ask.
chickenman
21-08-2005, 07:18 PM
Well thats all for tonight I think, I am working on the save system at the moment. (with some problems)
And i also forgot to tell you the name of the game is:
Hall of The Dead.
:)
I have one word for you:
Indentation! :ok:
Have fun coding!
Oh, btw, I am interested in how you're going to implement rooms, monsters etc. Are you going to use a database, XML or something?
chickenman
27-08-2005, 03:23 PM
Well it's now about 50% complete and the save system has been completed as well, so the beta should be out in a day or two (I hope)
@Reup
To play the game you will have to give your player commands like,
go north
eat cow
kill sheep
This will be a mix of adventure and RPG :)
Please post any questions you have in here.
Blood-Pigggy
27-08-2005, 03:26 PM
Ooh.
Me and my brother had an idea to make a text based RPG via C++ we got a basic engine thingy going (You could roll your stats, choose a weapon and armor, and fight a troll or a flamingo or some other enemies) but we scrapped it later on.
Glad to see this is coming along fine.
chickenman
27-08-2005, 03:39 PM
Thanks :cheers:
if you post the source. I can see if it compiles under GNU/Linux
Should be the case as you seem to use stdout
chickenman
29-08-2005, 11:23 AM
I use Linux LOL :P
When i am done with the RPG you will be able to download it for Linux and Windows.
chickenman
30-08-2005, 10:39 AM
You can download the Test version of it now :ok:
(with source-code)
http://www32.websamba.com/3256353/
uhm how do I run setup.exe under linux ?
chickenman
30-08-2005, 01:35 PM
oh yea i forgot i'll compile it for Linux later
Blood-Pigggy
30-08-2005, 10:57 PM
Mmm, what do I do when it asks me for the file path to save for.
I've made a path that went like this "C:\Program Files\Hall Of the Dead"
But it quit out, after leaving it blank the second time and pressing enter, it brought up a "Hall Of the Dead had to be shutdown" error.
Any specific instructions as to where to save?
I also encounter problems when trying to get into options, as it does nothing and just sticks there.
thatmexicanguy
31-08-2005, 04:52 AM
Ooo! Ooo! I want to test!
chickenman
31-08-2005, 12:23 PM
The options don't work at the moment
checked the source.
didn't want to compile because of
constructs like this:
fopen("save/"save.savename,"wb");
should be something like this:
char filename[100];
strcpy(filename,"save/");
strcat(filename,save.savename);
fopen(filename,"wb");
(requires a #include <string.h>
chickenman
01-09-2005, 01:39 PM
oooops that is the old source, i need to update it.
chickenman
01-09-2005, 02:54 PM
Website has been updated with the new version of the game and source (1.5.1.3) - (i will be uploading the Linux source soon).
http://www32.websamba.com/3256353/
:ok:
NrmMyth
01-09-2005, 05:25 PM
Originally posted by chickenman@Sep 1 2005, 04:54 PM
Website has been updated with the new version of the game and source (1.5.1.3) - (i will be uploading the Linux source soon).
http://www32.websamba.com/3256353/
:ok:
You are createing a text game.
Why don't you simply write the "uni-source" in ISO/C++?
you are using the wrong / \ in the pathnames. that's why I get a file not found
chickenman
01-09-2005, 06:05 PM
@ Data
I have fixed that, i will upload the new source to my website
@ NrmMyth
What ?
NrmMyth
01-09-2005, 06:45 PM
Originally posted by chickenman@Sep 1 2005, 08:05 PM
@ NrmMyth
What ?
You don't need Linux and Windows source to be separated.
Just write in standard C++. :)
I actually meant:
the link
http://www32.websamba.com/3256353/files...up-(source).zip (http://www32.websamba.com/3256353/files\setup-(source).zip)
That last \ should be an /
and maybe just zip the source. That is more common for source archives
chickenman
02-09-2005, 08:08 PM
Well going on Holiday now so there won't be any updates for a week or two, although fell free to mess around the the source. :ok:
See you all soon.
blastradius14
03-09-2005, 03:08 AM
I remembered having alot of scripting/compiling problems in NWN when making my own modules :D
Last time I saw ISO C++ it wasn't in any source doc, how can you expect him to know that?
NrmMyth
03-09-2005, 12:09 PM
Originally posted by blastradius14@Sep 3 2005, 05:08 AM
I remembered having alot of scripting/compiling problems in NWN when making my own modules :D
Last time I saw ISO C++ it wasn't in any source doc, how can you expect him to know that?
He worked on 3D game, i supposed he knew the standard.
chickenman
10-09-2005, 12:18 PM
As far as i got with that 3D game was a 800X600 window with some text LOL
punch999
11-09-2005, 01:11 AM
Then why did you promise you could do it?
Originally posted by chickenman@Aug 27 2005, 04:23 PM
@Reup
To play the game you will have to give your player commands like,
go north
eat cow
kill sheep
This will be a mix of adventure and RPG :)
That part was clear to me. Still I'm curious how your game is designed (NOT how it's coded). What classes are you using, how do they relate? And surely you're not planning to hardcode all the rooms? Your code gives no clue about this (there's not much there anyway).
You should look into XML! You could specify your rooms in a rather simple way:
<room type="normal" id="123">
* <name>The Ultradark and dank Dungeon</name>
* <exit>
* * * <dir>North</dir>
* * * <desc>The sturdy wooden door</desc>
* </exit>
* * *<exit>
* * * <dir>West</dir>
* * * <desc>A chain hanging from the ceiling</desc>
* </exit>
* <desc>The walls in this dark and dank dungeon are covered in what seem to be
* * * * * * *troll excrements. Some are still warm and extremely smelly. Bit of toilet
* * * * * * *paper can be seen between the goo. </desc>
</room> *
Something like this. Off course, i'd give some more thought to a reallly decent DTD :) You can use any XML-lib for C++ (I'm into Java myself, so I don't know any...).
chickenman
12-09-2005, 07:06 PM
@ Punch
I thought i could do it LOL
@ Reup
Wait and see ;) i've only just got to work on the game it's self.
A question for any one who can program C++
How will i save the players stats like, attack = 1, defence = 5
as fwrite and fread only accept char and strings ?
NrmMyth
12-09-2005, 08:37 PM
For anything.
Syntax: #include <stdio.h>
*int fwrite( const void *buffer, size_t size, size_t count, FILE *stream );
The fwrite() function writes, from the array buffer, count objects of size size to stream. The return value is the number of objects written.
chickenman
13-09-2005, 11:13 AM
hmmmm i have tryed a number of things but i still can't get it to work.
28 C:\SYS\Desktop\cpp\int-save-test\main.cpp invalid conversion from `int' to `const void*'
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int age = 15;
int number = 22;
char Fname[12]; //for filename
cout<<"Enter file to save to: ";
cin.getline(Fname,12); //get data
cout<< endl;
//Open file
FILE *file;
file = fopen (Fname,"w");
fwrite (age,1,sizeof(age),file);
fwrite (number,2,sizeof(number),file);
cin.get();
return 0;
}
:ph34r:
uhm try &age instead of age
and &number instead of number
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int age = 15;
int number = 22;
char Fname[12]; //for filename
cout<<"Enter file to save to: ";
cin.getline(Fname,12); //get data
cout<< endl;
//Open file
FILE *file;
file = fopen (Fname,"w");
char buffer[2];
_itoa(age, buffer, 10); //convert int to char
fwrite (buffer,sizeof(buffer), 1, file);
_itoa(number, buffer, 10);
fwrite (buffer,sizeof(buffer), 1, file);
cin.get();
fclose(file);
return 0;
}
It is work.
chickenman
15-09-2005, 08:50 AM
Well it works but I don't understand the
_itoa(number, buffer, 10);
also how do I load the saved data into the correct integers?
:eeeeeh:
So, I don't think that it's a good idea to use "fwrite" here but if you want...
_itoa - convert an integer to a string (see MSDN).
Code for save and load:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int age = 15;
int number = 22;
char Fname[12]; //for filename
cout<<"Enter file to save to: ";
cin.getline(Fname,12); //get data
cout<< endl;
//Open file
FILE *file;
if ((file = fopen (Fname,"w")) != NULL)
{
char buffer[2];
_itoa(age, buffer, 10); //convert int to char
fwrite (buffer,sizeof(char), 2, file);
_itoa(number, buffer, 10);
fwrite (buffer,sizeof(char), 2, file);
fclose(file);
}
else cout<<"Error opening the file";
if ((file = fopen (Fname,"r+t")) != NULL)
{
char ch_age[2], ch_number[2];
fread(ch_age, sizeof(char), 2, file);
fread(ch_number, sizeof(char), 2, file);
fclose(file);
age = atoi(ch_age); //convert char to int
number = atoi(ch_number);
cout<<"Age = "<<age<<" Number = "<<number;
}
else cout<<"Error opening the file";
cin.get();
return 0;
}
Or as you really seem to wanting to learn C++
use ifstream and ofstream class.
then you can just output and load stuff like you do with cin/cout
chickenman
15-09-2005, 04:09 PM
I know a lot of C++ i am moving onto OOP now i still have not got the hang of pointers yet LOL :P
i'll take a look at ifstream and ofstream.
Kon-Tiki
15-09-2005, 04:21 PM
Pointers're tricky stuff indeed. I myself understand their concept, but being able to properly use them, and knowing when to use them, and why... that's still beyond me. That's probably the toughest part of C++.
It is well known that the best solution for data storing is data bases or now XML as Reup offered. So, use this. And of course use OOP.
chickenman
15-09-2005, 05:38 PM
hmmmm XML looks hard to use
vBulletin® v3.7.1, Copyright ©2000-2025, Jelsoft Enterprises Ltd.