Chatbots in Unity with AIML

Chatbot AIs are conversational programs that respond to typed text input and you can put chatbot AIs into Unity games and experiences to play the role of characters with more than the usual menu-based dialogue choices.

AIML: Artificial Intelligence Markup Language

AIML is an open-source standard for writing conversational chatbot dialogue.

AIML (Artificial Intelligence Markup Language) is an XML-compliant language that’s easy to learn, and makes it possible for you to begin customizing an Alicebot or creating one from scratch within minutes.

The most important units of AIML are:

  • <aiml>: the tag that begins and ends an AIML document
  • <category>: the tag that marks a “unit of knowledge” in an Alicebot’s knowledge base
  • <pattern>: used to contain a simple pattern that matches what a user may say or type to an Alicebot
  • <template>: contains the response to a user input

There are also 20 or so additional more tags often found in AIML files, and it’s possible to create your own so-called “custom predicates”. Right now, a beginner’s guide to AIML can be found in the AIML Primer.

The free A.L.I.C.E. AIML includes a knowledge base of approximately 41,000 categories. Here’s an example of one of them:

<category>
<pattern>WHAT ARE YOU</pattern>
<template>
<think><set name=”topic”>Me</set></think>
I am the latest result in artificial intelligence,
which can reproduce the capabilities of the human brain
with greater speed and accuracy.
</template>
</category>

(The opening and closing <aiml> tags are not shown here, because this is an excerpt from the middle of a document.)

Everything between <category> and </category> is — you guessed it — a category. A category can have one pattern and one template. (It can also contain a <that> tag, but we won’t get into that here.)

The pattern shown will match only the exact phrase “what are you” (capitalization is ignored).

But it’s possible that this category may be invoked by another category, using the <srai> tag (not shown) and the principle of reductionism.

In any case, if this category is called, it will produce the response “I am the latest result in artificial intelligence…” shown above. In addition, it will do something else interesting. Using the <think> tag, which causes Alicebot to perform whatever it contains but hide the result from the user, the Alicebot engine will set the “topic” in its memory to “Me”. This allows any categories elsewhere with an explicit “topic” value of “ME” to match better than categories with the same patterns that are not given an explicit topic. This illustrates one mechanism whereby a botmaster can exercise precise control over a conversational flow.

Gaitobot AIML Editor

Gaitobot is a free AIML editor that helps you write your AIML files and simulate your chatbot to test it.

Gaitobot helps you manage multiple brain files and drag and drop patterns between them.

Program# AIML Bot Free

AIMLBot (Program#) is a small, fast, standards-compliant yet easily customizable implementation of an AIML (Artificial Intelligence Markup Language) based chatter bot in C#. AIMLBot has been tested on both Microsoft’s runtime environment and Mono. Put simply, it will allow you to chat (by entering text) with your computer using natural language.

This is the second version of the library and it has been re-written from scratch. It now boasts:

  • Better cross-platform compatibility. Support for .NET 1.1, 2.0 and XNA as well as the open source Mono project (tested under version 1.1). Testing on Windows Vista with version 3.0 of the .NET platform is pending.
  • A completely new modular architecture to make it easier for developers to extend and add functionality.
  • A simpler and more logical API.
  • Standards compliant AIML support with the option for custom tags.
  • Very small size (currently only 56k).
  • Very fast (over 30,000 categories processed in under a second).
  • Inclusion of a comprehensive test suite including over 200 unit tests (based upon nUnit).
  • A means of saving the bot’s “brain” as a binary file (Graphmaster.dat).
  • Some simple code snippets and examples for developers to get started (simple windows and console based applications as well as a sample custom tags library).
  • Appropriately commented code.
  • Comprehensive documentation.

Using Program# with Unity

Program# isn’t Unity-specific so you’ll have to do some setup of its config files and DLL and a C# script to talk to it.

  • AIMLBot for Unity on Github has some of the work done for you.
  • Chatbot for Unity is a completely supported and Unity scripting integrated version with added Jurassic Javascript scripting in the AIML itself, check out Chatbot for Unity.

Chatbot for Unity $22

Asset to parse AIML 1.0.1 files in Unity. Webplayer basic example can be found here. This is used to make a chatbot. You can write your own AIML “brain” and let your characters speak and interact with your scripts.
This is possible due to Jurassic, a fully integrated javascript runtime compiler. You can write your javascript into the AIML files and preprocess your AIML code through the javascript function main(){return””;} before the bot answers. Exception handling in Unity console, pass and get global variables, do regular java script commands while processing AIML files. Now Chatbot framework is introduced, bridging the gap between Program #, Jurassic and implementation in your game. Advanced Example added and will be improved continous in next updates, as there are thousends of categorys to rewrite. The possibilitys are infinite.

Current supported platforms: PC, Mac & Linux standalone, Webplayer, WebGL for Unity 5.2.0f3 upwards, Android and IOS. Now full support for basic and advanced example on all named plattforms. More example scenes will be added in next updates.
Supports Unity 4.0.0 – 5.x

Visit www.chatbotunityasset.com for more information.
Visit the roadmap for further development.

Games made with chatbots

Event 0

Event 0 is the first computer game based entirely around conversations with an AI computer driven by a chatbot.

In their MadeWithUnity article they’ve talked extensively about how they designed the chatbot’s dialogue system.

How Event 0 Works

Some reviewers have taken time to try to explain how Event 0’s chatbot works:

The Talos Principle

Talos Principle has you the player acting as a robot and you learn about chatbots and interact with an AI called Milton. Buy it on Steam!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s