Advertisement

Basic text RPG question

Started by January 14, 2003 09:39 AM
2 comments, last by Dawnstrider 21 years, 10 months ago
I''m trying to put together a basic single player MUD-like RPG, but I ran into a problem. I don''t want to do a turn based structure at all, instead I want every action to have a delay, and you can''t do another action or move until that delay is up, and I want MOBs to work the same way. The problem is that I want to do this on the console since I''m nowhere near experienced enough to make another interface, but using cin, getline, etc causes the game to pause everything and wait for input. Since I want things happening real time, this doesn''t work at all. Is there any way I can get this to work still using the console?
You might want to look into creating a simple dialog-based application. It will be a bit more complex than using the console, but the experience and the final outcome of your game will be much better. Of course, this may not be an option if you really want to go for the text-based MUD look.

Another option, which may be just what you need (but may be too complex for you to want to learn just yet), is multithreading. Right now, your console app is single-threaded. By starting another thread, you could have two different sections of code running simutaneously while sharing source data.

-Mike
Advertisement
Doctorsixstring, I know you didn''t suggest multi-threading to a new programmer. Gimme a break.

DawnStrider,
Look up kbhit() You can check for a keyboard button being pressed, and then process the input, otherwise, just keep running your program.

Good luck.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

I do want to go for the standard MUD look, as I''d like to design a MUD someday and this is sort of practicing for it, but thanks for the idea. I''ve actually tried to learn threading.. It didn''t go very well, caused my first program crash, though I did manage to have two threads going once. Didn''t have nearly enough understanding to go any further than that, though. I''ll play around with the kbhit thing, thanks for the help.

This topic is closed to new replies.

Advertisement