Jump to content
  • Advertisement
Sign in to follow this  
Argoran

I want to know more about text-games.

This topic is 4813 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'm a beginner in C++. I've just read a book that mentions text-game programing. I think it's interesting and I want to know more about it(such as how to change textcolor and background color, and how to make a timer). Are there any articles? Thanks a lot.

Share this post


Link to post
Share on other sites
Advertisement
a) Changing colors - it depends on the nature of your console. Is it a Win32 console window? A tty? A telnet client window?

b) Do you want the program to keep running and/or accept input while the timer is running or just to completely sleep for a given amount of time?

Share this post


Link to post
Share on other sites
1.win32 console window
2.I want to add time limit when player's making choices.

I know nothing about windows programing and I don't know how to use DirectDraw. I just want to use characters to output. As simple as possible.

Share this post


Link to post
Share on other sites
1.win32 console window

The relevant documentation is there, look particularly at SetConsoleTextAttribute.

2.I want to add time limit when player's making choices.

You'll have to write custom input routines, that poll the console for input (instead of a blocked wait) and still updates the timer. In any case, if you want to have the program still do things while the player is typing stuff, multithreading is generally necessary.

Functions from <conio.h> will likely be useful.

Share this post


Link to post
Share on other sites
Hi there,

If you really need to learn text-based game programming.I recommend you this book :Beginning C++ game programming.
http://www.gamedev.net/columns/books/bookdetails.asp?productid=379

This book actually helps you to start on text=based console games.Teaching timers,which you want to learn too.Everything is in c++ no directX is needed.Try this book.Is a good book to start with for beginners too.:)

Hope this helps you!

commy

Share this post


Link to post
Share on other sites
If you're just interested in making text games you might want to look at the Inform programming language. It's really powerful and easy to use. Take a look at the Download the Inform Beginner's Guide to get started. Or do a web search for interactive fiction.

However, if you're interested in doing them in C++ (perhaps with the intention of later making non text based games) it's probably not for you.

If you're looking to make more of an action game, do a search for tutorials on roguelike games. Some popular ones are Nethack and Angband, they both have their source code available for download, but it might be a bit hard for you to follow.

As for changing text and background color, there's no standard way to do this in c++. Since you're using windows you'll have to learn how to do it the windows way - I wish I could help you, but I have no experience developing windows console apps - but it does look like some of the other posts can help you out.

Share this post


Link to post
Share on other sites
Thank you for helping.
I have one more request. Can you say something about the "windows.h"? It's said that there's some useful functions in it.

Share this post


Link to post
Share on other sites
windows.h contains most of the Windows-specific functions. You don't need to know much about it though. Just look up the functions you want in MSDN and include windows.h if it is required.

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!