Sign in to follow this  
Gallivan

Designing An RTS

Recommended Posts

I'm not trying to revolutionize anything here, I'm just looking for the basic insight in how a basic RTS game is created. Sorry if this is in the wrong section - I thought it was too abstract for game programming, but it also might be too technical for this forum. >> main/game loop << - contains game loop which cycles in ticks through user input, run artificial intelligence, test collisions, process actions, draw to screen. - holds a list of all entities >> entities << - consists of units, buildings, and all natural barriers (rivers, trees, mountains, etc.) - holds values on their health, all combat stats - tests collision with other entities >> graphics << - draws map to screen - draws entities to screen - draws GUI to screen >> sounds << - plays various sounds Here are some of my preliminary questions, although I'm sure I'll have more: 1. How do I go about structuring my classes? I've heard that having separate classes know too much about others hurts your efforts in the long run. For example, if I wanted to play a sound when an entity attacked another: Would the sound class be called in the entity attack method?
attackEntity(otherEntity)
{
   testStrengthetc....
   playSound(attack1.mp3)
}


Another example of the same sort: Should each entity have a draw method, or should I place several draw methods into my graphics classes which look like:
class graphics()
{
   draw(building) {//code here}
   draw(unit)     {//code here}
   // etc.
}

2. Did my above "classes" look decently organized? Should I be creating one graphics object, one sound object, etc. in my main game loop and using them to call what I need done? ...That's it for now, I don't want to bog down on my first post. Thanks in advance!

Share this post


Link to post
Share on other sites
This is most definitely the wrong forum for this. This is engine design which would solidly fall under programming, that said I happen to know a bit about this.

I would recommend purchasing the book, but be warned that you are getting into a very advanced project. If you don't use abstraction and aggregation correctly the code will become very bloated very fast. I'm programming an RTS and it takes most of my brainpower to find ways to hide the bulk of my code so my head doesn't explode.
You seem to be going down the right track so with the help of a book you should be able to work something out. Whatever happens you'll be learning.

Share this post


Link to post
Share on other sites

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