Download Planning Algorithms for Interactive Storytelling

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

History of artificial intelligence wikipedia , lookup

Multi-armed bandit wikipedia , lookup

Pattern recognition wikipedia , lookup

Genetic algorithm wikipedia , lookup

Wizard of Oz experiment wikipedia , lookup

Transcript
Planning Algorithms for Interactive Storytelling
LEANDRO MOTTA BARROS AND SORAIA RAUPP MUSSE
Universidade do Vale do Rio dos Sinos, Brazil
Interactive storytelling (IS) is an important research topic in the broader area of interactive digital
entertainment. Research in IS focuses in the search for techniques that allow the creation of systems that can
generate stories that change as a consequence of a player's actions. There have been numerous articles
attempting to reach this goal by employing a planning algorithm as part of the solution, but they typically do not
discuss in detail why a given planning algorithm was used. Given this reality, this article makes two main
contributions. First, it proposes an initial set of criteria that can be used to evaluate how well a given planning
algorithm fits IS systems. Second, on the basis of these criteria, it presents an analysis using available planning
systems.
Categories and Subject Descriptors: I.2.1 [Artificial Intelligence]: Applications and Expert Systems—Games;
I.2.8 [Artificial Intelligence]: Problem Solving, Control Methods, and Search—Plan execution, formation, and
generation; K.8.0 [Personal Computing]: General—Games
General Terms: Algorithms, Experimentation
Additional Key Words and Phrases: Interactive storytelling, STRIPS-like planning systems
ACM Reference Format:
Barros, L.M., and Musse, S.R. 2007. Planning algorithms for interactive storytelling. ACM Compt. Entertaint.
5, 1, Article 4 (January 2007), 14 Pages. DOI= DOI 10.1145/1219124.1219128 http://doi.acm.org/10.1145/
1219124.1219128
1. INTRODUCTION
In the last few years, interactive storytelling (IS) has consolidated as an important
research topic in the broader area of interactive digital entertainment. Unlike typical
computer games, IS systems focus on narratives, and as a result of the players'
interactions the systems are expected to produce consistent stories. Given that IS is storycentered, work in this area must concern itself with computer models of stories. And, as
we will describe later in this article, it turns out that plans are a very good model for
stories. This explains why the use of planning systems with story-related applications
works. The correspondence between stories and plans has been explored long before in
the early, noninteractive story-generating systems like UNIVERSE [Lebowitz 1985].
More recently, this correspondence has made the planning-based approach the most
common one among IS researchers [Cavazza and Charles 2005].
Although planning systems have been used as an important part of several published
IS prototypes (e.g., Charles et al. [2003], Riedl et al. [2003], Ciarlini et al.[2005]), there
has not been much discussion about the needs of IS researchers with respect to planning
algorithms: descriptions of the prototypes are usually very brief when justifying the
choice of a given planning algorithm. In particular, there is no discussion of the specific
_________________________________________________________________________________________
This work is supported by the National Council for Scientific and Technological Development (CNPq - Brazil).
Authors' addresses: L. M. Barros and S. R. Musse. Universidade do Vale do Rio dos Sinos, Programa
Interdisciplinar de Pós-Graduação em Computação Aplicada. Avenida Unisinos, 950. 93.022-000. São
Leopoldo, RS, Brazil. [email protected], [email protected].
Permission to make digital/hard copy of part of this work for personal or classroom use is granted without fee
provided that the copies are not made or distributed for profit or commercial advantage, the copyright notice,
the title of the publication, and its date of appear, and notice is given that copying is by permission of the ACM,
Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific
permission and/or a fee. Permission may be requested from the Publications Dept., ACM, Inc., 2 Penn Plaza,
New York, NY 11201-0701, USA, fax: +1 (212) 869-0481, [email protected]
© 2007 ACM 1544-3574/07/0100-ART4 $5.00 DOI 10.1145/1219124.1219128 http://doi.acm.org/10.1145/
1219124.1219128
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
2
●
L.M. Barros and S.R. Musse
requirements necessary for planning or comparisons of the various alternatives in order to
find the most appropriate one for the problem. This article intends to be a first step
towards identifying and documenting these requirements and evaluating how well several
available planning algorithms suit them. We have narrowed our study to STRIPS-like
planning systems, that is, to those planning algorithms that work with actions described
as prerequisites and effects.In the following section we describe the role of planning
systems in IS applications and why they are appropriate for this task. Next, in Section 3,
we propose a set of criteria that can be used to evaluate planning algorithms from an IS
standpoint. The main hypothesis is that the criteria are appropriate for evaluating how
good a planning algorithm is for IS applications. Then, in Section 4, based on this
hypothesis, we present a study of various available planning algorithms; some final
remarks conclude the article.
2. PLANNING FOR INTERACTIVE STORYTELLING
As stated in the Introduction, the use of planning systems has become the most common
approach taken by IS researchers. There are reasons why this is so, which we will discuss
in this section. More specifically, we will present the role of planning systems in IS and
discuss why planning is well-suited for IS applications.
Since IS is narrative-centered, modeling and representing narratives are key issues.
Hence IS researchers often build on narratology studies, like the one by Bal [1998], who
decomposes narratives into three levels. The lowest level is called “fabula”, and is
defined as “a series of logically and chronologically related events.” Fortuitously, a plan
(a series of actions that allows us to achieve a goal) is a good model of the fabula.
Other definitions of a story exist as well, but they share the same basic concept that a
story is “a sequence of actions related through some form of causality” [Charles et al.
2003]. Again, the correspondence to planning algorithms, which operate on the basis of
causal relationships between actions, is clear.
Further, planning algorithms are appropriate for IS applications because plans are
composed of discrete operations, so that stories can easily be converted to computer
graphics-based output (e.g., by making animated characters in the virtual environment
dramatize the actions which make up the plan) [Riedl and Young 2003].
Keeping the relation between plans and stories in mind, the role of a planning system
in an IS application becomes clear: it is to define the actions or events that must occur
during the story so that the world changes from its initial state to some goal state.1
But despite the similarities between plans and stories, it is important to note that there
are at least two issues regarding the use of planning systems that were originally
developed for typical artificial intelligence problems. The first is interactivity: IS
systems are interactive, which means that the player is able to execute actions that change
the world state while a plan is being executed. This may cause problems that must be
dealt with (and whose possible solutions are beyond the scope of this article). The second
issue is that not every plan that can transform the world to the desired state is a good
story. Indeed, classical AI measures the quality of a plan by using very rigorously defined
criteria like plan-length, while measuring the quality of a story is a much more subjective
task (unfortunately, there are no widely accepted metrics for this).
Where these issues should be addressed is an interesting question. In this article we
are dealing with general-purpose planning algorithms, that is, algorithms that were not
created with IS applications in mind. Thus, when these algorithms are used, the narrative
1
This goal state is usually defined by a human author.
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
Planning Algorithms for Interactive Storytelling
●
3
aspects at the core of IS must be addressed by other parts of the application. That is,
resolving the differences between stories and plans is not a responsibility of the planning
algorithm per se, but of how it is used by the IS application. Of course, different planning
systems have different features, and it can be said that a good planning system for IS is
one that helps to generate plans that represent good stories. Put another way, a good
planning algorithm for IS makes it easier for the application to use it to resolve the
differences between plans and stories.
3. EVALUATING PLANNING ALGORITHMS
When justifying a choice for a selected planning system, descriptions of IS prototypes
based on planning systems are usually very brief. In fact, we found almost no discussion
on this subject in the literature. In the following, we propose strategies that can be used to
evaluate planning systems from an IS standpoint, which we selected on the basis of our
own experience. However, we believe that most of them are more generally applicable
and valid for most IS work. In the spirit of the discussion at the end of the previous
section, the aspects presented here correspond to features that can be explored by an IS
application to produce plans that represent better stories.
Support for extra language requirements. All STRIPS-like planners share important
characteristics on how a planning problem has to be described. In fact, this similarity
goes down to a syntactic level, since most of the more recent implementations of
planning systems have adopted PDDL as their input language [Edelkamp and Hoffmann
2004].2 However, PDDL was designed as a “modular language,” so that planners are only
required to implement a very basic set of features, but are allowed to support extra
requirements. Every extra requirement supported by a planner either adds expressive
power to the input language, or eases the task of describing certain actions. Both are
desirable for IS applications: more expressive power enables the creation of more
interesting actions from a storytelling point of view, and making the description of
actions easier to write stimulates experimentation (which ultimately leads to better
stories).
We consider the following five language constructs of particular interest for IS
applications:
(1) Type hierarchies (PDDL’s typing requirement). Languages that require a
typed declaration of every object and typed parameter lists are less error-prone
during the process of creating actions. The benefit of type hierarchies (or subtyping)
is demonstrated by the following example. It is usually desirable to have the
predicate at (what,where) to represent the location of characters and props in
the virtual environment. With subtyping support, the what parameter can be
declared as being of a type like placeable-thing, and the types character
and prop can be made subtypes of placeable-thing. Without support for type
hierarchies, two versions of the at predicate would be necessary, one for each of
the possible types of the what parameter.
(2) Built-in equality operator (PDDL's equality requirement). It is frequently
necessary to compare constants and variables for equality. In our work we have seen
that an equality operator is particularly useful when conditional effects (discussed
below) are used: for example, a given effect is used only when the action is
2
PDDL, the Planning Domain Description Language, was created to simplify the evaluation of competitors
in the International Planning Competition.
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
4
●
L.M. Barros and S.R. Musse
performed on a certain character. Another common use of the equality operator (in
conjunction with negative preconditions) is to ensure that two action parameters are
bound to distinct objects. This is illustrated in Figure 1, in which the precondition
(not (= ?giver ?receiver)) is used to ensure that a character cannot give
a present to himself.
(3) Negative preconditions (PDDL's negative-preconditions requirement). As
discussed above, negative preconditions are useful when used together with the
equality operator. However, their utility goes beyond this: they may, for example, be
used with conditional effects to allow a character to behave differently when he
does not know some important information ((not(knows ?some-character
some-information))).
(4) Conditional effects (PDDL's conditional-effects requirement). The effects of
actions in IS frequently depend on some condition, which is exactly what
conditional effects are for. Figure 1 shows an actual example: according to our
materialistic definition of the GivePresent action, the receiver of a present will
become friendly with the giver only if he likes the present he gets.
(5) Existential preconditions (PDDL's existential-preconditions requirement).
Being able to utilize existential quantifiers in preconditions opens interesting
possibilities. In Figure 2, we define an ExaminePlace action that is used by a
character who wants to look for clues to solve a crime. Using an existential
quantifier in the precondition, we are able to state that the examiner character can
only perform this action if he is alone in the examined place. The action
GivePresent (Figure 1) also uses an existential quantifier, in this case to ensure
that both the giver and the receiver are in the same place.
Capability to generate partial-order plans. Total-order plans are simple sequences of
actions, without any sort of parallelism. In an IS context, these actions represent story
events, like actions performed by characters. But it may be desirable to have actions
occur simultaneously in a story; this kind of parallelism is provided by partial-order
plans. It may be beneficial to explore partial-order plans even if the goals of a given IS
model require a strictly sequential plan. Since different total-order plans can be extracted
from a single partial-order plan, a partial-order planning algorithm can be used to find
alternatives for the same set of events (this idea has been investigated in Ciarlini et al.
[2005]).
(:action GivePresent
:parameters (?giver ?receiver - character ?present - thing)
:precondition (and (not (= ?giver ?receiver))
(has ?giver ?present)
(exists (?p - place)
(and (at ?giver ?p)
(at ?receiver ?p))))
:effect (and (not (has ?giver ?present))
(has ?receiver ?present)
(when (likes ?receiver ?present)
(friendly-to ?receiver ?giver))))
Fig. 1. An action written in PDDL. Most extra language requirements in Section 3 are used here.
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
Planning Algorithms for Interactive Storytelling
●
5
(:action ExaminePlace
:parameters (?examiner - character ?where - place)
:precondition (and (at ?examiner ?where)
(not (exists (?c - character)
(and (not (= ?c ?examiner))
(at ?c ?where)))))
:effect (and (when (= ?where tughs-cave)
(has ?examiner tughs-ticket))
(when (= ?where zonks-cave)
(knows ?examiner zonks-cave-has-wet-paint))))
Fig.2. Another action written in PDDL. An existentially quantified precondition is used to ensure that the
examiner cannot perform the action unless he is alone at his location.
Optimality. Optimal planning algorithms are guaranteed to produce the best possible
plans. A nonoptimal plan will typically introduce irrelevant events that do not advance
the story towards its goal. Up to a point, this would not cause any serious problems: a few
“extra” events will not significantly degrade the player's interest in the story. Highly
nonoptimal plans, however, may produce unintelligent characters, which is most
undesirable. So while optimality is not a strict requirement for a planning algorithm in an
IS system, algorithms that are “too nonoptimal” are best avoided.
We emphasize that care must be taken when discussing optimality from an IS
perspective. Optimality depends on the metric used to evaluate the quality of a plan, and,
depending on the metric, optimality can be misleading. For example, for partial-order
planners, a common metric is the number of “parallel steps” necessary to solve a
problem, regardless of the total number of actions in the plan. With this metric, a plan
including unnecessary actions (to the point of causing unintelligent character behavior)
can still be considered optimal (see, e.g., the description of the SatPlan planning system
in Section 3).
Support for actions with costs. Even nonoptimal planning algorithms strive to
generate plans of higher quality, that is, plans that perform better according to some
metric. Many algorithms have a fixed metric, based on the number of actions executed.
For example, some planners consider that the fewer the number of actions, the better the
plan. Other planning systems allow a different cost for each action, such that the
algorithm will privilege the actions with lower costs. In previous work on an IS
application we successfully explored actions with different costs [Barros and Musse
2005], and we believe that this subject deserves further study. Hence, a planning
algorithm that can support actions with costs provides a valuable attribute.
Efficiency. Since IS involves interactivity, plans usually have to be generated while
the system is running (for example, it may be necessary to create a new plan because the
player has executed an action that made the previous plan invalid); hence the preference
for faster planning algorithms. More efficient planning systems also allow us to create
longer stories, with more characters and objects.
Domain knowledge. Some planners are totally automatic, that is, they only require a
description of the planning problem to produce a plan. For better performance, other
planners require “domain knowledge” as well, that is, information that is specific to the
problem being solved. In the first version of Fabulator, our IS prototype [Barros and
Musse 2005], we simply treated the planning problem as a search in the space of world
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
6
●
L.M. Barros and S.R. Musse
states and used A* to solve the search problem [Russell and Norvig 2002]. A* requires
domain knowledge in the form of a heuristic function, which discouraged
experimentation, since changing the story required us to change the heuristic function
accordingly. Given this fact, we prefer algorithms that do not need domain knowledge.
Support for numeric variables. Classic planning systems represent the world state as a
conjunction of boolean predicates. This can be a limiting factor for IS, since many
interesting stories contain aspects that are not boolean in nature. The “purely boolean
thinking” that dominates some IS work has already suffered criticism [Crawford 2004].
Some newer planning systems allow use of numeric variables (in addition to boolean
ones) to describe the world state, making it possible to go beyond rigid true or false
conditions and to add some nuance to stories. Numeric variables have already been used
successfully in some IS work (e.g., Ciarlini et al. [2005]); so algorithms that support their
use are advantageous.
We finish this section by observing that the evaluation of planning algorithms in this
article does not include any interactive tests to evaluate user experience. This is certainly
worth exploring in future work, since positive user experience is one of the most
important goals in IS. We believe that such tests must be done very carefully because, as
we suggest in Section 2, the way an algorithm is used is at least as important as the
algorithm itself.
4. ANALYZING PLANNING ALGORITHMS
In this section we present an analysis of several planning algorithms. For the analysis, we
selected a set of planning systems that could properly solve our test problem and had
available implementations. The test problem was the first act of Ugh's Story (included as
Table I. Summary of Algorithms
Algorithm
TH
EO
NP
CE
EP
Opt
POP
AC
NV
Time
FF
0.015 s
Graphplan
0.138 s
HSP
0.031 s
HSP*
IPP
3.641 – 7.25 s (1)
(2)
0.106 / 0.032 s (3)
LPG-TD
0.680 / 0.169 s (4)
Marvin
0.017 s
Metric-FF
(5)
0.059 / 0.018 s (4)
SatPlan_2004
0.247 – 0.512 s
STAN 4
0.093 s
TLplan
(6)
(7)
Abbreviations: Type hierarchies (TH); equality operator (EO); negative preconditions (NP); conditional
effects (CE); existential preconditions (EP); optimal (Opt); partial-order planner (POP); action costs (AC);
numeric variables (NV); Time to solve test problem (Time). Notes: (1) The hspb variant took considerably more
time (4 min). (2) Can be optimal or not, depending on how it is configured. (3) First time is for optimal
configuration; second time for nonoptimal configuration. (4) First time with numeric variables; second time
without numeric variables.. (5) Not explicitly supported, but can be easily emulated. (6) Optimal as long as an
appropriate control formula is used. (7) We could not create a usable control formula for our test problem, so
timing could not be assessed.
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
Planning Algorithms for Interactive Storytelling
●
7
an appendix), originally described in Barros and Musse [2005]. Since most algorithms
tested could not handle all the language features used to create Ugh's Story, it had to be
“ported” for each algorithm. The porting process included tasks like manually defining an
eq predicate for algorithms without a built-in equality operator and factoring actions with
conditional effects into two or more different actions when necessary.
To evaluate performance, we measured the times to solve the test problem in a computer
with a Pentium 4 hyper-threaded processor at 2.8 GHz and 512 MB of RAM. All times
reported are an average of three runs. The analysis of the planning algorithms is
summarized in Table I.
Graphplan [Blum and Furst 1997] was the first planning algorithm to convert the
planning problem into an intermediary data structure called a planning graph. It obtained
impressive gains in performance compared to previous planning approaches. Graphplan
is an optimal and partial-order planner, but its input language is quite limited - none of
the extra requirements described in Section 3 is supported. It solved our test planning
problem in 0.138 seconds.
Planning graphs have been used in other subsequent efforts, for instance in the
interference progression planner (IPP) [Koehler et al. 1997], which started as an
extension of Graphplan with an improved input language (all the extra language
requirements mentioned in this article are supported by it). IPP is still a partial-order
planner, but may not be optimal, depending on how it is configured.3 The test problem
was solved in an average of 0.106 seconds when IPP was configured to run optimally,
and 0.032 seconds when it was not.
The SatPlan planner [Kautz and Selman 1992] is based on a different idea, that is, the
transformation of a planning problem into a satisfiability problem which can be solved
with different solvers. SatPlan_2004, the tested version of SatPlan, actually combines the
“planning as satisfiability” approach with planning graphs. The input language accepted
by SatPlan_2004 is quite limited: it supports only type hierarchies from our list of
desirable features. On the positive side, this planning system is capable of generating
partial-order plans and is optimal (but see the discussion below). SatPlan’s efficiency
depends on the solver used to solve the satisfiability problem. We tested three solvers; the
times to solve our test problem were 0.457 seconds with jerusat1.3; 0.512 seconds
with satz-rand; and 0.247 seconds with siege.
SatPlan is a good example of a point we made in Section 3 when discussing
optimality: while SatPlan is technically optimal, its optimality criterion is the number of
parallel steps needed to solve the problem, and unfortunately the plan includes some
unnecessary actions. The jerusat1.3 solver was particularly problematic in this
regard, since it produced noticeably unintelligent character behavior.
Local search for planning graphs (LPG) is another algorithm that follows the same
principle (i.e., combining the planning graph and the planning as satisfiability
approaches) [Gerevini and Serina 2002]. With the exception of conditional effects, all
extra language requirements discussed previously are supported. Furthermore, LPG
generates partial-order plans and supports action costs and numeric variables; but it is not
optimal. We had problems using the LPG implementation with our test problem, so we
used LPG-TD [Gerevini et al. 2004], a version of LPG with additional features that were
not used in this experiment. It solved the test problem in 0.680 seconds when numeric
variables were used, and 0.169 seconds when they were not.
3
IPP can be run with an option called RIFO (removing irrelevant facts and operators) that gives up of
optimality in exchange for better performance.
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
8
●
L.M. Barros and S.R. Musse
A third approach to planning was introduced by the “Heuristic Search Planner”
(HSP) [Bonet and Geffner 2001]. It treats planning as search, using a domainindependent heuristic to direct the process. It is a total-order, nonoptimal planner. HSP's
input language supports type hierarchies and has a built-in equality operator, but lacks all
other features discussed before. The test problem was solved in 0.031 seconds. It is also
worth mentioning that HSP has already been successfully used in IS [Charles et al. 2003].
There was research to find admissible heuristics for HSP which led to the
development of HSP* [Geffner 2000], a family of optimal planners. Besides being
optimal, HSP* introduces other important improvements over standard HSP, namely
support for negative preconditions, partial-order plans, actions with costs, and numeric
variables. However, times for solving the test problem were considerably higher than for
HSP: 3.641 seconds (for the hsp0 variant); 3.642 seconds (hspa); 247.71 seconds (hspb);
7.25 seconds (hspc); and 3.65 seconds (hspd).
A fourth approach to planning was introduced with TLplan [Bacchus and Kabanza
2000]. It is based on a forward-chaining search, but uses user-supplied domain
knowledge (encoded as a “control formula” in a temporal logic) to prune the state space
and achieve a better performance. This is the only one of the tested algorithms that
requires domain-specific knowledge, which we found a major problem for its application
in IS. Indeed, we were not able to create domain knowledge that was good enough to
solve our test problem in a reasonable amount of time.
We must admit that we are not familiar with the formalism used by TLplan to express
domain knowledge (temporal logic); but it seems that it is much easier to use it for typical
AI problems like the classic Blocks World problem, whose solution is presented
in Bacchus and Kabanza [2000]. We found that for IS planning problems it is very
difficult to identify situations that can be pruned.
It may be worthwhile to explore the use of TLplan in IS further, since it’s
performance is impressive and it is one of the most feature-full algorithms tested: its
input language is very expressive, it supports numeric variables, actions with costs, and
(with an appropriate control formula) is optimal.
The remaining algorithms discussed here combine aspects of the various approaches
described above. For instance, Fast Forward (FF) [Hoffmann and Nebel 2001] was
created by mixing some novel ideas with features of HSP, Graphplan, and IPP. This
algorithm is nonoptimal, produces total-order plans, and its input language supports all
extra requirements described in Section 3. It cannot, however, handle numeric variables
and actions with costs. FF was the quickest planner to solve the test problem, taking, on
average, just 0.015 seconds.
Some extensions were proposed for FF: one is Metric-FF [Hoffmann 2003], which
provides support for numeric variables. Additionally, while actions with costs are not
supported explicitly, they can be easily “emulated” with numeric variables, since MetricFF allows for the definition of an optimality metric (a function of numeric variables that
can be maximized or minimized). Of course, these new features increased running time:
this planning system took 0.059 seconds to solve the test problem when some numeric
variables were added. Without using numeric variables, running time was 0.018 seconds.
The algorithm called “Macro-Actions from Reduced Versions of Instance”
(MARVIN) [Coles and Smith 2004] is also based on FF, from which it took its search
strategy. This algorithm introduces a preprocessing step during which a reduced version
of the input problem is automatically extracted and solved. Afterward, this “intermediate”
solution is used to help in the search for the final solution. MARVIN supports the same
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
Planning Algorithms for Interactive Storytelling
●
9
input language as FF, but it is capable of generating partial-order plans. The test problem
was solved in 0.017 seconds.
The last algorithm in this analysis, STAN 4 (or hybrid STAN) [Fox and Long 2001],
starts from the observation that although planning in general is a difficult task, planning
problems featuring certain characteristics can be solved efficiently using special
algorithms. So the system starts by analyzing the problem. If it is recognized as a
problem for which a specific algorithm is available, that specific algorithm is used instead
of a general planner. STAN does not support any of the extra language requirements
described in Section 3. It generates partial-order plans and solved our test problem in
0.093 seconds.
Looking at the results of this analysis, we can see that no algorithm combines all the
desired characteristics discussed in Section 3. Hence we can conclude (not surprisingly)
that there is no planning algorithm that is the ideal choice for all IS work. So researchers
must consider what the most important characteristics of their work are and select the
most appropriate planning system on that basis.
In our work, for instance, we are particularly interested in exploring the possible
benefits of having actions with different costs and dynamically modifying the costs of
actions as the story progresses; support for actions with costs is a primary necessity for
us. We also feel that being able to easily express our ideas and to experiment while
creating content for our prototype application will lead to better results, hence algorithms
that support a large number of extra requirements (Section 3) are ideal for our needs.
Given these two requirements, we can say that Metric-FF is the best choice for us, since it
supports all the extra requirements discussed in this article and allows the easy
“emulation” of actions with costs by using user-defined metrics for plan quality. MetricFF performed better in our test problem than other algorithms with similar features (like
LPG). It also supports numeric variables, a feature we would like to explore in the future.
We repeat that different projects with different requirements will lead to different
conclusions as to what constitutes the best planning system.
5. DISCUSSION
This article presents a discussion and an analysis of planning algorithms from an IS
standpoint. The hypothesis (i.e., the criteria for evaluating algorithms) and analysis are
the article’s main contributions. We believe they can be a first step towards a deeper
discussion on the use of planning algorithms in IS.
As we mentioned in the previous section, every IS work has its own goals, and thus a
different planning algorithm may be the best solution for each particular case. Since
different planning systems are being improved in different aspects, we do not expect this
to change soon. Nonetheless, we believe that it is interesting to discuss those aspects in
which current planning systems can be improved in order to better serve IS applications.
First, as we have already stressed, augmenting the expressive power of the language
used to describe actions, or even simply easing the task of writing actions, enables the
creation of better content for IS, and makes improvements in this direction very desirable.
A more fundamental way in which planning systems can be improved from an IS
point of view is to endow them with capabilities to represent the nuances and subtleties
necessary for good stories. As we suggest in Section 3, many important aspects of stories
cannot be properly represented as boolean predicates. A common example is the
relationship among characters: the “trust” relation between two people, for instance, is
not a simple “true or false relation,” since people trust other people to varying degrees.
Support for numeric variables in newer planning algorithms is a first step in resolving this
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
10
●
L.M. Barros and S.R. Musse
problem; but it is plausible to suppose that any new feature that allows a planning system
to go beyond strictly boolean reasoning can be beneficial to IS.
Improvements in performance are also certainly welcome. In this regard, it would be
interesting to perform a deeper (and lower-level) analysis on how planning algorithms are
used in different IS projects, which could lead to the identification of subproblems
common to IS-related planning domains and to further improvements in performance.
Recall that identifying common subproblems and employing dedicated algorithms to
solve them is an idea already explored by the STAN planning system [Fox and Long
2001] in Section 4.
Finally, while we expect improvements in future planning algorithms, we recognize
that current state of the art planners already support features that we have not explored in
this article. Of particular interest are features such as planning with resources, durative
actions, derived predicates, and maximization and minimization of user-defined quality
metrics.
APPENDIX
This appendix presents the PDDL definition of the problem for testing the planning
algorithms mentioned in this article. As discussed in Section 4, not every algorithm
supports all the language features in this definition, so that in those instances adaptations
had to be made. Due to space constraints, the adapted versions are not included here.
The planning domain is defined as follows:
(define (domain ughs-story)
(:requirements :strips :typing :equality :conditional-effects
:existential-preconditions :negative-preconditions)
(:types place information movable-stuff - object
thing character - movable-stuff)
(:constants ugh tugh zonk - character
ughs-cave tughs-cave zonks-cave altar volcano beach garden-place
statue zonks-card tughs-ticket club strawberry fish - thing
statue-was-stolen tugh-sold-his-mother zonks-cave-has-wet-paint
zonk-is-iconoclast club-has-paint-marks
tugh-painted-zonks-cave - information)
(:predicates (at ?what - movable-stuff ?where - place)
(has ?who - character ?what - thing)
(is-protagonist ?who - character)
(knows ?who - character ?what - information)
(likes ?who - character ?what - thing)
(friendly-to ?the-who ?the-friend - character)
(wont-give ?who - character ?what - thing)
(everybody-knows ?what - information)
(is-the-thief ?who - character))
(:action GoTo
:parameters (?who - character ?from ?to - place)
:precondition (and (at ?who ?from)
(not (= ?from ?to)))
:effect (and (at ?who ?to)
(not (at ?who ?from))))
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
Planning Algorithms for Interactive Storytelling
●
11
(:action Take
:parameters (?who - character ?what - thing ?where - place)
:precondition (and (at ?who ?where)
(at ?what ?where))
:effect (and (not (at ?what ?where))
(has ?who ?what)))
(:action TalkAbout
:parameters (?speaker ?listener - character ?topic information)
:precondition (and (friendly-to ?listener ?speaker)
(not (= ?speaker ?listener))
(knows ?speaker ?topic)
(exists (?p - place)
(and (at ?speaker ?p)
(at ?listener ?p))))
:effect (and (knows ?listener ?topic)
(when (and (= ?listener zonk)
(= ?topic zonks-cave-has-wet-paint))
(knows ?speaker tugh-painted-zonks-cave))
(when (and (= ?listener tugh)
(= ?topic zonks-cave-has-wet-paint)
(not (knows tugh club-has-paintmarks)))
(knows ?speaker tugh-painted-zonks-cave))))
(:action ImitateDinosaur
:parameters (?imitator ?spectator - character ?where - place)
:precondition (and (at ?imitator ?where)
(at ?spectator ?where)
(not (= ?imitator ?spectator)))
:effect (and (not (friendly-to ?spectator ?imitator))
(when (has ?spectator zonks-card)
(and (not (has ?spectator zonks-card))
(at zonks-card ?where)))))
(:action ExaminePlace
:parameters (?examiner - character ?where - place)
:precondition (and (at ?examiner ?where)
(not (exists (?c - character)
(and (not (= ?c ?examiner))
(at ?c ?where)))))
:effect (and (when (= ?where tughs-cave)
(has ?examiner tughs-ticket))
(when (= ?where zonks-cave)
(knows ?examiner zonks-cave-has-wetpaint))))
(:action ExamineThing
:parameters (?examiner - character ?what - thing)
:precondition (has ?examiner ?what)
:effect (and (when (= ?what tughs-ticket)
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
12
●
L.M. Barros and S.R. Musse
(knows ?examiner tugh-sold-his-mother))
(when (= ?what zonks-card)
(knows ?examiner zonk-is-iconoclast))
(when (= ?what club)
(knows ?examiner club-has-paint-marks))))
(:action GivePresent
:parameters (?giver ?receiver - character ?present - thing)
:precondition (and (not (wont-give ?giver ?present))
(not (= ?giver ?receiver))
(has ?giver ?present)
(exists (?p - place)
(and (at ?giver ?p)
(at ?receiver ?p))))
:effect (and (not (has ?giver ?present))
(has ?receiver ?present)
(when (likes ?receiver ?present)
(friendly-to ?receiver ?giver))))
(:action AssumeTheft
:parameters (?thief - character ?location - place ?stolen-thing
- thing)
:precondition (and (at ?thief ?location)
(is-the-thief ?thief)
(has ?thief ?stolen-thing))
:effect (at ?stolen-thing ?location)))
The problem definition is shown below.
(define (problem ughs-story-act1)
(:domain ughs-story)
(:init
(is-protagonist ugh)
(at ugh ughs-cave)
(at tugh tughs-cave)
(at zonk zonks-cave)
(at club altar)
(at strawberry garden)
(at fish beach)
(has tugh statue)
(has zonk zonks-card)
(knows ugh statue-was-stolen)
(likes zonk strawberry)
(friendly-to zonk ugh)
(friendly-to tugh ugh)
(wont-give tugh statue)
(wont-give tugh tughs-ticket)
(wont-give zonk zonks-card)
(is-the-thief tugh))
(:goal (and (knows ugh tugh-sold-his-mother)
(knows ugh zonk-is-iconoclast))))
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
Planning Algorithms for Interactive Storytelling
●
13
ACKNOWLEDGMENTS
We thank all the researchers who made the implementations of their planning algorithms
available.
REFERENCES
BACCHUS, F. AND KABANZA, F. 2000. Using temporal logics to express search control knowledge for
planning. Artificial Intell. 116, 1-2, 123-191.
BAL, M. 1998. Teoría de la Narrativa: una introducción a la narratología, 5th ed. Cátreda, Madrid.
BARROS, L. M. AND MUSSE, S. R. 2005. Introducing narrative principles into planning-based interactive
storytelling. In Proceedings of ACM SIGCHI International Conference on Advances in Computer
Entertainment Technology (ACE 2005, Valencia, Spain), S. Z. ZhiYing and L. S. Ping, eds. ACM, New
York, 35-42.
BLUM, A. AND FURST, M. 1997. Fast planning through planning graph analysis. Artificial Intell.90, 281-300.
BONET, B. AND GEFFNER, H. 2001. Planning as heuristic search. Artificial Intell. 1, 129, 5-33.
CAVAZZA, M. AND CHARLES, F. 2005. Dialogue generation in character-based interactive storytelling.
In Proceedings of the AAAI First Annual Artificial Intelligence and Interactive Digital Entertainment
Conference (AIIDE'05, Marina del Rey, CA). AAAI Press, Menlo Park, CA.
CHARLES, F., IBÁÑEZ, M. L., MEAD, S. J., BISQUERRA, A. F., AND CAVAZZA, M. 2003. Planning
formalisms and authoring in interactive storytelling. In Proceedings of TIDSE'03: Technologies for
Interactive Digital Storytelling and Entertainment, S. Göbel et al. eds. Fraunhofer IRB Verlag,
Darmstadt, Germany.
CIARLINI, A. E. M., POZZER, C. T., FURTADO, A. L., AND FEIJÓ, B. 2005. A logic-based tool for
interactive generation and dramatization of stories. In Proceedings of ACM SIGCHI International
Conference on Advances in Computer Entertainment Technology (ACE 2005, Valencia, Spain), S. Z.
ZhiYing and L. S. Ping, eds. ACM, New York, 133-140.
COLES, A. I. AND SMITH, A. J. 2004. Marvin: Macro-actions from reduced versions of the instance. In
Fourth International Planning Competition Booklet (IPS'04), ICAPS 2004.
CRAWFORD, C. 2004. Chris Crawford on Interactive Storytelling. New Riders Games, Indianapolis, IN.
EDELKAMP, S. AND HOFFMANN, J. 2004. PDDL2.2: The language for the classical part of the 4th
International Planning Competition. Tech. Rep. 195, Albert Ludwigs Univ. Inst. für Informatik, Freiburg,
Germany. Jan.
FOX, M. AND LONG, D. 2001. Hybrid STAN: Identifying and managing combinatorial optimisation subproblems in planning. In Proceedings of the 17th International Joint Conference on Artificial
Intelligence (IJCAI 01, Seattle, WA), B. Nebel, ed. Morgan Kaufmann, 445-452.
GEREVINI, A., SAETTI, A., SERINA, I., AND TONINELLI, P. 2004. Planning in PDDL2.2 domains with
LPG-TD. In Fourth International Planning Competition Booklet (IPS'04), ICAPS 2004.
GEREVINI, A. AND SERINA, I. 2002. LPG: a planner based on local search for planning graphs.
In Proceedings of the Sixth International Conference on Artificial Intelligence Planning and Scheduling
(AIPS'02, Toulouse, France). AAAI Press.
HASLUM, P. AND GEFFNER, H. 2000. Admissible heuristics for optimal planning. In Proceedings of the
Fifth International Conference on Artificial Intelligence Planning and Scheduling (AIPS 2000). 140149.
HOFFMANN, J. 2003. The Metric-FF planning system: Translating “ignoring delete lists” to numeric state
variables. J. Artificial Intell. Research 20, 291-341.
HOFFMANN, J. AND NEBEL, B. 2001. The FF planning system: Fast plan generation through heuristic
search. J. Artificial Intell. Research 14, 253-302.
KAUTZ, H. A. AND SELMAN, B. 1992. Planning as satisfiability. In Proceedings of the Tenth European
Conference on Artificial Intelligence (ECAI'92, Vienna), B. Neumann, ed. Wiley, New York, 359-363.
KOEHLER, J., NEBEL, B., HOFFMANN, J., AND DIMOPOULOS, Y. 1997. Extending planning graphs to an
ADL subset. In Recent Advances in AI Planning. Fourth European Conference on Planning (ECP'97,
Toulouse, France), Lecture Notes in Artificial Intelligence, 1348, S. Steel and R. Alami, eds. Springer,
New York, 273-285.
LEBOWITZ, M. 1985. Story-telling as planning and learning. Poetics 14, 483-502.
MATEAS, M. AND STERN, A. 2005. Structuring content in the Façade interactive drama architecture.
In Proceedings of the AAAI First Annual Artificial Intelligence and Interactive Digital Entertainment
Conference (AIIDE'05, Marina del Rey, CA). AAAI Press, Menlo Park, CA..
RIEDL, M. O., SARETTO, C. J., AND YOUNG, R. M. 2003. Managing interaction between users and agents
in a multi-agent storytelling environment. In Proceedings of AAMAS 2003: the Second International
Joint Conference on Autonomous Agents and Multi-Agent Systems (Melbourne). ACM New York.
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.
14
●
L.M. Barros and S.R. Musse
RIEDL, M. O. AND YOUNG, R. M. 2003. Character-focused narrative generation for execution in virtual
worlds. In Virtual Storytelling. Proceedings of ICVS 2003: International Conference on Virtual
Storytelling (Toulouse, France). Lecture Notes in Computer Science 2897. Springer, New York, 47-56.
RUSSELL, S. AND NORVIG, P. 2002. Artificial Intelligence: A Modern Approach, 2nd ed. Prentice Hall,
Englewood Cliffs, NJ.
Received June 2006; revised July 2006; accepted August 2006
ACM Computers in Entertainment, Vol. 5, No. 1, Article 4, Publication date: April 2007.