The simplest possible snowman
One of many possible snowmen
This body type is a result of choosing a small bottom snowball but large middle and top snowballs!
I'm always trying to think of interesting skill ideas, so I'm always asking friends and family members what they would like to see brought to Alexa devices. My mother came up with the idea of building snowmen, and I combined the idea with an art style I practiced as a child and brought it to life!
For the implementation of the skill, I was inspired by adding to my small but growing repertoire of AWS experience. I really extrapolated on my AWS Educate free tier resources. More on that below!
What it does
Build a Snowman enables users to build a snowman with their voice! All you have to do is answer a few simple questions about the size of snowballs to be used, nose type, hat preference, etc. Even though the inputs allow 3,840 unique combinations, each and every one of them can be created and viewed. At the end of the session, you will be able to see your creation on your Echo Show or in the Alexa app. You will also be prompted to save your creation, after which you can name it to recall it later. Once you have created snowmen, you can simply ask Build a Snowman to load the name of one of your snowmen, or to load the last snowman you created.
How I built it
I created Build a Snowman using the Alexa Skills Kit and Amazon's Skill Builder. After following the basic setup procedures, I went on to simplify my mental model of how I want the skill to be driven. I decided on a very straightforward approach with multiple states that change each step along the way. Instead of having the user be able to bounce around between stages, I decided that users would get the most out of the skill if they were prompted each time. So I divided the possible intents into various states with substates within some of them. For example, I had intents that are triggered by 'yes' or 'no' share a state but also have varying substates. For example, one yes/no substate is happens when you answer whether or not you want the snowman to have a scarf, and another such substate exists for when you answer whether or not the snowman should have buttons.
Of course, another major part of creating this skill was making all 3,840 snowmen. I started in GIMP by drawing the eight possible body shapes. Each ball has two options, so 2*2*2 = 8. Just think about how quickly that adds up once you add several hat and color options, and everything else... After the body shapes, I devised a fairly simple strategy of keeping track of which snowman is which. Basically, I used a numbering system inspired by the binary system (some options yield merely two options, 0 or 1, after all) to make sure I could recall any possible snowman based on its various criteria. So I would copy all the drawn snowmen, paste them, and add a new attribute, and then repeat the process until all combinations were represented. I then needed to cut up the file filled with the snowmen into individual images. After searching around the internet and trying different approaches, I settled with using YoYo Games GameMaker's sprite editing capability. It worked incredibly well, and quickly separated the files. To follow my organizational strategy which is at the very heart of this skill's functionality, I then wrote a python script to resize and rename all the images. An example file name is 'sm0-0-0-0-0-0-0-0-0.png'. This represents the simplest snowman, with no arms, hat, or scarf. Its favorite color (which would determine the hat and scarf color but also the background) is blue, and it has a pebble nose. All of that information is stored in that file name. Back to the skill code, each option builds a string using this code, so the final step is to display the image with the generated name. All images are stored in an AWS S3 bucket.
Challenges I ran into
The main challenges revolved around dealing with so many files. I tried out so many ways of resizing, renaming, and splitting image files. It was at times a very frustrating situation, but I refused to give in to the seeming impossibility. Even uploading the mere 7,680 image files to the S3 bucket (both small and large images were required for use in displaying them across the various Alexa platforms) proved to be difficult. I dealt with slow network speeds, and occasionally the page would timeout. Devising the filename code was a challenge at first for me too, since visualizing its implications took a bit of getting used to. Even after I cemented it, I still went back and forth in my head and doubted its usability. It all came together though!
Accomplishments that I'm proud of
I am proud that I could take a seemingly simple idea, flesh out its difficulties, and push through it all to devise a way to make it all possible. I am most proud of the image file name code that I devised, but I am also thrilled to think about how this skill could entertain young people (and others, too)!
What I learned
I learned that the sky is the limit! Prior to this project, I never would have expected to store and access so many files through an Alexa skill. More importantly, I learned the value of naming conventions and organizational strategy. The efficiency of my solution would not have been possible without putting some time and thought into how the images will be stored and accessed accurately each time.
What's next for Build a Snowman
If users like this skill, I will definitely update the 3,840 snowman images with graphical tweaks and artistic improvements. I believe the current art style is sufficient to entertain customers, but I know I could take it further. I'd also look into building and serving the images programatically rather than by hosting each individual image.