Designing An RTS

Started by
3 comments, last by Sandman 15 years, 4 months ago
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!
Advertisement
That is too much to cover in a single post. There are some books that cover the topic. One that I have read is "Programming an RTS Game with Direct3D"
Good luck!
Thanks! If anyone else has any recommendations as far as tutorials or book goes, it helps a lot.
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.
Moving to game programming.

This topic is closed to new replies.

Advertisement