Advertisement

C++ Workshop - Project 1

Started by August 16, 2006 05:41 PM
193 comments, last by me_minus 14 years, 10 months ago
Quote: Original post by kingIZZZY
Quote: If the user selects roll for stats, then he will enter a loop where he can continue to “roll for stats” until he finds a suitable distribution.
This means that Strength, Dexterity, and Constitution of player are defined randomly (8-20) at this point of the game, and that player can re-randomize these stats' values untill he is satisfied with their values. Correct?


My approach was to limit the maximum stat points from a roll to 12, that way they can reroll for the first 2 or 3 levels, but they still need to level up to become good.
My Visual C++ 2005 EE doesn't have the windows.h file needed to clear the screen as was mentioned earlier. I figured out I need to download a Platform SDK. I don't know which one I need. I have Windows XP Professional and the only ones I see were GDI+, Windows Small Server 2003 and then something for Windows 95,98, and ME.
Advertisement
The 'Server' version is what you want. It works for the server versions, 64 bit windows versions, and xp sp2.

AFAIK, there is no version for XP SP1.
Thanks, I kept reading about that version, but then I thought I have Windows XP and not Small Server 2003 and it never said use this if you have Windows XP.
Yes it does. Right on the download page. I looked it up before I answered.
I have some question on how to design the game. I already starting coding and I kind of ran into a roadblock and I'm thinking I should probably have done it another way. Should I be asking questions here or should I be pming a tutor?
Advertisement
Nope. It's fine to ask your questions here.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Ok, so I started making a base class called Menus and I started making all the Menus from the design inheriting a few functions from the Menu class (like input, clear screen, draw). Then I kind of ran into problems with how to switch from one to the other. So, I decided to think of the game in states. I figured there would be 11 states from your design specs. I’m thinking of having a state manager that puts the game states in a stack.

I’m just trying to figure out how I can check for the user input and then add a state to the stack based on what the user inputted. The best thing I can think of is having the 11 states derive from the basic game state with specific functions or pointers to other states based on input. Then create a base game state pointer to each new derived state class and store those pointers in the state manager? I’m still a little unclear how to get the input and move to another state doing something like this.

Are we going to cover the STL so I can use vectors and stack containers?

I already made up a very preliminary class to see how to organize it, but just trying to describe what I want to do to ask questions sure helped me see clearer what I’m trying to do.
[opinion]
I think you may be overthinking your design of the game. I think a state manager may be a little overkill.

A simpler design that won't cause you to pull your hair out is to simply handle the input as the user gives it.

So, when the game first starts you would display the main menu and then wait for user input for them to select the option.

Then, when they give you input, evaluate their input and determine what you should move to. So, in the case of the main menu it would take them to either another menu, or it would let them fight.

For the menus, just call the function to display the choosen menu and wait for input again.

In my design, I have a Menu class and a MenuOption class. I have a Menu::doMenu() function which will print out my menu and receive input. After the input is received, it will check the input and make sure it matches one of it's MenuOption::mKey value. If it does, it moves on. If not, it tells them the value isn't a valid choice and it will print the menu again and ask for input again.

Basically, what you will end up doing is instead of switching states, you create sort of a menu hierarchy.

So, MainMenu would be at the top and would branch down into the choices it has, and would branch again, and so on. When you want to go to the previous menu, you just pass a return statement so that menu will close and it will return to the previous menu. For a simple game like this, that would probably be a less hair pulling method.
[/opinion]

However, if you do want to use states, how you described sounds pretty good.

You could create a linked list/tree for which each state links. So, each GameState would have a pointer to the State that it goes back to, and then a vector of pointers to all of it's possible options.

You could then have a GameState * mCurrentState and keep the state you are in there. Then, you could output and ask for input. You send the input into mCurrentState and evaluate it. It would give you either a) a command to go back to it's previous menu b) a command to go to a next state or c) an invalid input in which you should ask for the input again.

Then, you could call GameState::back() or GameState::next() and move on. For the GameState::next() I would probably give it either an int index or a string name value that you pass for it to know which next GameState to go to. Your calls to back() and next() could return the pointer to the next GameState, which you would then set as mCurrentState. Rinse and repeat.

As for the STL vector and such, I'm not sure if we will cover them, but if you know how to use them, I believe Jeromy has given the go ahead to use stuff that we haven't covered in your project.

If you aren't sure how to use them, I'm sure either myself or one of the tutors would be happy to help explain how to use them. In my own program, I am using a few vectors.
I have two questions that I haven't seen asked or answered yet about the project.

First, how is the monster's difficulty calculated by level in D&D? Should we just start a monster off just like our character and level him up the same way each time? Or do we do that and buy them a better weapon and armor too? Or is there a whole different process?

Second, How are attributes gained when levelling? Does every attribute raise after every level?

This topic is closed to new replies.

Advertisement