This week’s work on my final project for the semester proved to be both terrifying and amazing all at once. Since I’m currently in post production on my first Virtual Reality film and looking at delving further into interactive storytelling next semester and possibly indefinitely, creating a final project that is an interactive narrative seemed the perfect decision. However, as I talked to some of my best resources to help point me in the right direction, I’ve realized that what I’m proposing is essentially building a simple version of artificial intelligence. AI?!!! Holy moly! This is so far beyond my coding skills.
BUT I have had a lifelong fascination with robots and AI. It’s an interest that I thought I’d never pursue as a writer and director, but all of these skills actually merge in interactive storytelling. To make a story more immersive, the coding needs to bring characters to life that can interact with the audience. Essentially artificial intelligence may be required to make the best stories of the future. SO I’ve decided to push ahead and take a crack at this.
THE PREMISE
SETI, the search for extraterrestrial intelligence, finally succeeds. By beaming out a signal through an array of radio telescopes, they receive word back. But instead of hearing from a planet 22 light years away, we hear from an alien who was forced to come out of a wormhole early and is broken down near Saturn. This is why you can have a chat with him while he fixes his space craft. But what is he doing here?
He was traveling the galactic spice trade. On his planet, exotic cuisine is the most sought after thing. They have millions more tastebuds then we do and their highest sense of pleasure comes from food. He travels through worm holes throughout the universe collecting specimens to make the most exotic dishes. The alien is only in our galaxy because something happened to his ship and he had to come out of a wormhole early. Basically, we’re a flyover galaxy. He thinks if we were smarter, we might be dangerous, but as is we offer very little to the rest of the universe… And our plants and spices are not all that interesting, but he’s happy to chat while he works on his ship.
Then you get to ask him questions. To keep this limited to a short interaction, after three questions, a set story point kicks in. It’s a plot point that is set up in his opening and gives a little ending to the encounter. It will give the interaction a mini three act structure and allows me to not build an entire chatbot. That said, thanks to many smarter people than me, I have begun to research the world of AI and chatbots.
The fabulous Elena Parker of CampfireNYC really put me in the right direction for my research. Thanks to Elena, I’ve been looking at everything from Eliza, the Rogerian Therapist to the famous cleverbot. There are actually quite a few really interesting projects in this field. From an interview with Eugene Goostman, the fake kid who passed the Turing test to Talking Angela the talking cat app, the work is really incredible. Talking Angela’s creator, Bruce Wilcox, gave an insightful interview about how he creates bots that consistently win the Loebner award. Elena also recommended the book, The Most Human Human by Brian Chris. It’s supposed to be delivered from Amazon today so I’m pretty excited!
Through this research I’m looking at three different strategies. One option is markov chains to generate responses based on a huge database (this would be very hard for me to write in a few weeks). This example is used in the cleverbot who I believe adds all of our responses to its database. I think the options are now over 50M and counting. It also is the strategy behind the teenage chatbot built by Patrick Hogan using chat logs from his teenage years. The second strategy is key words routing the user through a branching script. And the third is a call and response where you incorporate the users input a lot into the responses. The third one sounds intriguing, but not something I think I want to use on this project. BUT the second option is the way I was thinking of approaching it from its first inception. Instead of thinking of the story as a branching script because I want to keep the interaction short, I imagined it as a keyword search. I need to change your voice into Java Script text and search it for key words. Then it’s essentially one huge if/else statement to choose which mp3 to play.
THE CODE
I had researched the speech to text coding API options and had written the code out logically in English – basically I scripted how I thought the program would work, but not in actual Java Script yet. Then I sat down with Lauren McCarthy, our fearless leader and a far smarter coder than I am. She told me I was on the right track with my logic and introduced me to a piece of coding that made me very happy. Before this point I had read and looked at the options, but I didn’t know there was this already written brilliant function that would make the speech to text part happen much more easily than expected. This will only work in the chrome browser, but it does work so that makes it my favorite piece of code yet!
var i = 0;
var recognition;
function setup() {
recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.onresult = handleSpeech;
}
function draw() {
}
function handleSpeech(event) {
print(event.results);
var res = event.results[i][0].transcript;
print(res);
// logic here to search for keywords and responds
i++;
}
function mousePressed() {
print(“starting recognition”);
recognition.start();
}
And if the coding doesn’t seem intimidating enough, filling out those if/else statements is based on both my creativity and ability to predict what people will ask the character. Benedetta Piantella really helped in this category. She made me think to top load the story to direct the questioning and think of the language gap to help with questions that might come up with no answer that will fit. It turns out that Benedetta was so right because part of what helped the AI beat the Turing test was the language barrier. He was supposed to be a teenager from the Ukraine and the theoretical language gap is what helped him pass for human. I think this alien is pretty condescending to us so my first thought as an answer for questions he doesn’t know is something like, “You didn’t really just ask me that?” He basically just puts us in our place so he stays in character, but doesn’t answer anything. I’m also not 100% sure how to work in more potential responses based on the language gap, but it is definitely something I’m going to consider.
BUT I still need to write as many answers as possible and to write the answers, I need to predict the questions! So I sent out a google form to the ITP email list. It asked what people would want to ask an alien and gave the option to give multiple answers. So far I’ve gotten at least 20 people’ responses, many of them were composed of numerous questions so it’s at least a start. The character’s personality is also slowly becoming clearer to me which is a major help in this area, but there is still a ton of work to be done on him before I can script all the answers.
Over the next week, I’m hoping to get the program up and running to at least be able to search for certain key words and play an mp3 in response – even if it’s not the final mp3s. And developing his character and responses is very time consuming so I will slowly be chipping away at that. I also find myself spending a lot of time considering the logic of how AI works and what makes him the strongest character possible. The more personality and details I give him, the more interesting the experience will be. I am a little worried about how hard this will be, but I’m also very excited about the research and learning a ton as I build/create my as-of-yet unnamed alien!