Text based game

This is a discussion on Text based game within the Game Programming forums, part of the General Programming Boards category; What would i need to know about to make a console text based game in C++. I've been wondering this ...

  1. #1
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321

    Text based game

    What would i need to know about to make a console text based game in C++. I've been wondering this for a while now, so i hope you can help me.

    Thanks in advance!

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    C++ basics.

    Functions, pointers ( not vital ) program flow and structure and perhaps some light OOP.

    Start small and build it up. It might also help to plan a rough idea on paper first
    I'm just trying to be a better person - My Name Is Earl

  3. #3
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    how would i use a load or save feature, would i write the usernames and passwords to a file and make it readonly or something?

  4. #4
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    Yes. You would have to use fstream. But if you are talking about making a basic text game, I would not worry to much about that sort of thing at the moment. Get the bulk of the code working and working well first, before you make any tech changes. Also it helps to add a player inventory ( vector perhaps ? ) to track some of the players personal data.
    I'm just trying to be a better person - My Name Is Earl

  5. #5
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    Whats vector? Thats the only part in the thread that i don't get.
    I have used fstream a few times and know a little about pointers and OOP.

    And know the basics ofcourse.

  6. #6
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    As in std::vector of the STL (Standard Template Library). Most C++ tutorials at least go over the basics of the STL.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  7. #7
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    Think of a vector as a container. For example, there can be a vector of data type int or a vector of data type string. If you know what arrays are, understanding vectors should be simple. A vector is basically a dynamic array, able to shrink and expand to accommodate information.
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  8. #8
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    Active example:

    Code:
    std::vector<std::string>  inven;
    std::vector<std::string>::iterator iter;
    
    inven.push_back("SWORD");
    
    for ( iter = inven.begin(); iter != inven.end(); iter++ )
    {
       std::cout << *iter << std::endl;
    }
    One of there many uses.
    I'm just trying to be a better person - My Name Is Earl

  9. #9
    xzk
    xzk is offline
    Registered User
    Join Date
    Oct 2006
    Location
    Little Rock, Arkansas
    Posts
    2

    Question

    Quote Originally Posted by swgh View Post
    Active example:

    Code:
    std::vector<std::string>  inven;
    std::vector<std::string>::iterator iter;
    
    inven.push_back("SWORD");
    
    for ( iter = inven.begin(); iter != inven.end(); iter++ )
    {
       std::cout << *iter << std::endl;
    }
    One of there many uses.
    What do your abbreviations mean? I'm trying to read your code so that I can implement vectors into my text game.

  10. #10
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    inven = Inventory
    iter = iterator

  11. #11
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,586
    Again last post prior to xzk was nearly 4 months ago.

    Closed. Please do not bump old threads.

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. New Project, text game, design stage.
    By Shamino in forum Game Programming
    Replies: 9
    Last Post: 05-23-2007, 06:39 AM
  3. easiest way to make text based game?
    By oceanrats in forum C++ Programming
    Replies: 7
    Last Post: 08-13-2005, 02:17 PM
  4. Saving a text game
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 03-27-2002, 12:33 PM
  5. Text Based Game
    By drdroid in forum C++ Programming
    Replies: 2
    Last Post: 02-18-2002, 05:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21