In 2017 I pre-ordered Echo Button with the hopes of witting my first "Gadgets Skill" during the holiday break. Little did I know that the SDK would not be available when they arrived, or even until months later. At that point, I deployed the Hello Buttons sample, but then the buttons sat on my desk, and later on the shelf gathering dust...until this project tempted me.
Since I write all my Alexa Skills in JavaScript and host on AWS Lambda, I took a look at the Gadget Skills Documentation and Color Changer sample. I was now ready to create my skill: Rochambeau Buttons, an Echo Buttons enabled version of rochambeau/roshambo (a.k.a Rock Paper Scissors).
The game mechanic was going to be simple, the button would flash between red, green, and blue and each player would select a color. Red would beat Green, Green would beat Blue, and Blue would beat Red. Players could play a single game or a best of three (or five or seven) match.
After I got the basics working, I started adding polish including Game Show Sounds from the Alexa Skills Kit Sound Library, and varied the speech responses for repeated ties to speed things up and keep the repetition down (see Code snippet).
During testing with my family, I realized that it was hard to remember who was Player 1 and who was Player 2. To make it clear who won, I wanted to flash the winner's button. However, I couldn't both add a button animation and also end the session / stop input handlers, so I relied on the 'timeout' event functionality. The time out and winning animation were both set for ~10 seconds. As a response to the timeout, Alexa would speak the "Goodbye" message and end the session (see Code snippet).
I put together a video demo to show a game in action:
Comments