I am new to design patterns. I am trying to determine which ones would best apply to my projects. I use a mix of VB and C#.
The particular project I am working on right now is game-based.
There are a number of different entities in the game. People, vehicles, other physical objects, plus terrain. A player may have control of many game people at a time and this different people move around and do things. In many cases, things are done to the game people.
Of course the people, vehicles, terrain, etc can be classed as objects and be associated with each other. Not and "is a" or "is part of" relationship but a "has a" relationship.
More importantly, the things that the people can do and that can be done to them affect the people. These actions can change their state, their capabilities, their existence.
There are many, many different and varied possibilities, perhaps more so in terms of things being done to the game people (whether they wish it or not) than the game people acting themselves.
I would think that each of these actions by or actions on a game person would be a separate class.
What design pattern best fits this need?
As I reviewed them, this struck me as a Behavioural Pattern, probably Command. Am I on the right track?
PS. I have found this website to provide the clearest description of design patterns that I have seen yet so I am quite interested in the tool. I do my coding with a buddy. Just the two of us. I guess the cheapest option for us would be two single-user licenses?
Apr 02, 2011
This seems like a fairly complex application you're building. I would think you could certainly benefit from the following patterns: Singleton, Factory, Adapter, State, Iterator (i.e. LINQ), and possibly Facade, MVC (or MVP, MVVM), and Command. Depending on how you persist the data and/or communicate over the wire there would be several other beneficial patterns: Repository, Proxy, Bridge, DAO, etc. Then for testing you may want to look into an IOC container using the Dependency Injection pattern.
I think that with your knowledge of the game, combined with the patterns on our website as well as the Design Pattern Framework 4. 0 will make it clear which of the patterns would benefit your project the most.
And yes, for 2 developers the most cost-effective option would be two 1-user licenses of the Design Pattern Framework 4.0.
Hope this helps.
Apr 03, 2011
If it is a turn based game, the P&P will suffice. If time is a factor you need to look into the concept of a game loop.