c# - designing class hierarchy for typical characters in role playing game -


I am trying to design a game that is playing a simple role in which your specific character types like fighter, magician, Clerics, thieves, etc. I need advice in a good way to setup a class hierarchy.

My initial effort was to make a type of "character" and make a fighter, magician, cleric, derivative type from "character".

But then I thought it might be better to create a "character" class and then use the decorator pattern. So say a fighter decorator, magician decorator, etc.

Or would any other way be better?

I will use a combination of strategy and decorator patterns. Your initial suggestion is something like a strategy method approach.

Try to differentiate between character types and character traits; Character types like fighter, magician, cleric, etc. will be something ... and should design it with a pattern of strategy, resulting in some hierarchy tree May be.

Characteristic elements, fire, elemental, dark force, ...

Example A fighter can choose to have their originals between fire and water, such as a Pirate (Arar!) Or a Blacksmith, if you design this sequentially, you are ruined because it will explode your hierarchy tree in size.

Such character qualities should be applied with decorator pattern, because it is an orthogonal concept for character concept. So you can basically make a fighter and wrap a water original decorator to get a pirate (arrow!). Or create a wizard's character and wrap a dark magic decorator to mix a dark magician around it. Or: Crush a wizard character and wrap a water elemental and a deep magic decorator around it to get a swapplan wizard.

Some food for ideas:

  • If you decide to keep all the characters the ability to magic, then design magic as the virtues of magic Please.

  • If necessary: ​​Arrange decorative in any sort of hierarchical structure. Maybe you have "original" (water, fire, earth, air) decorative hierarchy and "magic type" (black, white) decorative hierarchy.

Have fun!


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -