Console RPG Beginnings

This is a discussion on Console RPG Beginnings within the Game Programming forums, part of the General Programming Boards category; Just wanted to post up the beginning of the console RPG that I am writing to hopefully elicit some feedback. ...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Location
    Louisville Ky
    Posts
    6

    Console RPG Beginnings

    Just wanted to post up the beginning of the console RPG that I am writing to hopefully elicit some feedback. I am trying to keep everything in it's place and will be using seperate class and cpp files. Eventually I plan to move all the menu items to a seperate cpp file. If anyone has the time, please check out the code and let me know what you think.
    Attached Files Attached Files

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,409
    in your maingame section i would use the default case to output an error message, but even if you don't want to show an error message it's not neccesary to again set the bool to false as nothing has changed since it was initialised.
    Conversely you will need to set the bool to true in the other valid case outcomes to break the loop, and don't forget to again set as false after you exit the loop so you can get back in to it in future.

    also since you are explicitly using a bool:

    Code:
    while(!validSelection)
    is preferred to:
    Code:
    while(validSelection != true )
    Consider using a little gotoXY() function (you can find one in the FAQ section) to control your display output rather than using the CLS calls so much. As your game develops it will be a lot more useful and look better too.

    You have defined a constructor for the character class, you should take advantage of this and use it to guarantee correctly initialised member variables or call member functions to do it.

    You use a function SetValues() to set the health and magic points but then have individual 'Get..()' functions for them, i would use a single set() and get(), then you could just do something like:

    Code:
    enum STATUS_VAL {    //in a header
    	
    	MAGIC,
    	HEALTH,
    	STAMINA,
    	STRANGENESS,
    	CHARM,
    };
    	
    	outValue = player.GetValue(MAGIC);
    And use a switch in your GetValue() function implementation to select the appropriate value to return.
    Last edited by rogster001; 10-20-2010 at 07:24 AM.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    Registered User
    Join Date
    Oct 2010
    Location
    Louisville Ky
    Posts
    6
    Thanks a bunch for the feedback. I have been out of C++ for a while and am just now getting back into it, so I am a bit rusty. I will get this stuff implemented and will likely post my code up again at some future point. Since I don't do any c++ professionally, it's nice to know when you are on the right path rather than just writing something that works.

  4. #4
    Registered User
    Join Date
    Oct 2010
    Location
    Louisville Ky
    Posts
    6
    I've got most of that implemented. Only part I haven't done is the enum. I've got a generic getValue implementation in place now but I need to set it up to accept the enum. I haven't used enums for years so I need to read up on them a little bit. Thanks again.

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    9
    couldnt get it to work right :-S

    had to include windows.h with mingw to get it to compile
    made it to main menu

    Ill what would you like to do?
    1. Adventure
    2. Shop
    3. View Stats
    4. Save
    5. Exit
    Please enter your selection:
    but clears screen and outputs menu again at any selection even 5. Exit
    Last edited by illizit; 11-03-2010 at 09:57 PM.

  6. #6
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,409
    post a bit of relevant code that describes the problem, also try developing your menu handling as a test project, just so you can concentrate on that funcionality alone, once it's working just plug it into your game.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Nintendo 3DS
    By Cheeze-It in forum General Discussions
    Replies: 30
    Last Post: 03-27-2010, 02:32 AM
  2. problem
    By ExDHaos in forum C++ Programming
    Replies: 12
    Last Post: 05-22-2009, 04:50 AM
  3. Full Screen Console
    By St0rmTroop3er in forum C++ Programming
    Replies: 1
    Last Post: 09-26-2005, 09:59 PM
  4. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 09:19 AM
  5. My Console RPG with scrolling terrain ver 4!
    By Jeremy G in forum Game Programming
    Replies: 4
    Last Post: 11-25-2001, 03:39 PM

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