Building a Game: Voice Clues
This lesson will get us started on the next project we are going to build.
In this lesson, we will set the stage for the next project we’ll build in this course. Let’s get started!
Project objective
The goal of the project is to build a fun game called Voice Clues. In Voice Clues, the user is presented with three clues related to a capital city from around the world. Using the three clues, the user needs to guess which city it is. For example, a user may be presented with these clues: "United Kingdom. Buckingham Palace. Tea.” The user needs to guess the capital, which is London. If the user gets the answer right, they get a point. If the user gets the answer wrong, the game ends. In the end, we tell them their score and ask if they would like to play the game again.
Writing a script
Let’s try to write a VUI script to represent the interaction between Alexa and the users.
Launching the Skill
User: “Open voice clues.”
Alexa: “Welcome to Voice Clues. You will be presented with three clues. You need to match the clues to a capital city. Are you ready to start the game?”
User: “Yes.”
Playing the game: getting the answer right
Alexa: “Here are your clues: India, Red Fort, street food.”
User: “New Delhi.”
Alexa: “Correct! Time for the next question. Here are the clues. United Kingdom, Buckingham Palace, tea.”
The user guesses it right and the game continues.
Handling synonyms
A user may answer with “Delhi” instead of “New Delhi” in the previous example. As a Skill developer, we should handle such situations gracefully. We will explore how to handle synonyms as a part of this project.
Getting the answer wrong
Now, let’s consider what would happen if the user guesses wrong.
User: “Mumbai.”
Alexa: “Sorry, that is not correct. You got one answer correct. Would you like to restart the game?”
If the user guesses wrong, the game ends, we tell them their points, and ask if they would like to restart the game.
More design considerations
We also need to make sure we handle cases where users ask for help and edge cases. Try to think of some more cases that can arise.
As an exercise, try thinking of what the interaction model is going to look like. What are the intents, utterances, and slots?
Summary of features we will be building
- Give clues to the user and let them guess which city is being referred to by the clues.
- Manage the user’s scores.
- Inform the user about the score at the end of the game.
- Handle synonyms and edge cases in the code.
Get hands-on with 1400+ tech skills courses.