Architecture Overview


Play Architecture

The program architecture is object-oriented, allowing plays to be created and modified quickly and easily by changing or recombining their components. A play is made up of:

A room comprises an area of certain dimensions within which the action of the play occurs. Points of interest in the room (including the characters) are defined as props, with an identifying type and a position within the room. These props can be used to define the characters' goals and actions. All goals in the play are physically based and are represented by the prop that is the focus of the character's attention.

A character inherits all the characteristics of a prop because it is physically situated in the room and can be a goal. In addition, a character has an internal state that holds information about its and the other character's past behaviors and actions, its current and primary goals, and its inner obstacles. Each character has a primary goal that is constant throughout the play. It provides the character's motivation, affecting its inner obstacles. However, characters may have multiple current goals at any time during the play that it uses to evaluate potential actions. Sometimes the primary goal may not even be one of the character's current goals.

The inner obstacles can be thought of as the emotional basis of the architecture. Instead of realistically modeling how emotions work, we attempted to develop a flexible mechanism to specify the factors that inhibit certain behaviors and encourage others. We began by defining inner obstacles for the characters as a set of basic emotions that we thought were relevant. Frustration relates to how well the character thinks it is doing at achieving its goal. Fear, empathy, and boredom relate to how the character interacts with the other character. Later, we added the more abstract notions of extroversion and trust to allow for a wider array of behavior. The inner obstacles we chose to define for this play are by no means the only ones that can be used. In more complex plays, the hero may have inner obstacles that the villain does not, and vice versa. The inner obstacles contain information about how characters are affectednot only by the other character's and their own actions and behaviors, but also by the changes in the results of their success functions for their primary goals. These two ways of affecting the inner obstacle are kept distinct so that either one may be preserved or overridden when the inner obstacle is used in different plays. In addition to these effects, all inner obstacles have an equilibrium value that they decay back toward at a scaleable rate. By specifying the equilibrium values and decay rates for a character's inner obstacles, we defined the character's personality. A character is created with default inner obstacle values. Or another set of initial values, equilibrium values, and decay rates can be loaded for a character at run-time. The same character will behave differently depending on which personality it has loaded.

Each character has a list of behaviors that it chooses among when performing the play. A behavior defines the character's current goals, what dialog it can select from, and what actions are available to it. Each behavior has an ideal inner obstacle state representing the inner obstacle values that would cause this behavior to be performed. A behavior can be thought of as a way of acting that is appropriate to the inner obstacles associated with it. If a character is very frustrated, it chooses a different behavior than if it is very empathetic. The behavior restricts the available actions to those that make sense in terms of its goals and inner obstacle state. If the hero is distracted toward the painting, the option of going toward the door should not be available to him--even though that's the option that is best in terms of his primary goal of getting out of the room. Frustration, affected by the unchanging or decreasing success function values for the primary goal, gradually increases until it or another changing inner obstacle value makes a different behavior the most appropriate.

The actions are discrete movements that are performed along with the dialog. An action is always defined in terms of a goal, in keeping with the goal-oriented structure of the play. The actions associated with a behavior can have goals other than the behavior's goals. Even if a character's goals are the door and the painting, it can have the option of going toward its opponent if the action is appropriate to the behavior.

The success functions encode the characters' goals and evaluate how well they are accomplishing the goals at any point during the performance. The success functions take a goal or list of goals and the physical state of the room as input and return a real value between 0 and 1 that represents the level of accomplishment of the goals. The success functions specify what the characters are trying to accomplish in relation to those goals and are defined independently for each character (allowing for conflicting goals). For example, both the hero and villain in the play have the door to the room as the primary goal. The hero's success function returns a numeric evaluation of how well the hero is accomplishing the task of going toward the door without being blocked by the villain. But the villain's success function returns a numeric evaluation of how well the villain is doing at blocking the hero's path to the door.

Execution Loop

While performing a play, each character selects a behavior and an action in one turn. A turn begins with the character receiving a message from the other character. The message tells the character what behavior and action were performed, the other character's new position, and the keywords that are associated with the line of dialog chosen. The character uses this information to update its internal state and inner obstacles.

However, certain behaviors may require an emotional response that is more dramatic and immediate. These behaviors can be thought of as triggers that attempt to create a particular response in the other character, sometimes to divert its current goals from its primary goal. If the last behavior is a trigger, the inner obstacles that are relevant are checked to see if the character is responsive to this trigger. If the character is in a responsive state, then its inner obstacles are updated to match the ideal inner obstacle state of the response behavior, and it chooses that behavior. For example, the villain may try to distract the hero to the painting, but the hero does not respond by becoming distracted unless he trusts and likes the villain. Once a triggering behavior has produced its desired response, its repeated use only has standard effects like any other behavior while the response behavior continues. This rule gives the inner obstacles a chance to change in response to the situation or decay into a different state.

If a responding behavior isn't triggered, all of the available behaviors are searched through and the one with an ideal inner obstacle state closest to the character's inner obstacle state is chosen.

Once the behavior has been chosen, the goals associated with it become the character's current goals. The character then searches the available actions, simulating each action and evaluating its result with the success function to choose the most successful action in terms of the current goals.

The keywords received from the other character are used to choose an appropriate line of dialog from the lines available to the behavior. Then the dialog and the action are performed, and a message is sent to the other character, signifying the start of their turn.

[BACK]
Last modified: Tue Aug 31 14:25:03 EDT 1999