Thread: text based game

  1. #1
    Registered User PippinofTook's Avatar
    Join Date
    Aug 2005
    Location
    Texas
    Posts
    4

    text based game

    okay... I dont know how many of you have played a MUD but it a Text Based MMORPG (Massive Multiplayer Online Role Playing Game) there is tons of code for it... I dont want to code one right off I was jsut going to try and play with some different codes to learn how to do it but the reason I tell you this is because your character in a MUD is command driven like you type in "look" and a description of the room is displayed.. what would the code be to obtain a string from the keyboard then test it to see what to pull up?

  2. #2
    Registered User Boomba's Avatar
    Join Date
    Jun 2003
    Posts
    89

  3. #3
    Registered User PippinofTook's Avatar
    Join Date
    Aug 2005
    Location
    Texas
    Posts
    4
    thanx but I know that... was wondering if some one could give me the code to:

    get char input

    test if command in command lib (or something similar)

    do what is needed

  4. #4
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    hey I'm trying to do the same thing. but it sounds like you're probably at the point in your knowledge of the c++ language as i was about a year ago. i'm making a text based game right now, and i'm maybe 1/4 of the way through it. i think you'd be much better off figuring out that code on your own because
    1. That's pretty simple code to figure out, and if you understand string input and string comparison, you should have no problem at all.
    2. If you can't figure out that part, which probably isn't the first thing you should be worrying about, then you certainly will not be able to figure out how to create the map/location system. or the item system. or pretty much any of the other main parts of a program like this.
    so just to save you a lot of trouble, i'd really recommend learning how to program the stuff you're gonna need for the game before you actually start trying to make the game. otherwise you might end up like i did a while ago, having half a game that kinda worked, but the code was sloppy and it wasn't really possible to do much with it from there, and plus my game didn't do what i originally had intended. it's discouraging not being able to finish a game because you don't understand how to implement a feature, such as what you're asking, geting input and executing the proper code based on the input.
    having said all that, you should be able to get to that point fairly soon, just study strings, study input (especially of strings) and input functions, study how to create and use functions, arrays are easy to learn (if you don't know them already), and then probably just learn some stuff about structures and classes, which are pretty similar. obviously the more you know the easier it would be to do what you want to do and make code. but i think that's pretty much all you'd need to know to do what you want to do. at least for right now. good luck..
    and hey, try to write the code for what you're asking, even if you can't get it to work, and post it. then people would be much more willing to help you out and explain how to do things.
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  5. #5
    Banned SniperSAS's Avatar
    Join Date
    Aug 2005
    Posts
    175
    Since no one has linked to it yet, here is the tutorial on strings, in case you couldn't find it yourself.
    Last edited by SniperSAS; 08-24-2005 at 05:40 PM.

  6. #6
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Let me ask you this:

    Given a number how would you determine if it was in a container of numbers?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text based game
    By wipeout4wh in forum C Programming
    Replies: 12
    Last Post: 03-26-2009, 04:39 PM
  2. Text based game
    By beene in forum Game Programming
    Replies: 10
    Last Post: 05-12-2008, 07:52 PM
  3. New Project, text game, design stage.
    By Shamino in forum Game Programming
    Replies: 9
    Last Post: 05-23-2007, 06:39 AM
  4. Saving a text game
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 03-27-2002, 01:33 PM
  5. Text Based Game
    By drdroid in forum C++ Programming
    Replies: 2
    Last Post: 02-18-2002, 06:21 PM