Text Game Review

This is a discussion on Text Game Review within the Game Programming forums, part of the General Programming Boards category; Hey.. I made a charecter generator for a RPG. I'm not done yet, but I want someone to review my ...

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    83

    Text Game Review

    Hey.. I made a charecter generator for a RPG. I'm not done yet, but I want someone to review my code. How can I improve it? Is there something that could ahve been done ebtter? I'm a begginer in C++, I just want opinions. I've attatched the ZIP with the Headers, sources, and vc6 workspace. Thanks!
    Attached Files Attached Files

  2. #2
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    Looks good, however:
    Code:
    cout << "What class do you choose to be(E/M)? ";
    (F/M)*, and maybe use numbers instead?

    A few things you might want to add: More classes (Thief, Assassin, Ranger, Archer, Soldier, Farmer), more races (Abandonned Angel, Dragon-Men, Dwarf), Male/Female, perks! (If you haven't played fallout ask me, and I will describe), Name (don't recall...).

    Coding looks fine to me, might want to keep a standart indent, not 3, 4, etc... (I sugest 2, I always use 2, it's the easiest and less time-consuming).

    Next-time you post code for review, maybe add it all into one file so it's easier to look at.

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    looks good from what i saw... on the Dark Nemesis' note, you should include a 'main.cpp' file so we know where to start, and mayve a txt file with a brief explanation of what each file does... or comments in the main.cpp file...

    adding to what Dark Nemesis said, I would do this differently:

    Code:
          ...	
                    // Get players race
    	cout << endl
    		 << "Elf" << endl
    		 << "Orc" << endl
    		 << "Human" << endl
    		 << endl << endl;
    
    	cout << "What race do you choose?(E/O/H) ";
    	cin >> cvalue;
                    ...
    this is how i would do it (cvalue is an int)
    Code:
          ...
    	// Get players race
    	cout << endl << "Choose your race\n"
    		 << " 1. Elf" << endl
    		 << " 2. Orc" << endl
    		 << " 3. Human" << endl
    		 << "Enter the number of your choice: ";
    	cin >> cvalue;
                    ...
    or
    Code:
          ...
    	// Get players race
    	cout << endl
    		 << "[E]lf" << endl
    		 << "[O]rc" << endl
    		 << "[H]uman" << endl
    		 << endl << endl;
    
    	cout << "What race do you choose?(E/O/H) ";
    	cin >> cvalue;
                    ...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    Registered User
    Join Date
    Oct 2003
    Posts
    83
    Thanks a lot guys. I noticed another problem though. Let's say you type in "Elf" for the first question. It will put 'l' and 'f' in the queue and it will answer the questions for you. how can i only get the first charecter?

    ps: how can i clear screen?

  5. #5
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    try this:
    Code:
    ...
    cin>>cvalue;
    cin.ignore(1000,'\n');
    ...
    the 1000 is a semi-random value...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  6. #6
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    ps: how can i clear screen?
    Code:
    clrscr();

  7. #7
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    some compilers don't have that in the library tho... if yours doesn't just use
    Code:
    system("cls");
    it's in the cstdlib library...

    or you can just check the FAQ (i suggest option 5 )
    Last edited by major_small; 10-22-2003 at 09:04 AM.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  8. #8
    Registered User
    Join Date
    Oct 2003
    Posts
    83
    wow, thanks everyone! everything you said works great! Just one more problem. Its the same one as with the cin, but with the cin.getline. If you put cin.ignore, you have to push return again to continue. That's kindof annoying. Is there a way I can avoid that?

  9. #9
    Registered User
    Join Date
    Oct 2003
    Posts
    83
    Also, i heard you should make your header file names match your source files. Why can't I just make a mob.h for the mob struct and other mob variables?

  10. #10
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    Originally posted by punkrockguy318
    wow, thanks everyone! everything you said works great! Just one more problem. Its the same one as with the cin, but with the cin.getline. If you put cin.ignore, you have to push return again to continue. That's kindof annoying. Is there a way I can avoid that?
    Why do you want to use cin.ignore if it does that?

  11. #11
    Registered User
    Join Date
    Oct 2003
    Posts
    83
    Originally posted by Dark Nemesis
    Why do you want to use cin.ignore if it does that?
    then what else can i use?

  12. #12
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by punkrockguy318
    Also, i heard you should make your header file names match your source files. Why can't I just make a mob.h for the mob struct and other mob variables?
    You can
    Away.

  13. #13
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    Originally posted by punkrockguy318
    then what else can i use?
    I don't know what cin.ignore does, my question was why do you use it if it gives you problems, someone might know an alternative.

  14. #14
    Registered User
    Join Date
    Oct 2003
    Posts
    83
    oh, i gotya

  15. #15
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    ...How can someone tell you an alternative if you don't tell us what it is for. So you didn't get me...

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. text based mmo type game.....
    By SONAR in forum Game Programming
    Replies: 0
    Last Post: 12-09-2008, 05:17 AM
  2. Help with my text adventure game.
    By Haggarduser in forum Game Programming
    Replies: 15
    Last Post: 10-26-2007, 02:53 AM
  3. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 03:17 PM
  4. My Memory Game
    By jazy921 in forum C Programming
    Replies: 0
    Last Post: 05-05-2003, 06:13 PM
  5. My Pre-Alpha Version Rpg Text Game
    By knight543 in forum C++ Programming
    Replies: 1
    Last Post: 04-06-2002, 06:02 AM

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