Thread: text rpg

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    224

    Exclamation text rpg

    could everyone please post there rpg game on this post and the source so i could look at the source and try to learn from that
    1. i wont edit the code at all
    2. i wont post it anywere
    3. i wont give it away or distribute it in any way

    its just so i can look at them play them and learn from them thanx
    (text rpg prefered)

    thanx

  2. #2
    Ethereal Raccoon Procyon's Avatar
    Join Date
    Aug 2001
    Posts
    189
    I posted some code for a text-based adventure game a while ago on this thread:

    http://www.cprogramming.com/cboard/s...&threadid=3613

    and a very basic outline for setting up a text-based RPG here:

    http://www.cprogramming.com/cboard/s...&threadid=1025

    You're welcome to do whatever you want to either of these. I also have been working on a graphical RPG battle system, which I could send you the source code for if you are interested (and you post your e-mail here so I know where to send it.)

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    thanx
    anymore code would be nice for those of u who have code that could give it to me

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    106

    check my website

    well ive written a small text-based rpg, which you may call crap, but it works, and its got some decent coding. however, i wouldnt suggest taking too much from it because its not exactly the best method of doing an rpg. anyways, enough said. theres the rpg that i finished and theres the current version for the expansion (for the first one) that im working on.
    not sureif that made sense.
    ah yes, the site addy...altho you could click on the www button, but this is easier, since the www button dosent take you right to the download page...i dont think
    http://www.geocities.com/beornsos/twcdownload.html
    when you get there, look under the heading "The Warrior Chronicles"-> latest version-> TWC Final (with source)

    theres two versions of the final version, one with hte source code and one without. make sure you get the one with the source code.

    the expansion has more efficient coding if you want to look at that
    later

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    thanx agerealm its helped me

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    224

    Question

    whats the easiest way to make and display a map in text mode and have a person move around on it using arays or what ever

    thanx

  7. #7
    Registered User
    Join Date
    Aug 2001
    Posts
    106
    well, i didnt figure out the easiest way until about october...lol. i did it the painful way in The Warrior Chronicles. the easiest way, that i know of, would be using two dimensional arrays, print out the array onto the screen and then when the user hits a key (up, down, left, right), it moves the character up or down or left or right on the array...hes a simple example...hope this helps:

    int map[5][5]={0,0,0,0,0,
    0,0,0,0,0, //two-dim array
    0,0,0,0,0,
    0,0,0,0,0,
    0,0,0,0,0 };
    int player=1; //symbol used for player on the map
    int x=0,y=0; //the players coordinates. however, TAKE
    //NOTE,that if you do use x and y, then remember
    //that x will be rows, not columns and y will be
    //columns not rows. its reveresed because...well
    //because thats how 2-dim arrays are

    for (int a=0;a<5;a++) {
    cout << "\n"; //this is needed so that the map isnt printed on
    //on one line. after each row it goes to next line
    //so it comes out as a 5x5 square
    for (int b=0;b<5;b++) {
    cout << map[a][b]; //this prints the map out
    }
    }

    ///((((the following would be in another function...maybe a
    ///movment function)))

    if (keyhit==UP) { x--; }
    if (keyhit==DOWN) { x++; }
    if (keyhit==LEFT) { y--; }
    if (keyhit==RIGHT) { y++; }

    //of course, UP, DOWN, LEFT, RIGHT can either be constants or
    //whatever. it would probably be better to use CASE statements
    //instead of if statements, but you can see the logic behind it (i
    //hope).

    //hope this helps you...let me know if youve got any questions.

    later

  8. #8
    Registered User
    Join Date
    Aug 2001
    Posts
    106
    right....well ok it didnt feel like putting my indention in the coding...how do you get it to do that? thanks.

    later

  9. #9
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    its helped me but what do you mean by

    indention

  10. #10
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    I think she meant Indentation. For example
    Code:
    if(i=1){
    
                                                                            //code
    
    }
    code is indented. Understand?

    edit...never mind it wont let me indent the it sorry. But if I remember right it automatically indents teh code :-/ Indentation isskipping some place ont the line. Like at the begining of paragraphs.
    Last edited by Isometric; 12-12-2001 at 04:56 PM.

  11. #11
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    ok i get it now

    one more thing what when you put

    >>if (keyhit==RIGHT) { y++; }

    do you need to use the word "keyhit"

    or can it be anything
    and do you need to set a variable for it

  12. #12
    I have an example Text RPG designed for learning. Have a look here .
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  13. #13
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    your link didnt work

  14. #14
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    ok 2 more things...

    1.
    Code:
    #include <iostream.h>
    #include <stdlib.h>          //the header files
    #include <dos.h>
    
    ...
    
    int playerpos[5][5];
    
    void playermov(void)
    {
            switch playerpos[x][y]
    
                  case(keyhit == UP):
                          y++;         //increase player pos when UP pressed
                          break;
                  case(keyhit == DOWN):
                          y--;         //decrease player pos when down pressed
                          break;
                  case(keyhit == LEFT):
                          x--;        //move the player left when left pressed
                          break;
                  case(keyhit == RIGHT):
                          x++;      //move the player right when right pressed
                          break;
             clrscr();       //clear the screen
             map();        //go to the map
    }

    1. would this work for moving a person on the screen

    2. how would you make it so yoiu press a button then it moves the player and then reprints the screen updated
    Last edited by c++.prog.newbie; 12-12-2001 at 08:17 PM.

  15. #15

    Here's one

    I made this a while ago here's the url:
    http://www.geocities.com/sa_hand/rpg_vc6.zip
    Email me with questions at
    [email protected]
    -Save the whales. Collect the whole set.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. text rpg help
    By xxwerdxx in forum Game Programming
    Replies: 1
    Last Post: 11-26-2005, 08:16 PM
  2. Replies: 3
    Last Post: 05-25-2005, 01:50 PM
  3. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  4. mygets
    By Dave_Sinkula in forum C Programming
    Replies: 6
    Last Post: 03-23-2003, 07:23 PM
  5. Check out My Text Rpg Game
    By knight543 in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2002, 10:40 PM