AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Working on chatbots in games
 
 

I’ve been researching options for chatbot technology to work with. I’m pretty close to deciding that RiveScript is my best option but I would appreciate feedback in case I’ve missed something important. I want a chatbot with finite state machine or goal-driven features that I can build into a game to control character interaction. The closest thing I’ve found is CleverScript but their licensing is out of my current price range. However, I’m okay building that functionality myself and using RiveScript for the chat input and output features. And yes, I expect this to be a multi-year project.

I’ve been working in Unity3D which uses JavaScript as one of its scripting languages, and although I’ve mostly used C# with Unity myself, I’ve worked with JS occasionally as well. Since RiveScript works with JS this looks like a good fit to me. Also I like the MIT license since I’d like to maybe make some money from my hobby some day and might not want to give the tech away for free right away—though I admire and am grateful for Noah’s generosity in that regard!

If someone has alternatives to RiveScript to suggest, in addition to working in JavaScript and C#, I have a Pro license for Unity so I do have the option of building a C++ or other native code plugin as long as I don’t plan on publishing the game as a web build. For example, I’ve thought about Lisp for that purpose since a lot of AI stuff is built in it. I’d like to try to hang onto the option of using web builds since it gives more freedom to share what I’m working on and get feedback, but using offline builds is definitely an option.

 

 
  [ # 1 ]

I should probably say that database access is vital to me as well. Using RiveScript and handling the database access myself seems like a good option since I’ll be able to make it work however I want. But if there are technologies I haven’t found that might be a better fit for my needs, I would appreciate feedback.

 

 
  [ # 2 ]

Hi Jeff and welcome!

I have been working on an alternate Engine that I would say sits between RiveScript and ChatScript, it is MIT and under active development, written in Node.js and dialogue is stored in Mongo not flat files.

SuperScriptJS.com

I would love your feedback.

Rob

 

 
  [ # 3 ]

Sounds interesting. Good luck! Will be cool to see RiveScript used in some new and interesting ways. wink

 

 
  [ # 4 ]

Chatscript has been compiled to run in unity3d, and it directly supports postgres db, and has been used in several games. It also fits in android and ios.

 

 
  [ # 5 ]

Well, that presents a more complicated picture than I had 24 hours ago. I appreciate the new information. It now looks like a choice between ChatScript and RiveScript. I’ll do some more research and then probably download them both and try some stuff.

@Bruce: I definitely like ChatScript’s syntax and can’t remember why I didn’t think it would work for me, so I’ll have to take another look at it. It was probably because it was one of the first I had considered thanks to Dave’s introductory/tutorial post on chatbots and I was probably looking for something in JS or C# and hadn’t gotten to the point of considering a compiled plugin. I had done searches on various technologies and Unity but for whatever reason hadn’t tried that combination as I’ve already found results now that I do it. Following in others’ footsteps is a good thing. The prospect of perhaps even a budding community that might be forming around chat in games seems almost too much to hope for as I’ve only found one other game developer so far who was into this subject so far. I’ll definitely be digging into this more.

@Rob: SuperScriptJS looks like a powerful tool with a lot of long term potential. My gut feeling is that starting out with a simpler option with a more established community to turn to for examples and possibly assistance is more likely to get me useful results for my first project though. Also, I had planned to use a relational database as both the game database and to encode a sizable amount of the characters’ knowledge about the broader world through the database structure so that once keywords were identified the bots could use queries on the database to answer player questions. Since that is outside the scope of RiveScript, I’d be building it myself but I’m okay with that. I’m not as familiar with how to do similar things in Mongo so I’m not sure how well it would fit what I had planned to do.

@Noah: Thank you! smile

 

 
  [ # 6 ]

Hey Jeff - would a Unity3d ChatScript plugin be something you would be interested in?  I had considered bundling up my CS->Unity work and submitting it to the asset store but never pursued that.  I actually have a java framework that lets me run AIML, ChatScript, etc bots all together and talk in chat rooms to each other.  Been thinking of moving that to C# and getting it running in Unity.  The java multi bot thing was actually a first iteration of creating a more generic platform than say pandora bot that would support many different types of bots (AIML, CS, RS, etc), ran on amazon EC2 for scaling/billing.  One of the barriers to entry for CS right now is probably the lack of a pandorabots like platform for the casual user IMO.

Figuring out how to monetize it so it’s worth my time is the current blocker for both of these ideas. The proof of concepts works out fine.

RE a community around NLP style chat in games, let me know if you find any.  smile

 

 
  [ # 7 ]

No worries Jeff, and I completely agree using something that well supported is a good idea, I also believe in using the right tool for the job.

I should have been a little more clear. SuperScript persists users and topics / conversations in Mongo but it also uses LevelGraph as a triple store for facts and general knowledge (https://github.com/mcollina/levelgraph/)

On top of that I have examples of using ConceptNet with MySQL for extending that. (https://github.com/silentrob/conceptnet) I should also mention that SuperScript a fork of RiveScript

I will brush up the docs and work on providing better examples this week.

 

 

 

 

 
  [ # 8 ]

@Rob: It was my noobishness. I realized while reading chatscript documentation today that I had misunderstood your meaning on the database issue. I’m going to start out with ChatScript for now since there are others using it in Unity and since I’m having an easy time wrapping my head around it. I would like talk more about SuperScript when I understand the tech better though.

@Todd: Building a tool that could be made available on the Unity Store would be great - not just in terms of monetization but also to help build a community by making tools available for others to experiment with. I would like to talk more about what you have built so far. I want to build a system able to be used for an RPG-scale game with a variety of NPCs. I think that is impossible if every character is hand built though.

Ideally I would want to build the characters in layers with a relatively small number of options in each layer that create a large variety of personalities in combination. Then basic info could be defined by things like profession, location, and such. I don’t know how convincingly it would work in practice though to represent character personalities that way. If it was effective it would mean being able to randomize personalities to procedurally create unimportant characters and deliberately but quickly design impotant minor charachters, then make hand edited fine tuning of major characters. I envision starting rules that only apply to specific personality types with variables at the beginning of the rule so rules that applied to other personalities would be skipped.

 

 
  [ # 9 ]

One caveat is that only the pro version of unity supports plugins ( mechanism for calling dynamic libraries from c# ).  Price of that could be a factor. I currently have a wrapper class for chat functions that connects to a local CS server via sockets if the library plugin isn’t there. I tested the embedded during my free pro trial and am now back to the free version. Won’t need to pony the money unless I want to publish the CS asset or am closer to publishing my game.

A lot of what you talk about is on the drawing table for me as well.  I also require multiple participant conversations with topics, conversational protocols and norms, goal tracking, personal context, ect.  I’m not trying to solve that entirely with CS, there is a layer above that manages those things, which is why I had explored supporting multiple chat engines at the same time. The strategy is to track/generate per npc context outside of chat generation but pass it in using CS’s OOB signaling.  Haven’t got that far in implementation yet.  At one point I had Alice (AIML), a modern implementation of Eliza (precursor to all these bots), CS Harry, and a python bot all chatting on the meaning of life with myself and my fiancĂ©.  Awkward and hilarious. Alice and Eliza really didn’t like each other and the PyBot was just rude to everyone then got lost in recursion.

 

 
  [ # 10 ]

Wow. The chatbot philosophy roundtable sounds interesting. I’d wondered about multiple CS bots participating in a conversation with a player.

I expect that a lot of logic such as a FSM or goal-directed behavior system should be handled by the game’s scripting language and passed into CS through variables or some other method.

I have a Pro license for Unity so using a compiled ChatScript plugin won’t be an issue for me, but it looks like there are ways to work around that. I saw a post somewhere about using something called “swig” as a workaround for including compiled files by using C# code as an intermediary but I didn’t see if they said it worked. It looks like Doug Danforth’s team is not even including the CS into the Unity app but having the two talk to each other while keeping them separate—or at least it looked like he was doing so at one point. Of course if we want to collaborate we can also split up who does what too and I could focus on the Unity stuff while you have more experience already with ChatScript.

 

 
  [ # 11 ]

Also in the category of other stuff to be handled by the game scripting, I had planned to use an SQL database and have player questions that couldn’t be handled directly by CS and which contain keywords that are in the game database to be passed out of CS to the game scripting and then plugged into queries on the database. If results were found, the game script would have to determine if the character should know the information, and then if so the results would be passed back to CS and used in the reply. Considering I know just enough at present about SQL to make me dangerous (one class about a decade ago), that is another area for research and I’m sure the code to make it work will be a non-trivial task. Still the added utility of players being able to ask for useful information from NPCs would be great, and would make investigation a more viable. Also, as I had mentioned previously the structure of the database can be used to analyze the data in advance so the scripting doesn’t have to be as smart as it would if it was working on unstructured data. As a simple example if the player asks what the yellow thing in the sky is, and if sky is a location that appears in the database a query can be run to find objects nearby that are yellow, and presumably find the sun. Though that requires anticipating that the player may ask about it and providing a database entry that lists the yellow color in it, etc. Though something that trivial would probably be me appropriately included in CS rather than the database.

 

 
  [ # 12 ]

The group chat requirement is for things like quests and vendor interaction, and npc interaction with groups of players for shared quests, etc.  I’m looking to replace entirely the typical vendor and quest screens with area chat.  NPCs will have goals they try to accomplish via chat and players can try to satisfy those goals.  Players won’t know if they are talking to a NPC or not - and there will be a GM layer where GMs can take over NPCs anyway, so if you talked to a npc bot the day before and figured it out tomorrow it may not be a bot.  Players could also ‘give quests’.  My target is the ever elusive emergent game mechanic.. wink  Much research and work still to do before I have demo.

A game doing something similar ( albeit way less ambitious than what I’m trying to accomplish ) is Shroud of the Avatar.  It’s still 1-1 chat and it uses highlighted key words in chat to simulate a menu system, but it at least is a quest system that is 100% chat - the vendor interactions are all menus still.  To be honest I’ve sort of set aside the Unity part of things in the short term to focus on the context/quest/infosharing/groupchat portion of things - it’s a mechanic that can be more rapidly tested alone in text only games until it is mature enough to add the 3d interface.

The ChatBrains project I started a while back is actually trying to get together a general purpose set of topics that you can use to compose a unique chatbot similar the way the standard Alice set works with AIML.  Check it out and contribute if you would like.

https://www.chatbots.org/ai_zone/viewthread/1698/

I have a barista script there as a seed - the idea is as people come up with scripts to handle different things like ordering coffee or talking aboutt punk music those will make their way into the brains project and eventually we’ll have a collection like Alice that can give people a great start on a usable bot.  That project also includes some ongoing intermittent work on a script to translate AIML to CS, which I’m testing against the Alice set.

 

 
  [ # 13 ]

That is cool stuff. I’ll definitely check out that game to see what they have accomplished.

I think having the possibility of a bot being human is good because humans subconsciously react differently to things that may be human compared to if they know it isn’t. I also think that players creating quests is good if it can be balanced in a way that prevents rampant abuse.

My own goals at present are more limited. I “just” want a system to replace menu based dialog with chat that is robust and scaleable enough for other developers to start using in their own Unity games to start building a developer community and a market niche around the technology and game mechanics. I’ll certainly be looking at the ChatBrains project and would be happy to share what I create in return.

In the long term I want something that can be integrated with voice recognition and text to speech in 5-10 years.

 

 
  [ # 14 ]

By the way, CS supports multiple chatbots with shared and unshared context. I used that in a demo whereby two chatbots (asthmatic big bad wolf and a little pig) carried on a “stage play” conversation with each other and at times asked questions of the user. The user could also address comments to either chatbot specifically. Since pig was the medical expert on asthma, he answered all questions on that no matter who addressed to, but otherwise they had their own answers to questions.

 

 
  [ # 15 ]

I was aware of that Bruce, but after looking at how it worked it didn’t fit my use cases.  I need multiple bots _and_ humans, and there are some other aspects that lead me to implement part of the context outside of CS.  I also looked at the planning features of CS for some other stuff, might use those, still not sure.  CS sure is deep. smile

 

 1 2 > 
1 of 2
 
  login or register to react