Tuesday, March 12, 2013

Creating Conversation

I know its been a while since my last post (things have been quite hectic). I'm close to getting an alpha done and I had to change the complete back-end of my game to match up to a new requirement that may or may not change. To get to the possible change, some background info is needed on the first back-end and the one I currently have.

The back-end I am referring to is to simulate conversation flow in a non linear way. In a typical dating sim, conversation is quite linear. You have a selection of choices to either ask the character or respond to (usually 4). There is usually one right answer. If you get the right answer the game continues and another set of choices of either questions or responses until the game is complete. Obviously this is not realistic to reality.

A typical conversation flow in dating sim.

As you can see in the first depth after the intro, each response to the intro can bring up a  different set of questions or responses based upon what question or how you responded. Then each branch delves linearly to a set question/response that must be answered in order to progress. This kind of non-linearity is closer to what a real conversation is and what I hope to simulate when the project is over. 

In order to achieve this non-linearity, a more generic tree must be used. What better than a graph. The way the graph worked is that each Vertex in the graph is a conversation state (QUESTION, ASK, FOLLOW-UP). A QUESTION is a question you ask the character, an ASK is a question the character asks you, and a FOLLOW-UP is a response to your question or to the character question that can lead back to a QUESTION or ASK. 

A graph simulating the Conversation Graph

 Inside each state are several responses the character uses as an edge to either a QUESTION, ASK, or FOLLOW-UP state. It is a directed and weighted graph. The weights are the probability of a certain response being used. If time permits, I would love to create a probabilistic model of a certain result being asked in one situation and by a certain personality type. However, this may or may not go in depending on how much time I have to complete it.

As much as this model worked, and I even created a prototype for it, it didn't simulate the conversation in a way that my team thought was the best way. So we decided to go in a different direction. One of the most common aspects of conversation is that both partners mine for a common topic to talk about and delve deeper into that topic. So we decided to simulate that aspect of conversation. It works much like standard conversation flow above, in which a person "chooses" a topic by asking them a general question about it. It can then go deeper with them asking more personal questions about the topic until they choose to go to another topic, or the topic runs its course and another topic must be chosen.

A Topic Conversation map

Each iteration of each topic is a certain depth of the topic. Iteration 1 being a very general topic for example, "What is your favorite book." and the last iteration being something very specific, "How do you feel about the collected works of William Shakespeare." No matter how deep a person my be in conversation, they still have a chance to get out by asking an iteration 1 question from the other topics. Inside each iteration are a list of questions that the player may ask. Each question is generically similar such that each response in the response list could logically be used to answer any question posed. Once the response is stated, the conversation goes to the next iteration where they may choose to continue the conversation on the topic or move to a different topic.

Obviously this representation does simulate topic conversations, but it is still linear. When coming up with questions to fit this model, our designers found it really hard as they wanted tangents and two different iterations to account for that to add non-linearity. So far nothing has been changed, but if we want to still keep this model, but still add non-linearity, then a combination of the two models needs to be done.

A Hybrid Conversation Flow

Reaching a topic is the same as before, but the going through iterations is not so linear. Each iteration is the same as the old one; the only difference is that each response acts like the response in the graph that it acts as an edge to a new iteration. This time though, not only can a response map to the next iteration, but a different iteration in a different topic allowing the character to change the topic.

Each representation has its own strength and weakness, but I really like the third representation the best since it achieves what we want the best. The only reason I don't throw away my back-end and start anew is the fact that I would have to throw out my back-end and start a new and for the second time. Also, I have a Play-Test this coming Tuesday, so I don't want to have my game in a state of unplayability. Also I would hate to change out the back-end only to find out I need to stick with a previous representation or create a new representation for a completely new set of requirements. All I know is that conversation is tricky. I should post again about which representation I did as well as other aspects of the game (if I don't be lazy for a month again).