Sign in to follow this  
Argoran

I want to know more about text-games.

Recommended Posts

Argoran    122
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
Fruny    1658
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
Argoran    122
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
Fruny    1658
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
commy2005    122
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
Will F    1069
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
Argoran    122
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
Kylotan    10012
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

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