Archived

This topic is now archived and is closed to further replies.

What are the different ways to program a text adventure?

This topic is 5176 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 know you can have your code refer to a text file containing your story, but are there other ways? Can you use cout, cin, and just have 1 file of code without a text file? thanks

Share this post


Link to post
Share on other sites
[Off topic: Good gods. In all those years... nobody ever registered HTML as their username?!?! ARGH!!!!]

Yes, you can hardcode your whole came into your program, manually using cout and cin to show text and recieve input. It is not hard to do, but it might make for a better excersise to use the textfile though. Because believe me... if you actually code in everything by hand, you are going to get a headache really quickly ^-^

Share this post


Link to post
Share on other sites
it is better to program your app so it reads the story/rooms/items/etc from files, for many reasons:
(1) you can change things (such as room descriptions, items, etc) in the files, and not have to recompile your whole game.
(2) you can easily make a sequel, or change/expand the adventure.
(3) it is good practice, since more complex games you do in the future will probably be too complicated to hard-code.
(4) you are programming a system which uses outside data (the text files, say), which IMO is much better practice for you.

i programmed a text adventure back in the day (using GW-BASIC ) and hard-coded the whole thing. once it got to any decent size i had all sorts of problems keeping track of everything.

just my 2 cents...

Share this post


Link to post
Share on other sites
btw, Happen to know any good text adventure how to books/tutorials? Or is it something that you will learn better from finishing all of a C++ tutorial?

Share this post


Link to post
Share on other sites