So you wanna be the master - of Pokémon; do you have the Skills to be number one!? We all live in a Pokémon world - but some of us are mere Trainers, while others prove themselves as Masters! I wanted to celebrate the 20th anniversary of the release of Pokémon Red/Blue/Yellow in the US with a trivia quiz, utilizing Echo Buttons to allow players - or rather, Trainers - to buzz in with the correct answer and prove themselves as PokémonMasters! 😤🏆
Originally I'd hoped to use the PokéAPI to provide data for the quiz - but I soon realized that asking "what grass type uses overgrow" might be a little ambiguous, not to mention out of reach to all but the most hard-core trainer. So I eventually stumbled on a Nintendo quiz which I recreated as a VUI! 🗣️🎙️
I used Amazon's detailed example, which I discovered via an Alexa blog post, to walk through the myriad steps of skill creation. You can review the process in detail on the source repo, but here's my express version if you'd like to get started ASAP:
First, I forked the example repo since I knew I'd be customizing it eventually. I then cloned it locally and switched to that directory in preparation for the upcoming processing steps.
git clone firstname.lastname@example.org:<YOUR_USERNAME_HERE>/skill-sample-nodejs-buttons-trivia.git cd skill-sample-nodejs-buttons-trivia
Next I logged into AWS (create a free account if you don't already have one) and created a new skill(Custom). Next I replaced the boilerplate JSON provided in the Interaction Model with the provided example code via the JSON Editor(I can't link to these directly since the URLs would be to my specific Skill). I then updated the Skill Invocation Name to
two be a master - that's not a typo -
to is a "connecting word" and would cause rejection during certification later, it turns out! 🙄
The next step is to enable Display Interface, Gadget Controller, and Game Engine under Interfaces then Save and Build the Model.
Now, switch back to the local repo we cloned earlier to install dependencies, then create a
zip file of the custom Lambda code:
cd lambda/custom npm install sudo apt update sudo apt install zip zip -r ../buttons-trivia.zip .
Next, create an AWS Lambda function to house that code - you'll want to choose From Scratch and
8.10. Select Create a custom role for Role and then choose
lambda_basic_execution and Create a new Role Policy.
Woo! We're at the halfway point, doing great so far. We? What's all this "we" stuff? I'm doing all the hard work! Breaktime's over, here we go! 😜
Now that you've created a Lambda function, you need to add Alexa Skills Kit under Triggers in order to allow your Skill to access it, plus DisableSkill ID Verification. We're not quite done yet though - remember that
zip file from earlier? Well, we need to shove the code that contains into our Lambda - so set Code entry type to
.zip and upload
skill-sample-nodejs-buttons-trivia/lambda/buttons-trivia.zip, then hit Save. Upon doing so, you'll see an Amazon Resource Name (ARN) generated for your function - note this value for use in the last step.
We're almost home; our game stores session data in DynamoDB, so we need to set up DB access: simply attach the
AmazonDynamoDBFullAccess policy to the
lambda_basic_execution role that we created earlier and we're all set to save game data!
One very last step: connecting the VUI to the Lambda function! Under Endpoint on the left nav for our skill, set the Service Endpoint Type to AWS Lambda ARN and Default Region to the ARN for your Lambda function. Hit SaveEndpoints, and that's it - we're done! 🚀
We can play our game without requiring access to a real Echo or Echo Buttons using the Alexa Simulator. First, enable testing by navigating to the Test pane for our skill, then enabling Test is enabled for this skill. The Test pane will now become a home for the Alexa Simulator, which uses your PC's mic and speakers to simulate Echo functionality, and on-screen buttons to allow the simulation of Echo Buttons. Play a round of the example game to make sure everything's working - then it's time to customize! ✨
OK, that's more than enough GettingStarted - on to the fun stuff! Back in the local repo, locate
lambda/custom/config/questions.js and replace
questions_en_US with your own questions and answers (or mine!). Thankfully US and UK(proper!)English are pretty similar, so I duplicated the US batch verbatim as
questions_en_GB in order to support UK PokémonMasters using the same Skill. Duplicating them verbatim for German users, however, would be verboten, so I manually copy and pasted each Q&A into Google Translate in order to support our German Pokémon-Meister! 🇩🇪
In addition to the questions, there are some other files that can be customized; in
lambda/custom/config/messages.js I updated
GAME_TITLE from the default, and again set
GAME_TITLE_GERMAN with the help of Google Translate. As a fun bonus, I replaced all the times that the VUI originally mentioned player with trainer for a little extra Pokémon flair. Verging on compulsive, I also updated
QUESTION_COLOR from purple to yellow so that all button states corresponded to versions of the original Game Boy release of Pokémon. 🤓
This code is all still just local, don't forget, so you have to repeat the Lambda function code upload process; first, locally:
cd lambda/custom rm ../2ba-master.zip zip -r ../2ba-master.zip .
Then, in your existing Lambda function (same settings as before:
index.handler, and Code entry type
.zip) upload your new
skill-sample-nodejs-buttons-trivia/lambda/2ba-master.zip, and save. 💾
You also need to update your Interaction Models to reflect the customizations you made to your game. The easiest way to do this is to edit
models/de-DE.json in your local repo and again use the JSON Editor to paste each over the original (use Language Settings to add more languages if not already present), as with the initial setup. In my case this was mostly updating
answers to those contained in my
questions.js (without this, Alexa won't stand much chance of matching user utterances to the prescribed answer strings), as well as the places I renamed
trainer, and the Skill Invocation Name (
two be a master).
After the changes, it's necessary to hit Built Model so that they are applied - and then you can head back over to the Alexa Simulator to play test your new, customized game! 🍾
Feeling good about your new game? Why not submit it to the Skill Store for everyone to enjoy!? It's actually quite easy compared to other app stores - just visit the Distribution tab and fill out an easy form, then submit for Certification! (more detailed steps can be found in the official guide)
Exploring the Gadgets Skill API (i.e. Echo Buttons) was a fun way to get back into Alexa Skill development (check out my other, award-winning skill Numberwang!). Adding a tactile element to the traditional VUI really opens up the possibilities to competitive games and all kinds of other interactivity! I'm looking forward to getting my hands on some physical Echo Buttons to see what other ideas I can come up with for novel interaction! 🆕👉
My original concept was to use an external API to provide a wealth of question fodder - I would still really like to somehow incorporate external data to provide a greater range of trivia. I also wanted to experiment with the
AUDIO settings to provide custom Pokémon sounds as part of the quiz, but I wasn't sure about copyright etc. so I thought it best to submit without for now. Lastly, I really wanted to incorporate the Pokérap somehow - hearing Alexa "shake out those lips" and enumerate 150 Pokémon would be really funny to hear, I just couldn't think of a way to incorporate it into the game in a way that wouldn't drive players insane! 💡🤯