views:

65

answers:

3

I'm creating a real-time strategy game based on XNA. Which design patterns are worth considering?

+5  A: 

Rather than concentrating on how to design your application around particular design patterns, you should find the patterns in your application and then simplify the code with particular design patterns. First spend some time designing your game, and then go back and read up on how design patterns could fit your application. It is important to remember that design patterns are used to simplify your code, and you don't benefit unless the pattern is actually there.

amccormack
+2  A: 

"Flyweight." It allows a large game map for a small amount of memory. Not that memory size matters much anymore. :)

Possibly "Decorator" for some of the graphic effects.

You can use "Composite" for the game tree.

But just keep in mind that patterns are not what make a RTS - you'll find you have bigger challenges to face than this.

Brent Arias
Thanks, good points about suggested pattern!
Amir Rezaei
+1  A: 

Do not design like that. Split the system in subsystems, define which subsystem can communicate with each other, identify which classes compose the subsystem. Create a prototype of that design. During the process of developing the system you will realize more and more details. Iterate the whole process.

If you do this right then at the end of it you will see "design patterns" in your code.

fabrizioM