Need: Suggestions, with reasoning, on which Design Pattern I need to study.
I am NOT seeking code examples. I am looking for a specific Design Pattern to study and put my mental effort into understanding, so I can tackle the upcoming hurdles in what I am trying to do.
Brief Summary Points:
- I read: Refactoring Guru, and attempted to correlate what I am hoping to accomplish, with the suggestions for the various design patterns. I came out with even more questions and headaches than I started.
- I wrote a game for Play-by-Post forum format that I want to turn into a genuine, 2D, text and flat image game.
- I had little difficulty getting through the MVP version, to simplify running the PbP format game, but, now want to actually make a real game out of this (saving state, handling entire turn resolutions, etc)
- I have objects in the game, that I can understand are objects, but, I can't figure out what design pattern to apply to them; as my current "code state" (if it can be so generously called that), keeps devolving into a bewildering pile of functions and trash. I want to use OOP and figure-out what design pattern to actually learn.
Situation:
In my game, there exists Three Kinds of "Characters": Leaders, Units, and Companions. Each of them functions overall fairly similarly in the game, however; there are concrete differences.
Similarities:
- All possess certain same block info: Name, Race, Current Location, etc
- All are able to perform SOME kind of action.
- All are able to perform an Assist action.
- All possess Skills with numeric values.
Differences:
- Leaders can perform set(A) of actions, and cannot perform set(B) actions. With certain qualifiers, they can perform set(C).
- Units can perform set(B) and not set(A). Never set(C).
- Companions can always perform set(C), but, never set(A) or set(B).
- Leaders have health and can fight.
- Units have personnel count OR health and can fight
- Companions do not fight and do not have health.
During gameplay:
- Players assign actions to each of their Characters, the game should display only options for the available choices for that given Character (meaning, if the player selects a Unit, it should grey-out characters from set(A), and enable set(B), and the Assist action.
Finally:
I am learning Python, using Python3.7. I have a vague understanding of how to use classes.
Please let me know if this is sufficient information.
Thank you all, in advance, for the guidance!
Aucun commentaire:
Enregistrer un commentaire