Thread: text based game c programing

  1. #1
    Registered User
    Join Date
    Feb 2016
    Posts
    4

    text based game c programing

    hello im trying to write a text based game for class and not really sure where to start i was hoping i could get some pointers on how to start

  2. #2
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    How difficult do you want it to be?

    The first thing to do is to pick a game:

    * Guess a number.
    * Guess a code.
    * Guess a word. (hangman)
    * Blackjack.
    * Battleship.
    * Craps.
    * Crib. (or some other card game)
    * Tic-tac-toe.
    * Checkers.
    * ...

    That's just a sample. Your options are limitless.

  3. #3
    Registered User
    Join Date
    Feb 2016
    Posts
    4
    im aiming for a text based adventure game kind of like D&D

  4. #4
    Registered User
    Join Date
    Feb 2016
    Posts
    4
    btw im using pelles c so im kind of limited so far all the examples ive been looking at require which doesnt work with pelles

  5. #5
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    A text-based game can be made using only standard C, it should compile in all standard-compliant IDEs/compilers such as pellesC/gcc.

    Why don't you start programming it and see where it takes you? It's almost certain that after a few months, you may want to rewrite it( as you'd have gotten experienced with the language ), but still...
    Devoted my life to programming...

  6. #6
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    Quote Originally Posted by bobert503 View Post
    im aiming for a text based adventure game kind of like D&D
    To make an adventure game you'll need data structures like the following.
    Code:
    MAP
      --1--
      |   |
      2   3
      |   |
      |   4
      |   |
      --5--
    
    ROOMS
    Num  Name                 Descrip
    1    "The Dingo Room"     "A dingo stands astride a mangled corpse."
    2    "Release the Crack"  "A crack .......... is smoking crack. There is crack here."
    3    "Bill"               "A wise old man smiles and pats his crotch."
    4    "El Diablo Cheese Sandwicho" "Just use your imagination."
    5    "Reflector"          "Mirrors adorn every wall. The room still seems small, though."
    
    ROOM CONNECTIONS
       N  E  S  W
    1  0  3  0  2
    2  1  0  5  0
    3  1  0  4  0
    4  3  0  5  0
    5  0  4  0  2
    
    ROOM OBJECTS
    RoomNum ObjNum(s)
    1       2
    2       1
    3       0
    4       3
    5       0
    
    OBJECTS
    ObjNum Name                RoomNum
    1      Crack               2
    2      Magic Dingo Collar  1
    3      Cheese Sandwich     4
    4      Baseball Bat        0
    
    PLAYER
      Location:   1
      Inventory:  4, ...
      Score:     42

  7. #7
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Games, even text-based, can be quite difficult for a beginner to implement. I am assuming you're a beginner, if you don't even know where to start. I would actually suggest you avoid a project like this for now, as it is more complex than you might realize.

    If you still want to go ahead with this idea...

    You need to start with a plan. If you don't have a plan, you are not anywhere near ready to begin coding "for real" (though writing little test snippets to check out ideas along the way is a good idea).

    Do you have any ideas on how you want the game to work? For instance, some questions that pop to mind are:

    • How will movement work? Will it be text-based like the old-style MUDs, or a "graphical" map made up of characters that show current location?
    • What commands do you want to include?
    • What kind of character information do you want to keep track of?
    • What kinds of things do you want the player/character to be able to do?
    • How will battles work?


    The answer to each one of these questions will yield a host of details you will need to figure out before you even start thinking about how your program will be structured.

    Once you have a plan ready, then "where to start" will become pretty obvious.

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. Text Based Game Help!
    By TylerMoyer in forum Game Programming
    Replies: 10
    Last Post: 07-01-2007, 12:02 AM
  4. text based game
    By PippinofTook in forum Game Programming
    Replies: 5
    Last Post: 08-24-2005, 06:56 PM
  5. Text-Based Game Help
    By Sentral in forum Game Programming
    Replies: 6
    Last Post: 07-01-2005, 01:08 PM

Tags for this Thread