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!