Nessun risultato trovato
April 11, 2018Cami Williams
Editors' Note: The Gadgets Skill API is now the Echo Buttons Skill API. The interface names and underlying functionality are unchanged.
ast week we announced the Gadgets Skill API (beta) to build game skills for Alexa Gadgets, including Echo Buttons – the first product in a new category of connected products and developer tools. The Gadgets Skill API (beta) enables developers to create games, educational skills, and novelty experiences, all through voice.
If you haven’t had a chance to dig into our technical documentation, the Gadget Skill API (beta) is comprised of two interfaces, Game Engine and Gadget Controller. Think of a Game Engine as receiving and assigning events, and a Gadget Controller as sending commands back to Echo Buttons.
As an Alexa evangelist, I’ve had the opportunity to dive into the Gadgets Skill API (beta) and build Echo Button game skills for the past six months. Through my experimentation, I’ve built three games for single and multiple players, and found unique ways to incorporate Echo Buttons into my game play. My first game was called Virtual Pet, which used the Echo Buttons as the method to feed, pet, and play with my virtual furry friend. My second game had similar mechanics to Trivial Pursuit Tap, where players compete to be the first to buzz in to answer trivia questions. Interestingly, my third and favorite Echo Button skill was a bit outside of gaming. I assigned each Echo Button with a different musical sound from instruments like violins, pianos, and trumpets. When Echo Buttons are pressed, the audio clips play to offer a unique experience on my Echo device.
Through this diverse development process, I gathered several key learnings for Alexa game skill developers. Here are some best practices to jump-start your own interactive games for Echo Buttons using the Gadgets Skill API (beta).
As with every Alexa skill, the experience should remain voice-first. Whether you’re designing a skill for devices with screens, like Echo Show or Echo Spot, or devices with light animations, like Echo Buttons, voice needs to be the primary communication method with Alexa. Design your voice interaction first, and then think about how you can enhance the gameplay with visual components. Keep in mind that not all players will have screens, which is another reason to build your voice interaction model first.
With the introduction of Echo Buttons, these accessories enhance voice-only gameplay. With the press of a button or a captivating light animation, the gaming experience becomes even more engaging for Echo Button players. When designing your Echo Button game, you can choose to build a game that “works with” or “requires” the use of Echo Buttons. In both cases, you will define the minimum and maximum number of users, along with the number of Echo Buttons required to play your game skill.
When building an Echo Button game using the Gadgets Skill API (beta), you can find out which buttons the players want to use by prompting them to press each Echo Button that they will be using for the game. You can start an InputHandler using the Game Engine to record these gadget IDs and send them to your skill so you can keep track of each Echo Button during the game.
Behind the scenes, the Game Engine InputHandler you define sends an event to your skill with the gadget IDs for each Echo Button pressed. Your skill can then keep track of players, map distinct functions, and append color animations to specific Echo Buttons. As your game progresses, you can filter button presses and map them to named events or intents within your skill. An important note is that Echo Buttons go to sleep after 10 minutes of inactivity to preserve battery life. Asking your players to press their Echo Buttons as they start your skill ensures that the Echo Buttons are “awake” and ready to be used.
An Echo Button event is triggered via a button performance defined by a recognizer. You can specify multiple recognizers, like “timed out,” “match,” “deviation,” and “progress.” The one you will probably use the most is “match,” which allows you to specify actions that a button could perform, like being pushed down and/or up, to trigger the event. These recognizers are utilized within the Game Engine where, after the action specified by the recognizer is performed, the assigned functionality is then invoked and your skill can return a SetLight directive using the Gadget Controller to display an updated color or animation sequence on the buttons.
At a minimum, it is important to keep track of either a button “down” or “up” event. This will be necessary for recognizing buttons when your skill starts and interacting with them later. Along with that, it is good to have a “timeout” recognizer so your skill doesn’t keep your players waiting for too long.
Voice has always been in the game. What they do next is up to you. This is an exciting time to build voice-first games for Alexa. And with the introduction of the Gadgets Skill API (beta) and building for Echo Buttons, I can’t wait to see the exciting gaming experiences that our growing community of talented Alexa developers will build next.
Now it’s your turn to get started! Check out these resources to start building your first Echo Button game skill: