Communication is a big part of Ruins. It is the core mechanic behind the game’s initial concept and is integral to the gameplay and experience. Because of this, much of my design work has gone into planning the dialog system and devising a way for the player to interact with Susan that feels natural, rather than game-y. One way I have decided to do this is by abandoning the traditional dialog tree for a social artificial intelligence.
I first decided on the use of social AI while reading about Comme il Faut, a system that simulates social games based on the psychological needs and roles of the game’s actors. Because the only dialog that will occur in Ruins is between the player and an NPC, I didn’t think such a complex system was necessary. But it made me realize that if the player could have multiple responses to a single line of dialog based on their current state, why shouldn’t an NPC?
So I started working on a system that allows the AI to choose different responses to the player’s dialog based not only on the line that is being responded to, but also previous conversations and actions the player has taken. This system would be similar to how in RPGs such as Dragon Age: Origins NPCs can say different things at the start of a conversation based on previous events (love interests opening up to you once you’ve reached high enough approval, Alistair’s angry outburst should you fail to save a certain Arl’s family, etc.). The big difference is that using Ruins’s system, the NPC would have the opportunity to decide what to say at every step in the conversation, not just at that opening line. This can lead to much more natural conversations during which everything the player has done previously is made relevant. In others words, the dialog builds on itself similar to the way it would in real human interaction.
Although I could probably write an entire essay on the system itself, I would like to dedicate this post to an explanation of the heart of the system: the decision algorithm. Susan’s decisions will be based on three variables that the game tracks behind the scenes. These three variables are Trust, Romance, and Friendship.
Trust is the primary variable upon which dialog decisions are made. It sits on a scale of 0 to 100, starting at 50. Nearly every dialog choice and major action will affect Trust in some way, although as its value increases/decreases toward one end, the impact of changes will start to lessen. The more Trust the player has earned, the more options will be presented to them as Susan opens up and reveals more. However, having a low Trust score won’t necessarily eliminate those options, although it will make it more difficult to gather information from Susan.
Romance and Friendship are percentage modifiers to Trust and both operate similarly. Only certain dialog options will affect them, but they will open up new dialog paths that couldn’t be attained by building Trust alone and can have a large impact on what endings are available to the player. With a high Romance or Friendship score, Susan will be more invested in the relationship with the player and more forthcoming with information.
So how does this all fit together? The system requires each line of dialog from an NPC to set a minimum threshold for Trust, Romance, and Friendship. If the player has cleared the threshold on all counts, I take the difference between the actual and minimum values and subtract that from the maximum value of each variable (100 for Trust and 1 for Romance/Friendship). Then I return the calculated value for Trust plus the multiplication of Trust and each modifier. This is demonstrated in the code sample below:
if(Trust >= npcDialog.MinTrust
&& Romance >= npcDialog.MinRomance
&& Friendship >= npcDialog.MinFriendship)
{
short dTrust = 100 - (Trust - npcDialog.MinTrust);
float dRomance = 1 - (Romance - npcDialog.MinRomance);
float dFriendship = 1 - (Friendship - npcDialog.MinFriendship);
return dTrust * (1 + dRomance + dFriendship);
}
These values will be calculated for each available dialog option and the greatest value to be returned will determine what Susan decides to go with (in the event of a tie I currently planning on selecting her response randomly out of the winners). Going along with the theme of organic game progression that I’ve mentioned earlier, the variables the algorithm is based on will be hidden from the player, who will have to depend on the context of the dialog to navigate their relationship with Susan. This is done to pull the player’s focus away from keeping track of scores and instead draw them to the dialog itself. I believe that doing so will discourage the player from trying to “game” the system and encourage more natural gameplay.
Although the algorithm presented is simple, I have found it provides the most desirable results out of all the ones I have tried, and the three variables it depends upon work well with content generation. Although I have yet to iron out all the wrinkles in the dialog system, I am confident in the foundation I have laid with the decision algorithm and supporting class library. As the central mechanic, the quality and presentation of Ruins’s dialog will set the precedent for the rest of the gameplay experience. With that in mind, I believe I am off to an excellent start.



