Comme il Faut: Enabling Playable Social Models Josh McCoy, Mike Treanor, Ben Samuel, Michael Mateas, Noah Wardrip-Fruin University of California Santa Cruz, Expressive Intelligence Studio 1156 High Street Santa Cruz, CA 95064 {mccoyjo, mtreanor, bsamuel, michaelm, nwf}@soe.ucsc.edu Abstract Though taken for granted by people, social interaction is difficult to implement in artificial intelligence (AI) systems. The social AI system Comme il Faut (CiF) aims to take a step forward in this area by allowing agents to interact socially with one another. CiF is a playable model of social interaction constructed by using concepts from the social sciences as both the basis for algorithms and as a framework of representation. When used to encode and process human domain knowledge of social behavior, this system models the "social physics" that govern social interaction. In this paper, the knowledge representations and the algorithms used by CiF are detailed with examples of how CiF is currently being used in simulations, computer games, and interactive media experiences. Introduction 1 Performing and responding to patterns of social interaction while remaining within the bounds of social norms defined by cultural context is a task most humans perform many times each day. However, social interaction is difficult to map to artificial intelligence systems for a variety of reasons, including: representing social commonsense to help build context around interactions; engineering re-usable patterns of social behavior that are general enough to be used in a variety of contexts but specific enough to convey the changes in the social environment; and determining what changes to the social state are appropriate given the current social context and the history of the specific agent in the social interaction are all representative of the challenges facing AI systems whose goal is to perform humanunderstandable social reasoning and interaction. Our approach to overcome the challenges of building a social AI system is to leverage the analysis of human social behavior done in social science and the humanities. This 1 Copyright © 2011, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. use of existing concepts allowed for a construction methods of representation and processes that allow knowledge held by domain experts to be encoded and used by an AI system. Comme il Faut (CiF) (McCoy, Treanor, Samuel, Tearse, Mateas, & Wardrip-fruin, 2010) is an AI system that uses these techniques to enable an interactive, authorable model of social interaction for autonomous agents. Dramaturgical analysis (Goffman, 1959) is the basis for extending the power of social games from their initial form in Facade (Mateas & Stern, 2005), where their variation in performance was implicitly encoded in behaviors and they were not reusable between characters, to their current, reusable form that supports performance variation explicitly. Social games are the primary structure of representing social interactions in CiF. We define social games as multicharacter social interactions whose function is to modify the social state existing within and across the participants. Through the use of social games along with additional encoded social context, CiF is governs the interactions of several virtual worlds currently in development: a computer game entitled The Prom featuring the social interactions of a group of high school students leading up to prom night (McCoy, Mateas, & Wardrip-fruin, 2009; McCoy, Treanor, Samuel, Tearse, Mateas, & Wardrip-Fruin, 2010); the SIREN project in which social games are used to help educators teach conflict resolution; and the Holodeck system for enabling supporting character realism in virtual worlds each use CiF to model the social aspects of their virtual worlds. Examples social AI systems are PsychSim (Marsella, Pynadath, & Read, 2004) and Thespian (Si, Marsella, & Pynadath, 2005). Both use concepts from psychology to regulate the social interaction between agents. The Mind Module is a semi-autonomous agent architecture that is a mental rule system over the domain of personality psychology and affect theory (Eladhari, 2009). The Sims 3 is an example of a culturally influential and commercially successful video game that uses an AI system to create a highly dynamic social space (Electronic Arts, 2009; Evans, 2008). In this paper, we contribute a description of the methods of knowledge representation and algorithms that comprise CiF’s framework. These descriptions will be accompanied by a running example to clarify and illustrate the system. Knowledge Representation in CiF Figure 1 – The areas of representation and algorithms that comprise CiF’s framework. The outer blocks are the areas of CiF that require authored knowledge and in the inner block are the algorithms that act upon the authored knowledge. AS is seen in Figure 1, CiF consists of authored content and processes to use that knowledge. CiF is a general system for facilitating character performance in any encoded set of social dynamics. This generality is demonstrated by CiF being used by the SIREN project to model the social considerations of conflict resolution for educational purposes. CiF is also used by the Holodeck project to allow supporting characters to behave in a way that is consistent in the social space of a bar. Social games are primary form of encoding social performances characters can enact and are constructed from the metaphor of drama present in dramaturgical analysis. Dramaturgical analysis uses metaphors from theater to analyze everyday life interactions: agents being seen as a cast, actions seen as performances that take place in settings, objects in the world being props, and allied actors being performance teams. A core aspect of dramaturgical analysis is how individuals manage their presentation of themselves, or how they try to influence how they are perceived by others. To this end, social games represent a related set of patterns of social interaction where the exact performance and social outcome varies based on the personality-specific attributes of the characters involved. CiF uses rules to reason over the social world when making decisions about social games. To calculate a character’s will, or volition, to perform social games some rules are given a weight to aid in comparing social concerns. Below is a discussion of rules, the predicates that form these rules, and several ways in which they are used in and with social games. As we are interested in using autonomous characters in the context of games and other social simulations, for the rest of the paper you'll refer to the agents as characters. The examples come from authored content from The Prom. Unless otherwise specified, x, y, and z stand for distinct characters in the social space. Networks The Prom, a game modeling social interaction in a high school, has several different types of predicates. The most primitive, social networks, are bi-directional, fully connect networks where the edge values measure the feelings between characters. Examples include a romance network, which measures how interested characters are in pursuing intimate relationships with each other, and a "coolness" network which is an approximate record of how much respect characters have for one another. If x has a romance network value of 80 towards y, but y only has 20 towards x, the implication is that the agents are drifting apart. Networks being bi-directional permits interesting (and lamentably true to life) states like relationship( dating, x, y), network(romance,x,y) is 20, network(romance,y,x) is 95, and network(romance,x,z) is 80, which translate to x and y are dating, y is head over heels in love with x, but x has fallen out of love with y but has eyes for a third character, z. Relationships The relationship predicates are binary states that provide detailed information about the social state of agents. CiF’s relationships are bidirectional and are the feature of the social state that have the most impact on social game play. CiF has three different types of relationships, including relationship(friends,x,y), relationship(dating,x,y), and relationship(enemies,x,y). Statuses Statuses are temporary, optionally directional, binary social effects that result from social game play. Status predicates capture transitory states in an agent's mood (e.g. status(cheerful,x)), sharp spikes of emotion between agents (e.g. status(hasACrushOn,x,y)) and other salient facts (e.g. status(popular,x)). Traits Unlike social network values, relationships, and statuses, traits are permanent properties of a character which heavily impact social gameplay (e.g. trait(brainy,x)). Traits may also be grouped into sets called categories, which can then be invoked to reference any of the constitute traits. For example, the category Introverted encompasses several traits: Introverted ⊂ {Shy, Mopey, Afraid of Commitment}. Social Facts Database The social facts database (SFDB) stores a context entry for social games played and every trigger rule that affects social state change. Additionally, any specifically mentioned cultural item, character reference, or social game label (such as mean, funny, and nice to) are stored in a social game context entry for use in future social games. Through this, agents may reason over socially complex thoughts that take into account not only their current state, but the social history that led to them possessing this state. For example, Naomi will be more interested in dating Simon if Simon has done several nice things to her recently. Relevant historical facts in the SFDB can also be explicitly referenced during performance realization, in which state change is communicated to the user through hand-written instantiations. intents, where an intent is the intended change in social state after playing a social game (e.g. have two characters start to date). Every social game has two influence rule sets, one for the initiator, i, of the Social Game and one for the responder, r. Though structurally equivalent, the two IRSes have contextual differences. Weights in the initiator IRS determine both which social games i is interested in playing and who to play them with. All rules, both in all initiator IRSes and in all microtheories (discussed below) are considered and their weights tallied--the social games with the highest scored weights represent the social games i wants to play most. A similar scoring mechanism is used for r, with one small caveat; r need only decide whether to accept or reject the proposed social game’s intent (discussed below). Cultural Knowledge Base The cultural knowledge base (CKB) is a way to further define the world that CiF driven agents inhabit, providing them with a variety of topics to bond over and squabble about. The CKB used for The Prom has many items, including skateboards, wolf spiders, and roses. Every agent has one or more connections to these items, linked through the uni-directional phrases likes, dislikes, wants, and has. Naomi wants roses. Simon likes wolf spiders. Simon has wolf spiders. Additionally, every object in the CKB can be associated with universally agreed-upon properties in the social world (e.g. roses are romantic, skateboards are cool). This allows for agents to interact with each other based on their individual opinions of objects in the world outside of their opinions on the social state. For example, CKB(item,(x, likes), (y, dislikes), lame) refers to an item that x likes, y dislikes, and is universally regarded as lame, which could perhaps contribute to y’s voliton to poke fun at x. Conversely CKB(item,(x, likes), (y, likes), lame) might be used in the left-hand-side of a volition rule for a bonding social game, as the agents bond over their shared deviation from the social norm. Microtheories Rules CiF reasons over the state of the world through rules and conditions. Conditions, and the left hand side of rules, are composed of the predicate types described above (networks, relationships, traits, statuses, ckb and sfdb entries). These predicates can be evaluated for truth and assertions may be made on them to determine adjustments to the social space. Influence Rule Sets Influence rule sets (IRSes) are sets of rules that influence the desires of the agents to engage in social games. The right-hand-side of every rule inside of an IRS is a weight that represents how important the rule is in determining The microtheory library M constitutes a large repository of rules, split between dozens of microtheories. Microtheories are an attempt to capture knowledge about social dynamics that apply across multiple social games. A microtheory consists of a definition and a pair of influence rule sets. The definition of a microtheory m is a condition, often times consisting solely of one predicate, for example, mdefinition := relationship(friends,x,y). Only microtheories whose definitions evaluate to true are considered when calculating volitions. The rule sets of m then provide a general understanding of what it means to be friends; the first set applies to i’s considerations, the second to r. For example, friends are more likely to get along, and less likely to become enemies, than strangers would. It's true that friends with low network values towards each other would be more likely to squabble, but this knowledge would be encapsulated in a separate microtheory, such as one with the definition BudNet(x, y) < 33 (the buddy network value between two characters is less than 33). Every microtheory rule has a weight used in the scoring process described above. Authoring a microtheory for one rule set (e.g. m2defintion := network(romance,x,y) < 33) will automatically generate an equivalent microtheory in the second rule set (m2’defintion := network(romance,y,x) < 33). Rules in M are essentially shared by all social games. This abstraction permits for the initiator IRSes and responder IRSes to capture specific nuances which differentiate social games from one another. For example, status(feelsSuperiorTowards,x,y) would generally not positively impact x's desire to befriend y, which would be reflected in mfeelsSuperiorTowards. However, when taken in the context of the social game sgiveAdvice, it is reasonable that x would indeed want to give advice to y, a social game that-given the right social context--can lead to two agents becoming friends. Social Games Social games make use of the abstractions of rules and IRSs. Every social game s has an initiator i a responder r, and an optional third agent referred to as the other, o. Social games are comprised of an intent, a set of preconditions, influence rule sets for i and r, a set of effects, and a set of instantiations . As mentioned above, the intent of the social game is a condition, typically of only a single predicate, which embodies the change i wants to make on the social state. For example, the intent of the social game sAskOnADate is relationship(dating,i,r). Preconditions are conditions which must hold true for the social game to be considered playable. The social game sBreakUp has a precondition of relationship(dating,i,r); before i can breakup with r, i and r must be dating. Next, a social game has a set of effects, where an effect is made up of a pair of rules called the effect conditions and the social changes, and a label marking the effect as either 'accepted' or 'rejected.' The effect conditions dictate what must be true for this effect to take place, and the effect changes outline how the social state of the world is affected based on this particular effect playing out. At a high level, an effect represents one possible trace through a social game. At minimum, a social game should have two effects—a generic effect for the case in which the game is accepted (the sum of all of the rules factoring into r’s considerations was positive) and another for rejection (the sum was negative). However, through the use of effect conditions, additional considerations can be taken into account which may impact the social space in additional ways. For example, given trait(cold,i), sBreakUp may not only lead to relationship(~dating(i,r)), but could have more serious repercussions as well, such as relationship(~friends(i,r)). If multiple effects have conditions which evaluate as true, the most salient effect is chosen, with saliency being a function of which true condition rule has the most predicates. The final component to a social game is a set of instantiations. An instantiation is a set of lines of dialogue, each tagged with animations that communicate state change and the justifications for the state change using hand-authored natural language. Every instantiation is linked to a specific effect, thus the performance realization of the aforementioned 'cold break up' example would be different than either the generic accept or reject of the same game. Examples of Representation The following example will illustrate the structures described above, and will be used again to demonstrate the algorithms. The example is from The Prom, CiF's inaugural application, which is set in the domain of a dramatic high school. Simon is a character with the traits of being a weakling and witty. Naomi is another character with the trait of at- tractive. Simon has the status of having a crush on Naomi, and Naomi has the status of popular. Naomi and Simon have the relationship of being friends. Simon has high romance network values toward Naomi and she has very low romance scores toward him. Naomi also has low cool network values toward Simon. All other network values are neutral. The cultural knowledge base states that Simon likes objects labeled as "lame," such as scientific calculators, and Naomi likes things that are "cool," such as footballs. In the social fact database is an entry marked as something embarrassing that Simon has done toward Naomi. It is described as "Simon misunderstood Naomi asking for help on homework as a romantic advance." This above situation describes how CiF represents the unfortunate situation where a nerdy character has unrealistic hopes of having a relationship with someone "out of his league." Examples of Representation The following example will illustrate the structures described above, and will be used again to demonstrate the algorithms. The example is form The Prom, CiF's inaugural application, which is set in the domain of a dramatic high school. Simon is a character with the traits of being a weakling and witty. Naomi is another character with the trait of attractive. Simon has the status of having a crush on Naomi, and Naomi is has the status of popular. Naomi and Simon have the relationship of being friends. Simon has high romance network values toward Naomi and she has very low romance scores toward him. Naomi also has low cool network values toward Simon. All other network values are neutral. The cultural knowledge base states that Simon likes objects labeled as "lame," such as scientific calculators, and Naomi likes things that are "cool," such as football. In the social fact database is an entry marked as something embarrassing Simon has done toward Naomi. It is described as "Simon misunderstood Naomi asking for help on homework as a romantic advance." This above situation describes how CiF represents the unfortunate situation where a nerdy character has unrealistic hopes of having a relationship with someone "out of his league." Algorithms in CiF CiF operates by looping through a set of processes (figure 1). The first process is desire formation which determines a character’s volition (or will) to play a social game with roles bound to specific characters. Volition is scored by counting the weight of the true influence rules in both the microtheories with true definitions and social game's initiator IRS (see Figure 2). Next, a social game (with the char- FormDesire(i, r, o, S, M):Pi Pi := {} For each s in S if s does not require an other if eval( sprecondition, i, r) v := 0; for each m in M if eval(mdefinition, i, r) for each influenceRule in minfluenceRuleSet if eval(influenceRule, i, r) v := v + influenceRuleweight for each influenceRule in sinitiatorInfluenceRuleSet if eval(influenceRule, r, i) v := v + influenceRuleweight push <s, i, r, v> on to Pi if s requires an other for each o in cast where o ≠ i and o ≠ r if eval( sprecondition, i, r, o) v = 0; for each m in M if eval(mdefinition, i, r, o) for each influenceRule in minfluenceRuleSet if eval(influenceRule, i, r, o) v := v + influenceRuleweight for each influenceRule in sinitiatorInfluenceRuleSet if eval(influenceRule, r, i, o) v := v + influenceRuleweight push <s, i, r, o, v> on to Pi return Pi Figure 2 - A description of CiF's desire formation algorithm. acters bound to roles) is selected to play. When intent is selected (discussed below), CiF determines how the responder reacts to the social game chosen (see Figure 3). This process is very similar to scoring volition in the intent formation process: the sum of true rules in both the active microtheories and the social game's responder influence rules set is found. If the sum is 0 or greater, the game is accepted. Otherwise it is rejected. Next, the process finds the most salient of the social games effects to enact. Each social game effect contains a a condition rule and a change rule. After the chosen effect's change rule is asserted, which change the social state.. This includes placing an entry into the SFDB to account for the played game. The last step is running the trigger rules, which are rules that capture the cascading effects that accompany social change, over the new social state and storing the outcome of any true trigger rule. Desire Formation The following example will demonstrate the details of why Simon wants to perform an action that would raise Naomi's sense of romance for him (the romance network) and why Naomi rejects him so soundly. In the text below, x, y and z are variables that characters can be bound to. Simon and Naomi have the relationship of friends and Simon possesses the status of having a crush on Naomi. These two facts brings the influence rules from the microtheories for relationship(friends, x, y) and status(has a crush on, x, y).mfriends contains an influence rule that would detract from a character's desire to be romantic with the person he or she is friends with. However, mhasACrushOn(i,r) contains an influence rule with a positive weight greater than the negative weight of the friend microtheory's rule. Furthermore, additional microtheory rules for Simon's high romance network value toward Naomi mromance(i,r)>66 would contribute to this desire. When the weights from all true rules across all applicable microtheories are summed, the net result is that Simon wants to perform a social game that has the intent to raise Naomi's romantic feelings toward him (intent(Simon, romanceNetwork(+, Naomi, Simon))). Though there could be many social games defined with this intent, the two considered here will be a physical flirt and a conversational flirt. These two social games are similar by intent, but different because their preconditions, influence rule sets and effects differ drastically. Simon's desire to play one over the other will be determined by the two social games’ initiator influence rule sets in a process very similar to the microtheory's. For example, because Simon has the trait of weakling (trait(weakling, Simon)), and there is a rule with negative weight pertaining to that trait in physical flirt, he would be less likely to want to play that game. Furthermore, conversational flirt has an influence rule for witty (trait(witty, Simon)), another of Simon's traits, that makes him more likely to play that social game. For each social game, the net value of the weights of the true initiator influence rules add to the value of all true initiator influence rules from the microtheories to form the total desire to play each game. Intent Selection Once Simon's desires are formed, the intent selection process determines exactly what he chooses to do. Intent selection is a natural place to allow for interaction. In the case of The Prom, the players choose among each character’s top five desires. Social Game Play Assuming the intent selection process resulted in having Simon play conversational flirt with Naomi, the next step is to determine how Naomi will respond. The same relationship(friends, x, y) microtheory rule that detracted from Simon's desire to play a game that would increase Naomi's romance network toward Simon, also affects the responder's desire to accept or reject the intent of the game. Additionally, another microtheory is brought into play by the PlaySocialGame(i, r, o, S, M):effect vr := 0, accept := false, validEffects := {}, outcome := {} for each m in Microtheory Library if eval(mdefinition, i, r, o) for each influenceRule in minfluenceRuleSet if eval(influenceRule, r, i, o) vr := vr + influenceRuleweight for each influenceRule in sresponderInfluenceRuleSet if eval(influenceRule, r, i, o) vr := vr + influenceRuleweight if vr > 0 accept := true for each effect in seffects if eval(effectcondition, i, r, o, accept) push e on to validEffects outcome := mostSalient(validEffects) valuate(outcomesocialChange) return outcome; Figure 3 - A description of CiF's algorithm for social game play. fact that Naomi is friends with Cassie who has a crush on Simon (the microtheory with the definition of (relationship(friends, x, z) ^ status(has a crush on, z, y)). In this microtheory is a rule that detracts from a character's desire to play or accept a game that would increase romance with the character that a friend has a crush on. Even worse for Simon, Naomi has the status of popular and Simon does not (status, popular, x) ^ ~status(popular, y)). This also will detract from Naomi's desire to accept the intent of the game. The previous influence rules pertained to Naomi's desire to accept or reject Simon's intention to raise her feelings of romance toward him in general. The responder influence rule set and the effect conditions of sconversationalFlirt will determine exactly how she responds. For example, sconversationalFlirt has a negatively weighted responder influence rule for if Simon likes something that is labeled as lame that Naomi doesn't like from the cultural knowledge base (CKB((x, likes), (y, dislikes), lame)). As detailed above, Simon likes scientific calculators and Naomi doesn't. By the microtheory and responder influence rules, it is determined that Naomi will reject Simon's advances. But the way in which she rejects him is determined by the most salient effect condition. In this case, this is an effect condition that matches the responder rule about the cultural knowledge base. The social change tied to that effect condition makes Naomi's cool network towards Simon decrease by 20 and the interaction is labeled in the social fact database as something embarrassing that Simon did to Naomi (coolNetwork(-20, Naomi, Simon) ^ SFDB(embarrassing, Simon, Naomi)). In The Prom, effects are tied to comic book like performance instantiations where characters engage in authored dialogue pertaining to the effect conditions. Triggers After the social game has finished being played and the effect changes have taken effect, all trigger rules are checked against the state. In this case, because there are more than two entries in the past entries in the social fact database, Simon is given the status of embarrassed. At this point, all characters form their desires again. Note that the above example was extremely simplified. The Prom contains over unique 3,500 influence rules, nearly 100 microtheories, 30 social games (with around 90 planned for The Prom's release) each with over twenty rules that contribute to the characters desire and responses, a cast of 16 characters, and a combined total of over 12,000 predicates Conclusion In this paper, we contributed a description of the methods of knowledge representation and algorithms that constitute CiF. The experience of engineering CiF and using it to create interactive media experiences has taught us many lessons. Among these is the difficulty in balancing and tuning a large set of rules for sensibility and consistency. However, the difficulty associated with maintaining the authored logic is more than offset with the flexibility and reusability of that content by CiF. As these experience mature, we plan to update CiF with more comprehensive abilities to perform social reasoning, such as allowing social games to be played off one another in more complex and interesting ways, as well as increase the affordances available to authors writing for CiF-enabled experiences. References Eladhari, M. P. (2009). Characterising Action Potential in Virtual Game Worlds applied with the Mind Module. Electronic Arts. (2009). The Sims 3. Evans, R. (2008). Re-Expressing Normative Pragmatism in the Medium of Computation. Proceedings of Collective Intentionality VI. Goffman, E. (1959). The Presentation of Self in Everyday Life. Anchor. Marsella, S., Pynadath, D., & Read, S. (2004). PsychSim: Agent-based modeling of social interactions and influence. Proceedings the International Conference on Cognitive Modeling. Pittsburg. Mateas, M., & Stern, A. (2005). Structuring Content in the Façade Interactive Drama Architecture. Artificial Intelligence and Interactive Digital Entertainment (AIIDE 2005) (Vol. 3). Marina del Rey, CA. McCoy, J., Mateas, M., & Wardrip-fruin, N. (2009). Comme il Faut : A System for Simulating Social Games Between Autonomous Characters. Proccedings of the 8th Digital Art and Culture Confernce (DAC 2009). Irvine, CA. McCoy, J., Treanor, M., Samuel, B., Tearse, B., Mateas, M., & Wardripfruin, N. (2010). Comme il Faut 2 : A fully realized model for sociallyoriented gameplay. Proceedings of Foundations of Digital Games (FDG 2010) Intelligent Narrative Technologies III Workshop (INT3). Monterey, California. McCoy, J., Treanor, M., Samuel, B., Tearse, B., Mateas, M., & WardripFruin, N. (2010). Authoring Game-based Interactive Narrative using Social Games and Comme il Faut. Proceedings of the 4th International Conference & Festival of the Electronic Literature Organization: Archive & Innovate. Providence, Rhode Island. Si, M., Marsella, S., & Pynadath, D. (2005). Thespian: Using Multi-Agent Fitting to Craft Interactive Drama. Proceedings of the fourth international joint conference on Autonomous agents and multiagent systems AAMAS ’05 (p. 21). Utrecht, Netherlands: ACM Press.