Eliza: Interactive Dialogue System for Classic RPGs?



Greetings! I just started enrolled in school for video game design and I had an idea for dialogue in a game I plan to develop, but I wasn't sure where to go or who to ask. I am designing a RPG game that requires NPC character interaction, but I want to avoid that dialogue style where the NPC speaks, and then the player is given a list of responses to choose from. Instead, I would like to go back to the more interactive style common in classic games where the player's character encounters a NPC and two dialogue boxes appear; one the player's, the other's NPC. In the NPC dialogue box will say something like "greetings traveler" or another greeting (friendly or otherwise). Now the player gets to type in his or her dialogue box a response--any response he or she feels like. I understand it's a lot of work as there are so many responses, words, topics, a player can type, but this freedom of speech and interaction is critical for the goal of this character-based video game. I am not making a text adventure game, but a visual RPG that uses text-based adventure elements in a conversation style with NPCs. Something like that 1960's AI program Eliza but instead of psychology topics, the conversation would motivate plot, character, and conflict. Thank you in advance for any advice or program suggestions that would allow this. :)


Much of the difficulty in your task lies with the inherently obscure design of the conversation engine.
I've written many, many such engines--in GameMaker, too--over the past 13 years, and every one of them was different. There will not be a generalized programming strategy which causes your game's characters to become intelligent.

It is possible to simply hook your game up to a basic chatbot that handles most regular conversation and can be customized to your game. This, however, costs money since the developers of such engines need to find a way to stay in business providing the basic conversation features. pandorabots provides an API which could suit this need.

But you can also write something yourself, if you have a strategy.

One of my simple chatbot strategies worked like this:
I had a file with a list of things that my bot could talk about (~400 replies)

1) Clean up the sentence that was typed in (this involved setting everything to lowercase, then finding and removing punctuation and emoticons, then replacing common contractions with full words).

2) Check the conversation file for the first word spoken. If it does not exist, then print out a generic statement about not understanding the player. Done.

3) If the first word does exist, check for the second word. If the second word does not exist, print out the stored reply for the first word. Done.

4) If the second word exists, check for the third word... you get the idea, keep checking until done.

My file looked a bit like this:
reply = I do not know how
[how are]
reply = I'm not familiar with them
[how am]
reply = You tell me!
[how are you]
reply = Oh, I'm fine thank you.
A conversation might go like this:
> How are you?
> Oh, I'm fine thank you.
> How am I?
> You tell me!
> How are the local football team doing?
> I'm not familiar with them
> How do I get to the store?
> I do not know how
As you can see, this generates a "sort of" conversational computer, which is mostly programmed to make vague statements about not knowing, unless it sees a query that it has more specific information on. My own implementation included additional enhancements such as a verb list and an adjective list. For example, "How fast does a hawk fly?" would return "I do know know how" in my brief example above. But in my basic engine, it could identify "fast" as an adjective, and could reply "I do not know how fast."

But that is just one strategy, which worked with the thing I was doing at the time (with some additional enhancements). You must think of how you wish for your characters to analyze statements and respond. It will generally be unreasonable and unnecessary to try to make your program respond to all possible text.

Another interesting example from the 1990s (which I had nothing to do with) is the game Starship Titanic. This game allowed players to interact with robots on a crashed starship. Through the use of conversation, the player could learn details about the mystery of the ship, and could get the robots to fix things to win the game.

Starship titanic used a keyword system. It simply scanned sentences for words which matched a long list of terms that the robots knew how to reply to. The system was simple (actually, slightly more complicated; there were several sets of keyword/reply lists; the game would choose which list to reference based upon the state of the game, which prevented players from being able to accidentally trigger a puzzle solution too early by guessing a word). Each robot could only reply to several basic conversational phrases (like "Hello"), and phrases which were specific to the area of the starship where the robot worked.

Nonetheless, the conversation engine seemed very complex because of the way in which it fit into the game. Since each robot was assigned to an area of the starship, it was easy to have an appropriate response when asked about other parts of the game: A robot could reply that it rarely left this part of the ship or that it only knew things about its specific job.

Furthermore, each robot character was given a strong psychological aspect--schizophrenia, depression, separation anxiety, paranoia, and more. These "personality traits" made it seem "ok" when the robots did not supply an answer. You might ask about a puzzle, and the robot might reply with a line about how scared it is to be alone. This is technically not a smart response to your question, but it makes the robot sound like it is overly focused on its own problems, and reduces the impression that the game was not programmed with a correct reply.

That design worked well for robot starship operators with personality disorders--what method will work best for your characters?


Thank you! After searching the Internet for quite some time, your response was most intelligent and informative! I cannot tell you how grateful I am. To answer your question, I originally thought the Starship Titanic dialogue system would be the best, but after understanding your explanation, I believe the chatbot system like the one you designed [Clean up the sentence that was typed in (this involved setting everything to lowercase, then finding and removing punctuation and emoticons, then replacing common contractions with full words)] would be even better and more effective for my particular goal. Am I to understand you accomplished this in Game Maker?

I've been a hardcore gamer my entire life, but I earned a degree in creative writing instead. A few months ago, I decided to go back to school for game design and programming. I've only completed classes on storytelling, graphic design, character development, and world-building (which were all nearly identical to the classes I've taken for creative writing) but I haven't yet started classes in the actual programming and language. I was hoping to get a head start so that I won't be walking into my first day of class blindly. My point is, as a professional writer for most of my life, writing dialogue is my strongest skill and so a list of hundreds, or even thousands of lines of dialogue is just another day for me. How it's implemented, programmed into a game, is very new. I take it you recommend the program Game Maker? My course syllabus says I will be learning Unity, but I can always learn Game Maker on the side via tutorials if that is what you recommend. Thank you again, Tsa05, you are a wellspring of knowledge!

If you have any further advice, recommendations, or tips, I'm open to all suggestions!
Last edited by a moderator:


šŸ§ *penguin noises*
GMC Elder
There's a modern game similar to Starship Titanic that got released recently, called Event 0... it kinda follows the same premise: you interact with an AI, typing actual questions in. I think interacting with an AI stated to be an AI is a pretty good way of suppressing suspension of disbelief... if the AI acts inhuman, it's because it is. Event0 also has themes about evil AIs, much like 2001:A Space Odyssey, which helps keeping the conversations interesting... Kaizen won't always reply to your questions directly, so you need to ask indirectly and hope it mentions information you can find useful. The conversations are much more linear than they seem (can be observed by watching several people LP the game in different ways, or replaying it after beating it), at some points Kaizen just holds a monologue ignoring the stuff you write altogether, the devs expecting that you type something that moves the conversation forward but don't really care what.

From Event0, we basically gander the following:
  • "Less human" AIs make players more willing to suspend their disbelief when there are weird replies.
  • If the player input doesn't make sense, it could be worth ignoring it and try to pretend it was understood.
  • If the AI displays a mood or seems to have its own secret agenda, conversations get more interesting.
  • If the AI asks questions, the player has to come up with a good response rather than vice versa.
It's a kinda interesting topic.

I also remember an old research thing about an AI that would remember things the operator would tell it... that could also be worth investigating. If the AI can identify nouns and possessive pronouns, it could mention them later to seem like it cares.