Developers are already creating interactive gaming experiences for Echo Buttons. One popular Amazon game skill, Don’t Cut That Wire, is a pattern-matching game where Alexa shows the customer a sequence of colors on two or more Echo Buttons. The customer diffuses a “bomb” by pressing the buttons in the same order. In this skill teardown, we uncover what makes this skill engaging for Alexa players and share tips that you can apply to your own Echo Buttons skill. We realize that real-world examples can be worth 1,000 pages of documentation.
Built by a team of experienced Amazon game developers, Don’t Cut That Wire was developed in parallel with many of the services that power the Gadgets Skill API. In order to build a compelling game skill, we recommend spending time to design the experience of your game. Most game skills are composed of concepts that you’ll hear repeated throughout our documentation like roll call, Input Handlers, and light animations. The Don’t Cut That Wire teardown provides JSON examples that detail best practices around these concepts as implemented by developers who have been building Echo Buttons skills longer than anyone. You can find the details in the teardown, but here’s a quick overview.
Implementing Roll Call to Personalize Game Play
Roll call associates players with buttons and is critical to the overall gaming experience. Don’t Cut That Wire uses a duration-based approach to roll call and confirms with voice, after the Input Handler times out, the number of buttons it detected. Here we share more details about roll call in Don’t Cut That Wire.
Without roll call, the game experience will be generic and Alexa will not be able to address players by character name, or even player number (i.e., “Player number one, what’s your answer?”) These unique voice responses are critical to a voice-first experience, and the driving factor behind why Amazon requires some form of roll call in all published skills that require Echo Buttons.
Echo Buttons skills typically complete roll call using either a timeout duration or expected button count. Either approach is valid, but you may find that one approach ties into your game experience better than another. In a duration-based roll call, anyone who presses a button within a specified time window is added to the game in the order in which their presses are received by the Game Engine. Roll call completes when either the maximum number of buttons is detected, or the timer runs out.
The player count experience takes a more guided approach by prompting the players, “How many are playing?” or “How many buttons do you have?” When one of the players responds “four,” the skill then sets up an Input Handler to expect four unique button presses. The roll call does not succeed unless four unique buttons are detected. It’s really up to you to decide on which experience you prefer. Our Echo Buttons games represent both options. For an example of how to implement an expected button count roll call, check out our Color Changer sample skill on GitHub.
Kicking Off a Game Round
Game rounds can vary greatly from game to game. Don’t Cut That Wire rounds start simple and grow in both length and complexity. The skill starts each round by sending GadgetController.SetLight directives to buttons to create a light pattern across all buttons. A GameEngine.StartInputHandler directive is used with the timeout duration matched to notify the skill when the animation is complete.
The player is expected to remember this pattern, and then press the buttons in the same order once prompted. In order to capture this input, an Input Handler that informs the skill each time a button is pressed is created for each step of the player’s response input. You can see this in action in the Beginning of a Round section of the teardown.
Whether you want to create a first-to-buzz-in trivia game experience or a complex set of button inputs like Don’t Cut That Wire, remember that GameEngine.StartInputHandler directives are required in order to capture any button input.
Bringing the Game to Life With Light Animations
The full color RGBs in Echo Buttons can bring life to any game or create the game itself, as in Button Monte. Don’t Cut That Wire sends multiple GadgetController.SetLight directives at the beginning of each round to direct a unique animation sequence to each button. You’ll find details on light animations in the teardown section called Pattern Display.
Even if your game does not require light sequences like Don’t Cut That Wire, light animations can greatly improve any game-skill experience. To get you started, check out the pulsating color animation used in Don’t Cut That Wire under Blue-Magenta-Red-Black Animation.
Get the Full Skill Teardown
Along with the JSON requests and responses, the skill teardown for Don’t Cut That Wire provides commentary on other noteworthy aspects of the skill. For example, how do you display a sequence of colors across multiple Echo Buttons? Where does the originatingRequestId for an Input Handler come from? Why might you use session attributes? Check out the full skill teardown to learn more. You can also play Don’t Cut That Wire to get the full experience.
More Resources to Build Echo Buttons Skills
You can write the next hit game for Echo Buttons! Check out our other Echo Buttons resources, including the Trivia Template, Hello Buttons, and Color Changer sample code in GitHub, or the recently released Game Show blueprint.
Source: Alexa Developer Blog