Previous Blog Next Blog
Prev/Next Blog
by date

NPC Chat status (and screenshots!)

NPC Chat status (and screenshots!)
Name:Ted Southard
Date Posted:Feb 22, 2008
Rating:4.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Ted Southard

Blog post
Yeah, it's time for another update on this weird chat interface that I'm developing. To give a basic overview, I am developing a chat interface that will allow players to converse with NPC's in an MMO world with the following goals/restrictions/features:

1) Must be scalable (this is an MMO we're talking about).
2) Must not use parsed language or grammar. This is due to bad grammar, bad language, misspellings, and localization, which would mean rewriting all of those other algorithms.
3) It must be tied into the AI/AE (Artificial Intelligence/Artificial Emotion) system.
4) It must actually have a bearing on the game world.
5) It must be modifiable on the fly by a dynamic mission generation architecture (more on this another time).

Okay, so that's asking a hell of a lot out of your NPC's, but if it is done creatively enough, well... it can be done. In previous blogs, I've talked about how I'm utilizing a database implementation of canned dialog elements to represent conversations, which immediately addresses #2 (it also dovetails with any future localization efforts, because we'd only be translating canned dialog). As a database, it also addresses #1, but only in it's implementation, where I received some help on normalizing databases from my day-job's boss, who is a SQL ninja with about 12 years of that under his belt- he taught me a lot about how to solve MMO problems in a database, including how to streamline the data. To emphasize: If anyone is planning an MMO, learn SQL early on, and keep tweaking and optimizing how your data is represented. That's your meat and potatoes right there, and you don't want it crapping out on you.

Back to the topic at hand... #'s 1 and 2 are taken care of, but then again, so is #5, due to the dialog being represented in a database form. Of course, there are certain data types I'm using (which shall remain nameless for now) which help me to do quick queries for pairs of dialog, even when there are multiple answers to a question. By "multiple answers", I mean that an NPC can give you a right or wrong answer, a lie, an answer colored by emotion, or even no answer at all (yeah, that NPC is totally ignoring you, dude). This also lends itself to a tool that I created to create new pieces of dialog in an in-game editor, so that you can expand your NPC's conversational abilities on the fly as you test the system. Some coding would still be required for the AI/AE pieces (done in script), but for the dialog itself, you can click through a conversation, find where you want to expand the dialog, switch to the editor, and add what you need there, then return and go along as if you never stopped. Once the dynamic mission generation system is running, it will do things like this automatically using templates to generate specialized dialog tailored to a mission.

Item #4 is self-explanitory, and depends more on me not putting stupid subjects in there, but it's a valid issue if you don't know what those NPC's should be talking about. And lastly, the system needs to be able to be influenced by the AI/AE system so that the dialog actually reflects the rest of the experience. So, before I get to the screenshot, I'll give status on the items below, and some challenges I've encountered:

1) Some more normalization needs to be done, but after a revamp or two of the database structure, I think it's in a place where data can be pulled together rather quickly. I will need to create testing applications to stress the system at a later date, but I think for dozens or even a few hundred users, the system will hold up relatively well, with acceptable lag times on a very modest server.
2) Canned dialog FTW! Honestly, it solves everything in this item, though it poses a unique problem in that when it comes time to hire on a writer(s), they will be in a difficult position creatively. Creating dialog without knowing all ends is going to be a bit of a learning experience for them, though the ability to do it while playing the game should give them the ability to play through the dialog and sense what else needs to be "said", and then add that...
3) Adding the AI/AE into the mix is not as tricky as I thought it would be, but I still want to abstract it a bit more so that there's some extensibility. Doing it that way should also benefit the AI/AE systems on their end of the scale as well, though I've hacked it in for now for lack of a fully clear view of which way to go with it. In the next few days, I'll have this decided on and the system testing. As it is, the basic principles of their influence are already there- it's just the way the backend goes about it that I think I can do better.
4) Dialog's bearing on the game world is starting to make me think in very deep (and mundane) ways about my world. If you want to talk to an NPC about it, then you can get a huge amount of information from these NPC's. They won't all have the same dialog or "knowledge", but instead will have knowledge of topics to a certain extent, which is variable. This is where lot's of backstory needs to be written up.
5) The extensibility of the dialog is already working with the editor, and it's just a matter of seeing what kinds of dialog are needed for the dynamic missions, which are the next targeted feature that I'll be working on. The good news is that this was designed in tandem with the dialog system, and the bad news is that this is all terribly complicated.

All that said (if I'm making sense anymore), take a look at a quickly-rigged test app in TGB (with TGB "Asteroids" tutorial art in it, for those that will wonder):



This demonstrates varied answers to the same question, as well as failed attempts by the player to get an NPC to answer the question. The blank lines where it looks like something was skipped are actually unhandled dialog (my own mistake with some early on that I haven't fixed). The logic behind it can use a lot more AI, but that system isn't really implemented yet, and I'm just testing the variables that affect dialog right now to make sure they work, whereas when the AI system goes in place, I'll have to test to ensure that they work "believably".

For those interested in this kind of MMO tech, I'll be doing some informal demonstrations of it at the IMGDC coming up in Minnesota at the end of March. By then it should be in a much more advanced state, and other game functionality will hopefully be added to it as well to provide a more rounded experience. Don't expect the sample art to change though- I'm not concentrating on that at all until I get these core systems tied together over the next couple of months. In the meantime, comments, critiques, questions, concerns (uh, should you be concerned?) are all welcomed!

Recent Blog Posts
List:11/25/08 - Sure, you can pitch your game, but will anyone try to catch it?
11/13/08 - Progressing towards progress...
07/09/08 - Talking to NPC's... Now in 3D!!! (screenshots)
04/10/08 - And the NPC lived happily ever after...
03/04/08 - Chatting with NPC's, and making them violent...
02/22/08 - NPC Chat status (and screenshots!)
01/30/08 - So, exactly what is there to talk about with NPC's anyway?
01/03/08 - Here's a little story that I'd like to tell...

Submit ResourceSubmit your own resources!

Roland Orr   (Feb 22, 2008 at 04:31 GMT)
i like where your going with this. I read your last post and it intrigued me. Please do share more.

Question? when this is done and in a working state are you going to put it up as a resource or product? Because something like this i can really see the benefit of it and the usage of it in my project. Something like this would help take my game and make it really come alive. Which is one of my main goals for my game project.

So yeah, please continue to share.

Mike Rowley   (Feb 22, 2008 at 12:57 GMT)
This is quite interesting. It seems simular to the Alice Ai. I can see a multitude of uses for this type of system. Great work. :-)

Ted Southard   (Feb 22, 2008 at 13:17 GMT)
@Roland: It's possible that when it's all said and done, I may sell it as a resource. It took me about 5 years to get to this point, and while it's really surprising to me just how close this was to what I had set down on paper in about 2003, I don't think that this would be free. The implementation, if you saw the data behind the scenes, it actually pretty simple, but you can do complex things with it. In any event, it still needs a lot of work, but releasing it as a product is something I'm thinking about.

@Mike: I believe that Alice uses either trees or those xml files (or maybe trees in xml form?). The only thing really similar between them is their output- which was what my aim was. This is basically database-driven and designed to be used in a client-server environment, whereas you can run Alice or any of those other chat bots on your desktop. They also use flat files. But other than that, I don't know enough about Alice's internals to say that their decision-making between answers are the same, though the decision-making piece in mine relies either on database pairing of the dialog elements (which Alice probably uses in it's own way), or if it's necessary, it can kick out to functions to decide what dialog element to display as a result of any other one. That feature is actually going to get a lot of attention, because of my requirement that dialog tie into the rest of the gameplay. /hug might return dialog, or dialog may get you a /hug in return. Or maybe they'll attack you. It makes roleplaying part of the game in a simplified way- for the user. It's friggin' hell for me :P

David Montgomery-Blake   (Feb 22, 2008 at 19:25 GMT)
Cool lookin' stuff you've got goin' on there! Wish I could see it in action, but Idaho's a bit of a distance away from Minn...though I need to get back there!

Ted Southard   (Feb 22, 2008 at 20:09 GMT)
@David: Come out to IMGDC and I'll give you a quick demo. It doesn't look like much because it's just chat, but that's half the beauty of this. The other half will come when I can hook it into actions and have NPC's get offended enough to take swipes at the player.

Kevin James   (Feb 22, 2008 at 22:00 GMT)
Ted,

This definitely seems to be a very good project! I'd love to see it in action myself. Correct me if I'm wrong, but this dialog system would work in a single player RPG as well?

Ted Southard   (Feb 22, 2008 at 22:04 GMT)
@Kevin: If you make it do a flat file instead of MySQL, then sure it could. It can be made to be agnostic of database type or where the server is. Right now, it sits on top of the ODBC resource, but there's no reason that it can't be used against something different.

You must be a member and be logged in to either append comments or rate this resource.