Making Conversation

Have you ever spoken to a bot before? I remember talking to SmarterChild on AIM about 15 years ago. I knew nothing about programming at the time, but in hindsight it seems like such a Herculean feat to make something like that.

Early in development, I looked into how past developers (and current ones, for that matter,) had simulated and automated having a conversation. The technologies I read about placed me quite a bit out of my depth, but the theory seems simple enough, at least at the highest level. It’s all about imitation and prediction. You have lists of words and phrases, which fit into sentences more or less interchangeably. Think Mad Libs, except instead of trying to come up with something silly, you’re trying to come up with something normal.

One of the most fundamental problems with any sort of system which takes this kind of approach is that there is no actual understanding of what is being said. The program would simply select a phrase based on statistics suggesting which word choices would be the most common. For comparison, if one were to attempt to speak online in Chinese, a non-speaker to a native speaker, with the non-speaker Googling each question to see what a real Chinese speaker might say in response, this might produce good Chinese, but would not resemble the kind of conversation a normal person would have. Even if the conversation made sense when broken into call-and-response, there would be no consistency. Without understanding Chinese, the non-speaker would be unable to maintain their beliefs, their ideas, or even their personality. It would vacillate wildly among all the recorded sayings of native speakers.

Well, what if you teach a computer what all the words mean? The problem here is, you need words to explain what words mean. It’s a circular system, with no starting point. Humans can get by on that, but computers can’t. Humans pick up language naturally starting in early childhood, but computers need to be taught everything.

So what do you do? If you need your computer to speak English, you’re in for a hell of a ride. There are a lot of people tackling that problem right now, and they’re a lot smarter than I am. However, if you invent a language, and have the computer speak that, the problem changes. Now it’s no longer a question of imitation. Rather than mimicking existing patterns, you can invent them from nothing. The result is something much simpler than natural language, but a much more manageable problem.

This is how my game handles language, as it’s currently implemented: In layman’s terms, verbs function as relationships between a subject and an object. When the computer is asked a question, it references a database storing all of its knowledge (referred to in the game’s source code as the “library”), looking for the subject. It then checks to see if the subject has a relationship with the object corresponding to the verb. Here’s an example. If I type, “ask : I [ ] person” (tr. “Am I a person?”), the computer will reference the library’s entry on the player character, and check its relationships of being for “person”. The player character might have a “being” relationship with other objects, such as “foreigner”, or “friend”. If asked “I [ ] what” (tr. “What am I?”), answers will choose the first object in the list, which is where the most specific answer will always be stored, e.g. “a foreign archaeologist” as opposed to simply “a person”.

You might think this would be a cumbersome system, where I have to list every aspect of every entity that exists in the game’s universe. However, thanks to the wonders of object-oriented programming, it needn’t be that way. Rather than writing out every characteristic of everything, I only have to write out the characteristics for kinds of things, and from there I only have to write for the characteristics unique to each individual. This kind of programming is designed to simulate inference. Here’s a classic example:

  1. All men are mortal
  2. Socrates is a man
  3. Therefore, Socrates is mortal.

Within the game’s logic, I wouldn’t need to program in that Socrates is mortal, only that Socrates is a man and that all men are mortal. More precisely, there is a kind of thing, a man, and men are mortal by default (not that I would tamper with that). Socrates is an individual man, and so if asked if Socrates is mortal, the computer would know that he is from what it knows about men. The attributes of the kind also belong to the members of that kind.

That’s the basic idea. It definitely gets more complicated than that – adjectives and other modifiers, multiple subjects – but that’s a work in progress. I’ll talk about it once I’m satisfied with the implementation.

Published by:


Creator of Sethian. My personal email is grantkuning at gmail. Kickstarter: Facebook: Twitter:

Leave a comment

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s