Thread: Need help with concepts for first game

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    100

    Need help with concepts for first game

    Hey I'm making my first game. I've decided to do what everyone else seems to start off doing - a text based rpg.

    However, my aspirations have led me to be clueless. Just what the heck am I supposed to accomplish as a goal? I mean it's so open-ended and stuff. THats where I need your help. Please, what sort of goals should I make? I don't want to make a game without goals in mind.

  2. #2
    Nonconformist Narf's Avatar
    Join Date
    Aug 2005
    Posts
    174
    The goal of a classic RPG is simple: Some bad guy/thing is threatening everyone by doing something bad. The goal is to walk around and beat his stronger minions that are conveniently placed at the bottom of various dungeons that are filled with his weaker minions. The bosses are also conveniently comparable to you in strength at all times. Fill in the blanks and you're solid.
    Just because I don't care doesn't mean I don't understand.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    100
    Maybe concepts was the wrong word. Maybe mechanics is a better one. I don't want you to write it for me or anything, but I just need some slight guidance. Like how to store a character and such. So far I have really stupidly basic ideas that they're not ideas .

    Code:
    //Text Based RPG v1.0
    //First implementations
    
    #include <iostream>
    using namespace std;
    
    class Human {
          public:
          short int h_BaseHitPoints;
          short int h_BaseStrength;
          short int h_BaseManaPoints;
          short int h_BaseAccuracy;
    };
          
    class Dwarf {
          public:
          short int d_BaseHitPoints;
          short int d_BaseStrength;
          short int d_BaseManaPoints;
          short int d_BaseAccuracy;
    };
          
    class Elf {
          public:
          short int e_BaseHitPoints;
          short int e_BaseStrength;
          short int e_BaseManaPoints;
          short int e_BaseAccuracy;
    };
          
    int main() {
        cout << "\t\t\tWELCOME TO TEXT RPG v1.0!" << endl;
        cin.get();
        return 0;
    }

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I notice you've created 3 separate classes that have the exact same members that differ only by the naming convention. Perhaps you should just make one single Unit class. If you want to specialise the Unit class, use inheritance.

  5. #5
    Nonconformist Narf's Avatar
    Join Date
    Aug 2005
    Posts
    174
    Maybe mechanics is a better one.
    Ya, much better. It makes sense to break the game into several different engines that work together, like the battle engine, the world engine, the shop engine, etc... You can use a common base class for players and mosters alike, then specialize in the children. For example, all characters would have hit points, but only the player characters would have equipment lists. The non-player characters might need special functions for making decisions while the player characters would need some kind of interface for the user.

    You probably want to start with the battle engine, because it's a big part of the game, and you can figure out what you would need as far as attributes and equipment.
    Just because I don't care doesn't mean I don't understand.

  6. #6
    Call me AirBronto
    Join Date
    Sep 2004
    Location
    Indianapolis, Indiana
    Posts
    195
    As Dante Shamest said if all of your units are going to have the exact same parameters then just make one class, and just make each unit different with the constructor. Then if you are going to have units with different parameters use inheritance. (this is just deeper calarification of what Dante Shamest said)

  7. #7
    Registered User
    Join Date
    Jul 2005
    Posts
    100
    Also, I don't think DOS text-based games are of much use for SAVING. Ha, makes me laugh. Seriously, that's stupid right?

    Also, I've always wondered about characters like storing an answer and then computing it or giving you the result. How would I implement a Name save for the Character ?

  8. #8
    Registered User Kirdra's Avatar
    Join Date
    Aug 2002
    Posts
    105
    I have brought you a fountain for your game... I would also give your characters some kind of location variables (i.e x,y).

    Code:
    cout << "You arrive at the fountain of forgiveness..." << endl;
    cout << "You begin to pray..." << endl;
    
    int opt = rand()%3;
    
    if(opt == 0)
    {
         ++health;
         cout << "You have been forgiven" << endl;
    }
    if(opt == 1)
    {
         --health;
         cout << "You will suffer for eternity" endl;
    }
    
    if(opt == 2)
         cout << "No Reply...";

  9. #9
    Registered User
    Join Date
    Jul 2005
    Posts
    100
    I've never understood the rand() function. OBVIOUSLY it means random, but the %3 i have no idea about. I mean I just need context clues is all. And is there a specified header for that function?

    I'm also assuming that opt is option. Woohoo lol. Makes sense almost.

  10. #10
    Registered User
    Join Date
    Jul 2005
    Posts
    100
    UPDATE:

    Code:
    //Text Based RPG v1.0
    //First implementations
    
    #include <iostream>
    using namespace std;
    
    class Character {
          public:
          char CharacterName[12];
          short int BaseHitPoints;
          short int BaseStrength;
          short int BaseManaPoints;
          short int BaseAccuracy;
    };
      
    int main() {
        
        
        char CharacterClass[1];
        int CharacterClassvar;
        int Dwarf;
        int Elf;
        int Human;
        
        
        cout << "\t\t\tWELCOME TO TEXT RPG v1.0!" << endl;
        cout << "\nYou have just entered the realm of Bazeor and you shall choose your path." << endl;
        cin.get();
        cout << "[d]warves have much skill with the axe and hammer and have much brute strength." << endl;
        cout << "[e]lves are cunning and have high accuracy and agility and are proficient with the bow." << endl;
        cout << "[h]umans are not very special, although they are very well balanced characters." << endl;
        cout << "\n\t\tCHOOSE YOUR PATH young adventurer" << endl;
        cout << "\nYour Character Class: " << endl;
        
        Character Player;
        cin >> CharacterClass;
        if (CharacterClass == d) {
                           CharacterClassvar = Dwarf;
                           Player.BaseHitPoints = 50;
                           Player.BaseStrength = 6;
                           Player.BaseManaPoints = 10;
                           Player.BaseAccuracy = 2;
                           cout << "Welcome dwarf to the world of Bazeor full of treachery and villany." << endl;
                           };
        if (CharacterClass == e) {
                           CharacterClassvar = Elf;
                           Player.BaseHitPoints = 40;
                           Player.BaseStrength = 1;
                           Player.BaseManaPoints = 50;
                           Player.BaseAccuracy = 8;
                           cout << "Welcome elf to the world of Bazeor full of treachery and villany." << endl;
                           };
        if (CharacterClass == h) {
                           CharacterClassvar = Human;
                           Player.BaseHitPoints = 45;
                           Player.BaseStrength = 3;
                           Player.BaseManaPoints = 30;
                           Player.BaseAccuracy = 5;
                           cout << "Welcome human to the world of Bazeor full of treachery and villany." << endl;
                           };
                           
        
        cin.get();
        return 0;
    }
    Yeah compiler errors
    The main one is that i'm readin character input wrong when choosing the class. I mean how exactly should I read their input?

  11. #11
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Quote Originally Posted by blankstare77
    I've never understood the rand() function. OBVIOUSLY it means random, but the %3 i have no idea about. I mean I just need context clues is all. And is there a specified header for that function?

    I'm also assuming that opt is option. Woohoo lol. Makes sense almost.
    Basically the mod (%) operator in this case restricts the range of random numbers. In general you can get a random number in the range 0 to (n - 1) by modding by n. So in the % 3 case you will either get 0, 1, or 2 as a result. Located in the stdlib.h header for C or cstdlib for C++. Opt is probably short for option as you suggested.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  12. #12
    Registered User
    Join Date
    Jul 2005
    Posts
    100
    Quote Originally Posted by MrWizard
    Basically the mod (%) operator in this case restricts the range of random numbers. In general you can get a random number in the range 0 to (n - 1) by modding by n. So in the % 3 case you will either get 0, 1, or 2 as a result. Located in the stdlib.h header for C or cstdlib for C++. Opt is probably short for option as you suggested.
    Oh! I kind of thought that the %3 meant that there were 3 possible solutions so that's cool thanks for the clarification. Now for help compiling this monstrosity above.

  13. #13
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Quote Originally Posted by blankstare77
    Oh! I kind of thought that the %3 meant that there were 3 possible solutions so that's cool thanks for the clarification. Now for help compiling this monstrosity above.
    Okay, here is one way you could accomplish what you are attempting to do. Have you ever used STL's string class? It's has a lot of functionality but you don't need to know all of the underlying mechanics to appreciate it. Just include <string> at at the top of your program. Now instead of having CharacterClass being a 1 element char array, we will change that to be a string.

    Code:
    string CharacterClass;
    Reason: You can't have a 1 element character array and expect the user to just enter one character. It would be very easy for someone to accidently overflow that buffer. Even if they did just enter one character you would need a 2 element array for the null terminator at the end.

    So now we have the value d, h, or e hopefully in our string. Now to test it we can simply do an equality comparison

    Code:
    if(CharacterClass == "e")
    Note: Before you had just d when comparing your 1 element array. What you wanted was 'd' for a literal character. Instead, your compiler was looking for a variable named d which didn't exist.

    If you don't feel comfortable using string's, you might want to look into switching it so the user enters a number to determine which character class he wants.
    You can read more about STL string class here:
    http://www.msoe.edu/eecs/cese/resources/stl/string.htm

    Edit Note: You assign CharacterClassvar to Dwarf or Elf or Human but those are uninitialized variables. I'll trust that you just put that there temporarily, because nothing good will come from that assignment.
    Last edited by MrWizard; 08-31-2005 at 06:21 PM.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  14. #14
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by blankstare77
    UPDATE:

    Code:
    //Text Based RPG v1.0
    //First implementations
    
    #include <iostream>
    using namespace std;
    
    class Character {
          public:
          char CharacterName[12];
          short int BaseHitPoints;
          short int BaseStrength;
          short int BaseManaPoints;
          short int BaseAccuracy;
    };
      
    int main() {
        
        
        char CharacterClass[1];
        int CharacterClassvar;
        int Dwarf;
        int Elf;
        int Human;
        
        
        cout << "\t\t\tWELCOME TO TEXT RPG v1.0!" << endl;
        cout << "\nYou have just entered the realm of Bazeor and you shall choose your path." << endl;
        cin.get();
        cout << "[d]warves have much skill with the axe and hammer and have much brute strength." << endl;
        cout << "[e]lves are cunning and have high accuracy and agility and are proficient with the bow." << endl;
        cout << "[h]umans are not very special, although they are very well balanced characters." << endl;
        cout << "\n\t\tCHOOSE YOUR PATH young adventurer" << endl;
        cout << "\nYour Character Class: " << endl;
        
        Character Player;
        cin >> CharacterClass;
        if (CharacterClass == d) {
                           CharacterClassvar = Dwarf;
                           Player.BaseHitPoints = 50;
                           Player.BaseStrength = 6;
                           Player.BaseManaPoints = 10;
                           Player.BaseAccuracy = 2;
                           cout << "Welcome dwarf to the world of Bazeor full of treachery and villany." << endl;
                           };
        if (CharacterClass == e) {
                           CharacterClassvar = Elf;
                           Player.BaseHitPoints = 40;
                           Player.BaseStrength = 1;
                           Player.BaseManaPoints = 50;
                           Player.BaseAccuracy = 8;
                           cout << "Welcome elf to the world of Bazeor full of treachery and villany." << endl;
                           };
        if (CharacterClass == h) {
                           CharacterClassvar = Human;
                           Player.BaseHitPoints = 45;
                           Player.BaseStrength = 3;
                           Player.BaseManaPoints = 30;
                           Player.BaseAccuracy = 5;
                           cout << "Welcome human to the world of Bazeor full of treachery and villany." << endl;
                           };
                           
        
        cin.get();
        return 0;
    }
    Yeah compiler errors
    The main one is that i'm readin character input wrong when choosing the class. I mean how exactly should I read their input?
    Here, I fixed the errors and modified it a bit with whatever I noticed.

    Code:
    //Text Based RPG v1.0
    //First implementations
    
    #include <iostream>
    #include <cctype> //for toupper()
    using namespace std;
    
    class Character {
          public:
          char CharacterName[12];
          short int BaseHitPoints;
          short int BaseStrength;
          short int BaseManaPoints;
          short int BaseAccuracy;
    };
      
    int main() {
        char CharacterClass;
        int CharacterClassvar;
        int Dwarf;
        int Elf;
        int Human;
    
        while (1) {
          cout << "\t\t\tWELCOME TO TEXT RPG v1.0!" << endl;
          cout << "\nYou have just entered the realm of Bazeor and you shall choose your path." << endl;
          cin.get();
          cout << "[D]warves have much skill with the axe and hammer and have much brute strength." << endl;
          cout << "[E]lves are cunning and have high accuracy and agility and are proficient with the bow." << endl;
          cout << "[H]umans are not very special, although they are very well balanced characters." << endl;
          cout << "\n\t\tCHOOSE YOUR PATH young adventurer" << endl;
          cout << "\nYour Character Class: " << endl;
    
          Character Player;
          cin >> CharacterClass;
          CharacterClass = toupper(CharacterClass); //make sure its upper case, so d and D will work.
    
          switch (CharacterClass) {
            case 'D':
                           CharacterClassvar = Dwarf;
                           Player.BaseHitPoints = 50;
                           Player.BaseStrength = 6;
                           Player.BaseManaPoints = 10;
                           Player.BaseAccuracy = 2;
                           cout << "Welcome dwarf to the world of Bazeor full of treachery and villany." << endl;
            break;
            case 'E':
                           CharacterClassvar = Elf;
                           Player.BaseHitPoints = 40;
                           Player.BaseStrength = 1;
                           Player.BaseManaPoints = 50;
                           Player.BaseAccuracy = 8;
                           cout << "Welcome elf to the world of Bazeor full of treachery and villany." << endl;
            break;
            case 'H':
                           CharacterClassvar = Human;
                           Player.BaseHitPoints = 45;
                           Player.BaseStrength = 3;
                           Player.BaseManaPoints = 30;
                           Player.BaseAccuracy = 5;
                           cout << "Welcome human to the world of Bazeor full of treachery and villany." << endl;
            break;
            default:
                           cout << "Invalid entry.";
                           continue;
            break;
          }
    
          break;
        }
    
        cin.ignore();
        cin.get();
        return 0;
    }
    The reason it was giving errors wasnt because of your input, but because you were trying to compare: CharacterClass with D, which it though was a variable, for a char you must put 'D', and for strings you put "string here". I switched your if statements to a switch statement, for clarity, and the default: incase other than D E or H are entered; added an to upper case effect incase they enter d or D or h or H, it will work either way; also added a while statement so it goes back to the class choice if they enter anything but D E or H; also added cin.ignore() before cin.get() because it didnt pause (because you previously had used cin, you must use ignore before cin.get from not on for it to have a pause effect).
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  15. #15
    Registered User
    Join Date
    Jul 2005
    Posts
    100
    Code:
    //Text Based RPG v1.0
    //First implementations
    #include <cstdlib> //includes rand() function (an example: when rand() %3 means 
    //means that the answer can be either case/value 0, 1, or 2!
    #include <string> // used for 
    #include <iostream>
    using namespace std;
    
    class Character {
          public:
          short int BaseHitPoints;
          short int BaseStrength;
          short int BaseManaPoints;
          short int BaseAccuracy;
    };
      
    int main() {
        
      
        string CharacterClass;
        int CharacterClassvar;
        int Dwarf;
        int Elf;
        int Human;
       
      
        
        
        cout << "\t\t\tWELCOME TO TEXT RPG v1.0!" << endl;
        cout << "\nYou have just entered the realm of Bazeor and you shall choose your path." << endl;
        cin.get();
        cout << "[d]warves have much skill with the axe and hammer and have much brute strength." << endl;
        cout << "[e]lves are cunning and have high accuracy and agility and are proficient with the bow." << endl;
        cout << "[h]umans are not very special, although they are very well balanced characters." << endl;
        cout << "\n\t\tCHOOSE YOUR PATH young adventurer" << endl;
        cout << "\nYour Character Class: " << endl;
        
        Character Player;
        cin >> CharacterClass;
        if (CharacterClass == "d") {
                           CharacterClassvar = Dwarf;
                           Player.BaseHitPoints = 50;
                           Player.BaseStrength = 6;
                           Player.BaseManaPoints = 10;
                           Player.BaseAccuracy = 2;
                           cout << "Welcome dwarf to the world of Bazeor full of treachery and villany." << endl;
                           };
        if (CharacterClass == "e") {
                           CharacterClassvar = Elf;
                           Player.BaseHitPoints = 40;
                           Player.BaseStrength = 1;
                           Player.BaseManaPoints = 50;
                           Player.BaseAccuracy = 8;
                           cout << "Welcome elf to the world of Bazeor full of treachery and villany." << endl;
                           };
        if (CharacterClass == "h") {
                           CharacterClassvar = Human;
                           Player.BaseHitPoints = 45;
                           Player.BaseStrength = 3;
                           Player.BaseManaPoints = 30;
                           Player.BaseAccuracy = 5;
                           cout << "Welcome human to the world of Bazeor full of treachery and villany." << endl;
                           };
        
        cin.ignore();
        cin.get();
        
        cout << "In a distant town not far from Macksgrail is a young " << endl; 
       
        
        return 0;
    }
    I really want to incorporate the character class and the character name so like if the character was Elf Jim it would be better than just Elf, you know? I tried it with characters but i got a BAJILLION of errors.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  3. So you want to be a game programmer?
    By dxfoo in forum Game Programming
    Replies: 23
    Last Post: 09-26-2006, 08:38 AM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM