Sign in to follow this  

C++ Text based game tutorials (where can I find some)

This topic is 4547 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been looking at Google and havent found any that help (most were in foreign languages.) Do any of you guys know of any? I know the "basics" of C++ and am looking on how to turn the basics into something creative.

Share this post


Link to post
Share on other sites
If you already know how to read user input and how to write "results" back, you know all there is to know.

The rest is, well, creativity and general programming knowledge (knowing what you want to do and how to do it).


What are you looking for? Ideas or algorithms?

Share this post


Link to post
Share on other sites
I think mostly algorithom(sp?), which I am not good at. I used to be writing one using functions (void) but that wasnt very efficient. I have an idea to store all of the text into a data file, have the game read it, and then display it back, and then the player inputs a command and it acts upon it. Example:

In the file it may look like:

$N: room1
$D: You are in a dark room.
$E: east(room2); west(room3);

(%N(ame) $D(escription) $E(xits))
When the player plays it should look like this:

"You are in a dark room, you can go:

east, west."

And upon typing east or west it would take him to room2 or room3. I know how to read and write to files, but I dont know the algorithom to have it go through the whole file and look for little symbols (In the example the were $N, $D, $E), and then display a list (like the exits).

Share this post


Link to post
Share on other sites
Quote:
Original post by RayOfAsh
I think mostly algorithom(sp?), which I am not good at. I used to be writing one using functions (void) but that wasnt very efficient. I have an idea to store all of the text into a data file, have the game read it, and then display it back, and then the player inputs a command and it acts upon it.



Take a look at some of the open source implementations for running games such as the Zork series and Hitchhikers Guide to the Galaxy. These were text based games written in the early to mid 80's that used a common engine for 'scripted' games. for the era they were pretty robust in the parsing, processing, and interpretation of text input from the user. Back then games like these were fairly popular and just about every platform had games like this in one form or other. The interesting thing about games such as Zork and Hitchhikers Guide is that the same script was used on all platforms while the engine itself was either ported or implemented from scratch for the target platform.

Zork Trilogy. This includes downloads of the actual game so you can play it: http://www.infocom-if.org/downloads/downloads.html

Online version of Zork (play in your browser via Java): http://www.xs4all.nl/~pot/infocom/zork1.html

Adventure Definition Language. This is a good starting point to see an already implemented engine for text based adventure games. Excellent if you want to create an adventure game and don't want to create an engine. The syntax is pretty close to the example in your post: http://sourceforge.net/projects/adl/

Share this post


Link to post
Share on other sites
I am very familiar with old adventure games, I own the original Hitchhikers Guide for the Apple 2, case and everything, even the little bag with the microscopic intergalactic space-fleet. And I own a Commodore 64.

Thank you for the links, Zork is an awesome game.

Share this post


Link to post
Share on other sites

This topic is 4547 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this