Today, we're pleased to make a tool with source code available to allow you to graphically design interactive adventure games for Alexa. Interactive adventure games represent a new category of skill that allows customers to engage with stories using their voice. With these skills, you can showcase original content or build compelling companion experiences to existing books, movies and games. For example, in The Wayne Investigation skill (4.7 stars, 48 reviews), you’re transported to Gotham City a few days after the murder of Bruce Wayne’s parents. You play the part of a detective, investigating the crime and interrogating interesting characters, with Alexa guiding you through multiple virtual rooms, giving you choices, and helping you find important clues. The Magic Door, an original adventure series for Alexa, enables you to tell Alexa what choices to make as you navigate a forest, a garden or an ancient temple. Learn more about game skills on Alexa.
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. The tool is available now as a Github project: https://github.com/alexa/interactive-adventure-game-tool
If you want to get started quickly, you can use our Trivia or Decision Tree skill templates that make it easy for developers or non-developers to create game skills. These template makes it easy for developers or non-developers to create a skill similar to “European Vacation Recommender” or “Astronomy Trivia." The templates leverages AWS Lambda and the Alexa Skills Kit (ASK) while providing the business logic, use cases, error handling and help functions for your skill. You just need to come up with a decision tree-based idea or trivia game, plug in your questions and edit the sample provided (we walk you through how it’s done). It's a valuable way to quickly learn the end-to-end process for building and publishing an Alexa skill.
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.
You can change the name of these resources to whatever you like later, but for now, setup the following items:
- Create or login to an AWS account. In the AWS Console:
- Create an AWS role with full access to Lambda and DynamoDB.
- Create an AWS Lambda function named MyAlexaSkillLambdaFunction being sure to select/create a role with access to DynamoDB and configuring "Alexa Skills Kit" as the "Event Source". 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:
1. 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.
The file should have the format, and include keys you retrieve from the AWS console:
aws_access_key_id = [KEY FROM AWS]
aws_secret_access_key = [SECRET KEY FROM AWS]
2. Setup NodeJS and NPM:
brew install node
3. Get the code and install dependencies:
git clone [GITHUB URL HERE]
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".
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 that account.
Congrats! Enjoy and let your imagination run wild, we can't wait to see what you come up with!