The Goal: Create a game mechanic or mini-game in under a week that involves the Template Design Pattern in the code's implementation.
1. Briefly, what was the game feature you chose to create?
This game feature is a clicker game with different power ups that can all affect the number of “pets” you get either idly or by clicking.
2. What is the player able to do with the game feature you chose to create? What goal are they able to achieve with it and for what purpose? To put this another way, complete this sentence: As a player, I want to <goal> so I can <reason>.
The player is able to spend their pets on the different power-ups that are used to get even more pets. To put this in the sentence format: “As a player, I want to click the cat and optimize my power-ups so I can see the number of pets go up.”
3. What is the multi-step process you are implementing with the Template Method design pattern?
When the player clicks a powerup, the game has to first check if they have the right amount of pets needed to buy the powerup, then the superclass activates the individual parts of the powerup that make the number of pets go up faster and shows the tutorial description text.
4. How is the process different across the subclasses that implement parts of the template method differently?
One powerup permanently doubles the amount of pets you get from one click in a way that stacks. Another powerup adds some auto-clicking pets that get more powerful with each purchase of the powerup. The last powerup makes all clicks 10x as powerful for 30 seconds before wearing off.
5. What does the player do in the game that determines whether or not one of the hooks you are using will call the method it is controlling? In other words, what does the player do that triggers one of your hooks?
If the player clicks a powerup and has enough pets to buy it, they will be able to activate the “MakeNumberGoUp()” part of the powerup. There is also the IsFirstButtonPressed() method that is only really needed in the Autopets powerup that is used to determine the original number of automatic pets that is added when the button is first clicked.
6. What were the benefits of using the Template Method to make your game feature?
It helped having a set structure of how I wanted each of these powerups to work, and having a single method for all of them to activate through the unity buttons.
7. Did you find any drawbacks to using the Template Method Pattern? If so, what were they?
There really weren’t any particular drawbacks to this pattern. If the game was more complicated, the pattern would only become more useful, and as it is it works fine. The only thing I noticed was that it was hard to have the individual buttons track the first time that they specifically were pushed, with the template method defaulting to the first out of all of them.
8. How is the goal of the game feature communicated to the player in your unity project?
The goal of the game feature is written on the first tutorial text on the screen, saying that the goal is to just watch the number go up.
9. How are the controls required to use the game feature you created communicated to the player in your unity project?
The game has a tutorial that explains both the powerups and the basic controls.
10. How does the game communicate to the players whether or not they have successfully used the game feature?
There isn’t particularly a wrong way to use this game feature, but positive feedback is reinforced when you buy a powerup and the numbers go up faster.