The Goal: Create a game mechanic or mini-game in under a week that involves the Command Design Pattern in the code's implementation.
1. Briefly, what was the game feature you chose to create?
The game feature I created allows the player to “paint” their cursor a certain color (red, blue, or green) and then change the color of different blocks/tiles on the left side of the screen to match a pattern on the right side.
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 use the painting ability to match the mirrored and flipped over pattern on the right hand side (the pattern is always relative to one unchangeable block.) To put this in the sentence format: “As a player, I want to match the pattern on the right so I can see the number of correctly painted tiles go up.”
3. What does the player do in the game that determines which Concrete Command is executed on a receiver?
When the player clicks on either the red, blue, or green buttons, a concrete command of ChangeCursorColor is executed on the CustomCursor using the ColorButton script. When the player clicks on any of the tiles on the left hand side of the screen, a concrete command of ChangeBlockColor is executed on the PatternBlock.
4. What determines which Receiver class receives the command? Does the player choose the Receiver somehow or does the game choose the Receiver? In other words, what sets the Receiver that the command is executed on?
The receiver that the command is executed on is preset by the game for ChangeCursorColor as the cursor is the only receiver that can be changed by that command. However, with the ChangeBlockColor command, the individual receiver is determined by which block the player clicks on, as only that block will change color.
5. What were the benefits of using the Command Pattern to make your game feature?
This was by far the simplest way I’ve tried to implement an undo feature, something that would’ve taken me much longer to implement if I made it from scratch without the design pattern.
6. Did you find any drawbacks to using the Command Pattern? If so, what were they?
Other than the Undo feature, this pattern seemed like it would overcomplicate things rather quickly in a game with many different commands. I had to change the example Execute() as I realized that all my commands needed a color value passed in, but if I needed a command for movement or some other feature that didn’t need color and I needed to make it a simple Execute() method that didn’t take in anything, I would need to make separate commands such as ChangeCursorColorBlue, ChangeCursorColorRed, which would at least double the amount of scripts.
7. How is the goal of the game feature communicated to the player in your unity project?
The goal of the game feature is clearly written above the randomized pattern, telling the player to match the pattern and that the pattern is relative to the yellow tile.
8. How are the controls required to use the game feature you created communicated to the player in your unity project?
The game feature has a controls button that the player can click to reveal the functions of the other clickable buttons.
9. How does the game communicate to the players whether or not they have successfully used the game feature?
The game has a “Correct tiles: X/15” meter on the top of the screen that keeps track of how many tiles the player has correctly painted.