Thespian Architecture Si November 2009

Thespian is multi-agent framework for authoring and simulating interactive narrative.

Egri Lajos has strongly argued for the importance of characters in traditional narratives. His view of narrative — of rich, well motivated, autonomous characters as a creative spark to the author, and is nevertheless constrained by the author’s goals for the plot — serves as inspiration to the approach taken in Thespian. Specifically, a two-layer system is used for simulating interactive narrative.


At the base is a multi-agent system comprised of goal-oriented autonomous agents that realize the characters of the story. A key aspect of this layer is the richness of the agent design that provides motivations, emotions, theory of mind and social norms. The agents in this layer autonomously interact with each other and the character controlled by the user, thereby generating the story.

Above this layer is a director agent that proactively redirects the characters when it foresees future behavior of the agents will endanger the author’s plot design, which can be seen as group goals for the multi-agent system. A key aspect of this layer is that the director agent has access to models of the agents and user. It uses these models to assess whether plot goals are achieved as well as redirect the characters.

In addition to the two-layer simulation system for interactive narrative, Thespian also contains off-line authoring processes to facilitate the author in the design of characters.





Storyworld in Thespian Si November 2009

Character Design

Decision-theoretic goal-based agents are used for modeling each character in the story, with the character’s motivations encoded as the agent’s goals. Each agent has multiple and potentially competing goals, e.g. keeping safe vs. keeping others safe, that can have different relative importance or preferences. Thespian agents have recursive beliefs about self and others, e.g. my belief about your belief about my goals, which forms a  "Theory of Mind".

The "Theory of Mind" capacity enables the agents to reason about others when making their own decision, and thus makes them "social characters". To make the agents’ behaviors more human-like and socially aware, Thespian models social normative behaviors and emotion. By default, Thespian agents act following norms, unless they have other more impressing goals.

When deciding what to do, a bounded lookahead policy is used by the agents. They project limited steps into the future, considering not only their own actions, but also other characters’ responses using their mental models of other characters, and its responses in return. The agents choose the action that receives the highest expected reward to proceed. Thus, they act both true to their motivations and in reaction to the status of the interaction.

For example, in the scenario shown above, the wolf will react to Red differently depending on whether there is somebody else close by, and who is that. The wolf will choose different actions when the hunter is near and when the woodcutter is near, because the wolf has different mental models about these two characters.

The user is also modeled using a Thespian agent based on the character whom the user takes the role of. In modeling the user, not only the goals of the user’s character are considered, but also the goals associated with game play. This model allows other agents to form mental models about the user the same way as about other characters and the director agent to reason about the user’s beliefs and experience.

Plot Design

Thespian provides a proactive directorial control approach, which coordinates the agent’s behaviors without breaking their motivations for reaching the author’s desired affects. Its director agent projects into the future for detecting potential violations of the author’s directorial goals, which is expressed as partial order or temporal constraints on key events in the story. An event can be either an action from a character or a state of a character including the user. An example of directorial goal is given below.

orders = [[“Wolf knows Granny’s location”, “Wolf eats Granny”], [“Wolf eats Granny”, “Wolf eats Red”]]

earlierThan = [“Wolf knows Granny’s location”, 10]

laterThan2 = [“Wolf knows Granny’s location”, 10, “Wolf eats Granny”]

earlierThan2 = [“Wolf eats Granny”, 3, “Wolf eats Red”]

If the director agent detects a potential violation, it explores alternative methods for tweaking the characters’ behavior and to reach the directorial goals. The director agent takes a least commitment approach to coordinating the agent-characters. During the interaction, the director agent maintains a space of character configurations consistent with the characters’ prior behavior. Each of these configurations is equally valid in the sense that they will all drive the character to act in exactly the same way up to the current point of the interaction. When a future violation of the plot design is predicted by the director, it constrains that space so that the rest of the configurations will drive the agent to act in a way that eliminates the violation. In this way, from the user’s perspective the characters are always well-motivated and the user can interact freely with them.

Example Scene in Thespian Si November 2009

Please follow the link below to see some example scenes. Output from Thespian are dialogue acts in text formats. In these example stories, a Java applet is used to convert the dialogues acts into surface sentences and show matching pictures.

Currently, the specification of directorial control goals are defined using the format shown in the example above. For authoring agents, Thespian provides 3 alternative approaches: a GUI, a spreadsheet approach or specification in a Python format. Note the GUI and spreadsheet approaches have both been used by non-technical users to create agents,. We start by discussing the third approach first.

Authoring Interface I:

For authors who are comfortable writing codes, the agents can be directly coded. For example, following is a definition of an agent, including its horizon and depth of reasoning, actions, state features, goals and beliefs.

classHierarchy['NormAgent'] = {
   ‘actions’: {’type’:'XOR’,
                 'base': {'type':'XOR',
                {'entity':    ['self'],
                                  ‘direction’: ‘max’,
                                  ‘type’:      ’state’,
                                  ‘key’:   ‘init-norm’,
                                  ‘weight’:    .5},

                 {’entity’:  ['self'],


Authoring Interface II:

Alternatively, the author can use a graphic interface for defining the agents.

All the components defined in the above example can be inputted through this interface.



Authoring Interface III:

Finally, project specific format for text input can be defined. Part of the agent modeling is done within Thespian (in the code that supports the interpretation of the text input), the author only need to change a few parameters for defining the agents.For example, below is a text file that define two agents who negociate with each other. The two agents have differnt goals in terms of how much they care about themselves vs. care about the other person’s experience. They may also have different beliefs about the other person’s goals.


To further faciliatate authoring, Thespian can simulate potential users’ behaviors and generate all the potential interaction paths.

An additional program is developped in Unity game engine to help the author view and edit the paths, as well as supply surface sentencs to the dialogue acts.