https://github.com/PacktPublishing/Game-Development-Patterns-and-Best-Practices
https://github.com/mattCasanova/Mach5
1. Introduction to Design Patterns (已看)
2. One Instance to Rule Them All - Singletons (已看)
3. Creating Flexibility with the Component Object Model (已看)
4. Aritificial Intelligence Using the State Pattern (已看)
5. Decoupling Code via the Factory Method Pattern (已看)
6. Creating Objects with the Prototype Pattern
7. Improving Performance with Object Pools
8. Controlling the UI via the Command Pattern (已看)
9. Decoupling Gameplay via the Observer Pattern
10. Sharing Objects with the Flyweight Pattern
11. Understanding Graphics and Animation
1. Introduction to Design Patterns
Chapter overview
Your objective
What are design patterns?
Why you should plan for change
Separating the what and how
An introduction to interfaces
The advantages of compartmentalizing code
The problems with using design patterns in games
Project setup
What are design patterns
https://en.wikipedia.org/wiki/Software_design_pattern
Design patterns are solutions for common programming problems. More than that, they are solutions that were designed and redesigned as developers tried to get more flexibility and reuse from their code.
Although design patterns are important, they aren't just a library that we can just plug into our game.Rather, they are a level above libraries. They are methods for solving common problems, but the details of implementing them is always going to be unique to your project. However, once you have a good working knowledge of patterns, implementing them is easy and will feel natural. You can apply them when first designing your project, using them like a blueprint or starting point. You can also use them to rework old code if you notice that it's becoming jumbled. Either way, it is worth studying patterns so your code quality will improve and your programming toolbox will grow larger.
With this toolbox, the number of ways to solve a problem is limited only by your imagination. It can sometimes be difficult to think of the best solution right off the bat. It can be difficult to know the best place or best pattern to use in a given situation. Unfortunately, when implemented in the wrong place, design patterns can create many problems, such as needlessly increasing the complexity of your project with little gain. As i mentioned before, software design is similar to writing poetry in that they are both an art. There will be advantages and disadvantages to the choices you make
Why you should plan for change
A project never ends up 100% the same as it was imagined in the pre-production phase.
Understanding UML class diagrams
Software developers have their own form of blueprints as well, but they look different from what you may be used to. In order to create them, developers use a format called Unified Markup Language, or UML for short.
class Enemy { public: void GetHealth(void) const; void SetHealth(int); private: int currentHealth; int maxHealth; };