Sign in to follow this  

Text Based Game

This topic is 4489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

How are you programming C++ in VB6.0, I think you mean Visual Studio :)

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this