Skip to content

Commit 80a10bf

Browse files
committed
Updated readme
1 parent 56cfac7 commit 80a10bf

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

Diff for: _text/11-subclass-sandbox.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Define several protected methods in the parent class and how they are implemente
1616

1717
- **Type Object.** Instead of defining all methods in the parent you could give the child a reference to an object that defines these methods.
1818

19-
- **Template.** Is the opposite of the Subclass sandbox pattern. In the Subclass Sandbox you implement the methods in the parent class while in Template you implement the methods in the child class.
19+
- **Template.** Here you override the methods in the parent class.
2020

2121

2222
## [Back](../)

Diff for: _text/22-facade.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ Create a manager class that provides a single interface to a large collection of
1010

1111
- In games it's common to write standardized code libraries, such as a library for the AI, which includes pathfinding, etc. These tend to include massive amounts of classes. To make it easier for yourself you create a script that includes access to the most important methods you need, such as get a short path. I made an open source library: [Computational geometry](https://github.com/Habrador/Computational-geometry). There are multiple methods on how to generate a Delaunay triangulation. To simplify the access to those methods I wrote a class called _Delaunay, which access each Delaunay method in a simple way. Otherwise you would have to first go into the Delaunay folder and figure out which class is doing what and which method you should use to generate the needed Delaunay triangulation. And if I decided to use another triangulation library I only need to change the facade script. Multiple Facades are allowed, so I also have another Facade for the intersection algorithms.
1212

13-
- Random numbers are common in games. Should you use Unity's Random.Range or C#'s System.Random.Next? You can use the Facade pattern to easier switch between them. An example of this can be found in the code section. And if you find a third random number library, you can add it and you don't have to make a single change to the code that uses this Facade.
13+
- Random numbers are common in games. Should you use Unity's Random.Range or C#'s System.Random.Next? You can use the Facade pattern to easier switch between them. An example of this can be found in the code section. And if you find a third random number library, you can add it and you don't have to make a single change to the code that uses this Facade.
14+
15+
- Can simplify audio interactions by providing methods for playing, pausing, stopping, and managing different audio sources.
16+
17+
- Can provide a unified interface to handle keyboard, mouse, and controller inputs, abstracting the complexities of different input devices.
18+
19+
- Can be used to create a simplified interface for managing game save and load operations. It encapsulates the details of serialization, deserialization, and data storage.
20+
21+
- For games with physics simulation, a facade can provide a simplified interface for applying forces, detecting collisions, and managing physical interactions. It abstracts away the underlying physics engine complexities.
1422

1523
**Related patterns**
1624

Diff for: _text/23-template.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@ Define a template method in the parent class which consists of calling several m
1010

1111
- When your child classes share behavior and the parent class can provide these behaviors. The example in the code shows how to assemble Tesla cars. While each car consists of different parts the process of assembling a car is the same.
1212

13+
- To define the behavior of game characters. The common algorithm structure could include actions like movement, attacking, and interacting with the environment. Subclasses representing different character types (e.g., warrior, mage, rogue) can then override specific steps to implement their unique abilities and attributes.
14+
15+
- In games that involve procedural level generation, the template algorithm can outline the general layout and components of a level, while subclasses can customize the details, such as terrain features, obstacles, and enemy placement.
16+
17+
- For AI systems, the template algorithm could include steps like evaluating threats, considering objectives, and choosing actions. Different AI agents or enemy types can then provide their own implementations for specific decision-making criteria.
18+
19+
- The Template Method Pattern can be applied to define the behavior of different game states (e.g., menu, gameplay, cutscene). The template algorithm could specify the transitions and behavior common to all states, while individual state subclasses can implement state-specific logic.
20+
1321
**Related patterns**
1422

15-
- **Subclass Sandbox.** Is the opposite of the Template pattern. In the Subclass Sandbox you implement the methods in the parent class, while in Template you implement the methods in the child class.
23+
- **Subclass Sandbox.** Here you combine methods defined in the parent class.
1624

1725

1826
## [Back](../)

0 commit comments

Comments
 (0)