Jump to content
  • Advertisement
Sign in to follow this  
CodeNameD00M

Text adventure in C++

This topic is 4842 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've made a couple console programs, and I want to make a text adventure, but I have no idea how to start. I've never made an engine or full fledged game. Are there any tutorials on making a text engine or a text adventure? Any advice?

Share this post


Link to post
Share on other sites
Advertisement
Zahlman released an amazing text adventure engine by the name of Choose Your Own Adventure. He wrote it in C++ and Python. It's pretty hardcore and I suggest you stay away from it if you're just learning C++. If you're just learning, try things on your own - make mistakes, find solutions by yourself. The best way to learn is on your own.

Share this post


Link to post
Share on other sites
I don't know of any articles that teach you how to do this. The best advice I can give you is use OOP. That is, make sure you have classes for all the main things (CMonster, CPlayer, CItem, etc.) and make sure they are well-defined. Good luck! ^_^

Share this post


Link to post
Share on other sites
Have a search around for Scott Adams source code. He created a great series of text adventures in the 1980's. His source code is available somewhere scanned from a magazine, it might give you some pointers.

ftp://ftp.ifarchive.org/if-archive/scott-adams/games/
linked from here (http://www.if-legends.org/~pdd/)

This is a version that has been converted into C - although i'm not sure how complete it is.

Share this post


Link to post
Share on other sites
Yeah,
since your just starting out you should learn a little more and try some stuff out on your own. You will most likely learn more by doing that cause you would have tried stuff out on your own. That is actually how some people figure out maybe a faster way to do something.

On a anventure game, I would get some understanding on Classes and some other stuff.

What do you know right now? Maybe, we could send you in the right direction of what game you should try out on YOUR OWN that you might beable to do.


Chad.

Share this post


Link to post
Share on other sites
One important thing is always separating the story of the game from the game program itself. This means that if you've programmed your stuff as you should have done, you should be able to modify any element of the scenario without having to change the basis of the game (ie what you could call the 'game engine') itself.

For such a game, more precisely, the game engine would be, as someone else has already said, a text-based engine. This means this engine will have to perform text-related operations, such as writing landscapes descriptions or questions and reading (and validating) the answers from the keyboard.

You should first care of making a solid basis for your game before implementing the story itself. For example, this story could be saved into files repreenting each level. This solution would enable you to add, remove or modify levels or only part of them without changing one line of code.

Hope it helps.

Share this post


Link to post
Share on other sites
That's just the point. I have no idea how to set up that base engine. The story I can write, I'm just not sure how to start the programming bit.

Share this post


Link to post
Share on other sites
Just start off by introducing the game and then start the actual game process. That will usually involve taking in the input and processing it, then moving on from there. Keyboard input and output, strings, and vectors could probably be very useful to you. You can store items and such in a vector and pull or get random things at will. Just start out slow and don't try to code the whole thing in one setting.

Share this post


Link to post
Share on other sites
C++ isn't the best language to use for a text game. If you just want to make a game and don't care about which language you use, you might want to consider using Inform or TADS. They are both languages designed for creating interactive fiction text games.

I used inform for a text game a few years ago. It's pretty easy to use - you do need to download a compiler and interpreter though. If you decide to go that route, the Inform Beginner's Guide is an excellent tutorial.

However, if you're looking to do a text game to learn C++, stick with it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!