开发者

Which design patterns to use for a XNA strategy game?

I'm creating a real-t开发者_如何学编程ime strategy game based on XNA. Which design patterns are worth considering?


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.


"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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜