This is an Alexa game involving space combat using some simple card game mechanics.
It is build using the Serverless Framework to deploy and Amazon Alexa for the platform.
Go through the first few steps of setting up an Alexa skill:
Under "Alexa Skills Kit", click "Get Started" and then "Add a New Skill"
On the Skill Information page, under "Global Fields" be sure to leave "Audio Player" set to No, and click Save.
Copy the Application Id that is now listed on this page to a temporary place, you'll need it.
Run node speechAssets/generateCardCustomSlotType.js
from your base directory to generate a file needed in the next step.
On the Interaction Model page, use the contents of speechAssets/intents.json
for the Intent Schema section. Then add a custom slot type called CARD
and use the contents of your newly generated speechAssets/CardCustomSlotType.txt
for the values. Lastly, use speechAssets/utterances.txt
for the Sample Utterances. Click Next.
On the Configuration page, for Service Endpoint Type, you want to select AWS Lambda ARN and pick your geography. Then fill the text box with the ARN that serverless deploy -v
printed earlier. If you missed it, you can always run serverless info -v
to get it again (It's the SensorsAreDownLambdaFunctionQualifiedArn
). Note that you will need to exclude the version at the very end (:1
), the ARN should end with sensorsAreDown
.
Leave the default settings for Account Linking and Permissions and click Next.
Do not proceed beyond the test page. That is for actually publishing your skill. You have already gone far enough to test it on your device.
Create your config/local.yaml
file:
Make a copy of config/local-example.yaml
at config/local.yaml
. (local.yaml is in .gitignore).
Replace the appId in this file with the one you got from the Amazon Developer Console above. This will override the one in default.yaml when you deploy from your copy of the repo.
Install Serverless and Deploy to AWS!
npm install -g serverless
From the sensors-are-down root directory, run:
npm i
serverless deploy -v
This will create a role in your AWS Identity and Access Management (IAM) console and deploy a function for the skill on AWS Lambda. You will need to add some permissions to the IAM role:
Click the Roles tab and then click your sensors-are-down-alexa-skill-dev-...-lambdaRole
role.
Under Permissions -> Managed Policies, click the Attach Policy button.
Search for and select "AmazonDynamoDBFullAccess" and click Attach Policy.
On the Test page of the Amazon Developer Console, you can mess around a bit but it does not allow a dialogue, so you'll need to test on an actual Alexa device (or you can test on another Alexa Voice Service integration, such as the Ubi App for Android).
If your Amazon Developer account uses the same email address as the Amazon account your Alexa device is registered to, and the "Enabled" toggle on the skill's Test page is turned on, the skill should already be available on your device. You can find it on the Your Skills list of the Alexa app.
If you used a different email address for your Amazon Developer account, follow the steps to register your Alexa device with that account.
Choose attack -> Hear opponent's attack -> Choose defense
^ │
│ v
└── If game continues <- Hear result of all combat -> If victory or defeat,
hear end of game info
defense === true
and ship or planet === opponent's attack ship or planet and opponent cards in play on the ship or planet. If opponent cards in play and offensive choice cover both planet and ship, defense choices are always one planet defense option one ship defense option.