Text Based Game

Started by
5 comments, last by Leo_E_49 18 years, 8 months ago
Hey Guys, I started to program a text based game in c++ using VStudio6.0 which is like the "earth 2025" online text game. I decided to make it a single player, single enemy game where you build up your empire and armies to defeat the enemy. I am trying to figure out ways to keep the code as simple and as clean as possible, so i decided to use classes. But now I'm stuck as I'm not sure how many classes to make? I was thinking of having a single class called cEngine that held two player structures; one for the main player and one for the randomly generated enemy. It would also have the menu functions such as saving, loading, character creation and exiting the game ( as well as the build and attack functions and such). Is this good coding style or should I have separate classes for players, menus and attacking? edit-typo [Edited by - Sabonis on August 29, 2005 3:09:42 PM]
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...
Advertisement
bump
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...

How are you programming C++ in VB6.0, I think you mean Visual Studio :)
yeah sorry visual studio
thnx
any comments on how the structure of this game should be?
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...
*bump*
I would really like some help from experienced people thanks
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...
Although I'm not the guru you're asking for, I would make every player just one class. you could derive a class for a human player or visa-versa. you could simply call a function which performs the AI... But I would go for the single class, that way you can expand the game to include as many players as you want.

There are so many ways to make it, it's kind of hard to say...
----------------------------Check out my crappy games...
Quote:Original post by SabonisIs this good coding style or should I have separate classes for players, menus and attacking?


Your approach is perfectly fine.

It really depends on your coding style, some people code with the fewest classes they can have, others (like myself) create classes liberally. Basically, if you can think of something as a tangible object, you can create a class for it.

This topic is closed to new replies.

Advertisement