Interactive Adventure Game Tool
This tool provides an easy to use front-end that allows developers to instantly deploy code for your story, or use the generated code as a starting point for more complex projects. It was written in Node.js by Thomas Yuill, a designer and engineer in the Amazon Advertising team.
How to Get Started
Setup AWS and the Amazon Developer Console
To get started with the included sample project, you'll need to setup a few pre-requisites:
- The tool generates Node.js code that will be deployed to AWS Lambda to handle requests from users passed to you from the Alexa platform.
- The skill uses a table in AWS DynamoDB to save the user's progress between sessions.
- You can then register your skill with Alexa using the Amazon Developer website, linking it to your AWS resources.
Set these up with these step-by-step instructions:
Create or login to an AWS account. In the AWS Console:
Switch to the "N. Virginia" region, since Alexa Skills are currently only supported in that region.
Create an AWS Role in IAM with access to Lambda, CloudWatch Logs and DynamoDB.
Create an AWS Lambda function named MyAlexaSkillLambdaFunction being sure to select "Alexa Skills Kit" as the trigger and using the role created above. Take note of the ARN on the upper right, which you'll configure in the Developer Console later.
Create an AWS DynamoDB table named MyAlexaSkillTable with the case sensitive primary key "userId".
Create or login to an Amazon Developer account. In the Developer Console:
Create an Alexa Skill named MySkill and using the invocation name "my skill" and using the ARN you noted above.
Set up Your Machine
Next, you'll setup your local environment to run the tool. It's run using Node.js and you access it with a standard web browser. On OS X:
Configure AWS credentials the tool will use to upload code to your Skill. You do this by creating a file under a ".aws" directory in your home directory.
mkdir ~/.aws/ touch ~/.aws/credentials
The file should have the format, and include keys you retrieve from the AWS console:
[default] aws_access_key_id = [KEY FROM AWS] aws_secret_access_key = [SECRET KEY FROM AWS]
Setup NodeJS and NPM:
brew install node
Get the code and install dependencies:
git clone https://github.com/alexa/interactive-adventure-game-tool.git npm install
Using the Tool
Once the tool opens in a browser window, you'll see that a sample project is pre-loaded that shows off the main features of the tool.
On the left, you'll see a tree of nodes, which represents how users will navigate your skill. Users start at the big blue "Start" node.
The smaller bubbles above each node represents the utterance, a phrase the user will say to reach that node, and Alexa will read these to the user when they reach the parent node unless you override this using "Override Default Prompt" or if the node is hidden (see below).
In the sample skill, an example interaction with Alexa might be:
User: Alexa, launch My Alexa Skill. Alexa: Welcome to my Alexa Skill. To learn how to use this skill, say "Help". When you are ready, say "Begin". User: Begin Alexa: You enter a room with three doors, each with a distinct number on it. Which door would you like to open?
If you select a node, you can see the Voice and Card elements on the right that Alexa will send/say to the user upon reaching the node.
Under the "Advanced" options, you can change the color of the node to help you organize (colors don't change the behavior of your skill) and you can "hide" nodes, causing Alexa to skip reading their utterance as part of the default prompt of the parent.
If you click on an utterance, you can enter multiple variations of the phrase that will also be accepted by Alexa. Only the first one will be read to the user in the default prompt.
Lastly, the icons on the upper right allow you to:
- Save the Skill code, which will be output to "./src/skill".
- Upload the Skill code to the Lambda function you configured earlier. You can configure the function name by clicking the home icon and changing the values under "AWS Settings".
- See help content for the tool.
Finishing Deployment of Your Skill
Click the "Save" icon (if you haven't already), and the "Upload" icon to send the Skill code up to Lambda. When you save the Skill, the tool generates some additional configuration inside "./src/skill/models/" that you'll use to tell Alexa how users will interact with you Skill.
You'll need to complete the configuration manually by logging into the Developer Console and accessing the "My Alexa Skill" you created above. On the "Interaction Model" tab, copy and paste the Intent Schema from "./src/skill/models/intentSchema.json" and Sample Utterances from "./src/skill/models/utterances.txt".
Click save, and the Skill should now be available on your developer account. If your Alexa device is associated with the same Amazon account as your Developer Console account, then you can start using the skill immediately. Or you can use it on the online simulator by logging in using the same account.
Congrats! Enjoy and let your imagination run wild, we can't wait to see what you come up with!