Professional Documents
Culture Documents
Branching Trees
EVERYBODY SEEMS TO MAKE the same mistake when they
The reason for the failure of the resulting game is easy to understand with a little 4. He accepted the quest and entered a nearby cave. There were two paths:
mathematics. Imagine the smallest, simplest possible structure. Each decision down one path he could hear water trickling; down the other he smelled
is a choice between just two options, and leads to a new situation with a new smoke. (Which path?)
binary choice. Thus, the first level of choice will have exactly 2 states; the second
5. He went down the path that smelled of smoke. There he saw a dragon sleep-
level will have 4 states, the third will have 8, the fourth 16, the fifth 32, and so on.
ing; it was clutching the key the ogre wanted. But there was also a sword
Figure 8.1 shows what this branching tree would look like with 6 levels:
lying nearby. (Take key or sword?)
6. He picked up the sword. Should he use it to attack the dragon or take it back
and attack the ogre?
7. He decided to use it to attack the ogre. He went back and confronted the ogre.
The ogre laughed at him and threatened to kill him. (Attack or retreat?)
8. He attacked and wounded the ogre, who fell to the ground. The maiden
begged him not to kill the ogre. (Kill ogre or relent?)
9. He went ahead and killed the ogre anyway. When a drop of blood from the
ogre splashed onto the maiden, she turned into an ogre and was very angry
with him. (Apologize or kill?)
FIGURE s.1 A six-layer branching tree
10. So, he killed her.
That looks pretty big and unwieldy, doesn't it? Yet it's only six layers deep, which
means that it can make a story only six sentences long. Not much of a story, is it? Even if it were fleshed out with pretty verbal descrip-
tions and embellishments, it's still skeletal. That's because real stories have a wide
Let's say that a productive designer should be able to create a thousand such array of decisions. Only a few decisions are dramatically crucial, but myriad
states. That seems like plenty of work. If you walk through the doubling process, tiny decisions help define character, including the way one character addresses
you get to a thousand after just ten steps. From the designer's point of view, this another, the degree of impatience or alacrity with which a character operates,
represents a heavy workload. But from the user's point of view, all this work and so on. A real story will contain hundreds or thousands of such tiny deci-
yields a story that is just ten steps long. It might read like this: sions; this kind of fine detail just isn't possible in a branching tree. Thus, branch-
1. Once upon a time, there was a handsome young man. One day, he set off in ing tree designs demand too much work from the designer and offer too little
search of adventure, and in the forest heard a cry and a growl. (Investigate meat to the user
or ignore?)
Lesson 20
2. He investigated the sounds and found a maiden being held prisoner by an
Branching trees suffer from geometric growth that always requires more
ogre. (Intervene or ignore?)
work than designers anticipate.
3. He told the ogre to release the maiden, but the ogre challenged him to a
quest. (Accept or reject?)
Branching Trees 119
118 Chapter 8
Innkeeper
greets you.
Dialogue Trees
More often, designers confine the tree to a single interaction between the player "I don't know
anything."
and another actor; they call these dialogue trees.You walk into the cliched medi-
eval inn with the cliched innkeeper serving the cliched ale to the cliched cast of
Ask about
nasty-looking characters sitting at their cliched wooden tables. You need to find treasure.
out about the cliched treasure, so you ask the cliched innkeeper. But you can't
just ask him; you have to say the right thing to wring an answer out of him. How
Innkeeper
do you figure out the right thing to say? That's impossible to know in advance. tells you.
After all, you've never met the innkeeper before, and you have no idea what will
FIGURE a.2 A typical dialogue tree
influence him positively. Figure 8.2 shows the dialogue tree.
Dialogue trees do offer puzzles that entertain some people, but they certainly
To get the innkeeper to tell you about the treasure, first you must purchase an ale,
don't constitute anything that could be called interactive storytelling. In
then you must ask him how his business is going, then you must commiserate
Figure 8.2, you're not interacting with a character in any dramatically significant
with him-and only then can you ask him about the treasure and get a useful
fashion. Instead, you're testing a vending machine to see what buttons must be
answer. Of course, you don't know this in advance, so you simply wander through
pushed for it to deliver its product.
the dialogue tree. With trial and error, you'll get there eventually. Isn't this fun?
120 Chapter 8
Branching Trees 121
North
Entryway.
Go north
3 steps.
East
Hallway Hallway
Dead end.
to the west. to the east.
Go west Go east
Give up.
3 steps. 2 steps .
Start
here
South
Follow
FIGURE a.a A very simple rat's maze to the end.
~ tree is reallyjust a different way of representing a maze; or, perhaps a maze is just a
There's
different way of representing a tree. Figure 8.3 presents a ridiculously simple maze. the starl
Figure 8.4 presents an analysis of how to traverse the rat's maze. FIGURE 8.4 Maze tree
Look familiar?
Foldback Schemes
Some clever people have tried to solve the geometric explosion problem of
branching trees by rerouting the consequences of decisions so that they converge.
In the example of the cave and the dragon, a clever designer might have set
up the cave decision in the following way: If the user chooses to go toward the
sound of trickling water, he or she encounters some minor obstacle that either
deposits the player at the mouth of the cave or in the dragon's lair. I call this
stunt foldback because it simply folds the storyline back to some predetermined
path. Figure 8.5 shows what foldback might look like:
122 Chapter 8
Branching Trees 123
People keep coming up with variations on the foldback system and combina-
tions of foldback with trees, hoping that there's a magic combination that will
work. There isn't. Every case of foldback renders some decision meaningless. If
you have only one instance of foldback in your design, then your design is only
a tiny bit fraudulent. As you add more foldback, you create many more new (but
meaningless) pathways and add to the overall fraudulence of your design.
0-0--0-0.---0-0
! ! ! ! ! ! If we reject turning around in the middle of a pathway and reversing course,
Pac-Man offers its player exactly 23 choices. Of those choices, 19 are binary; 4
0 0-0-0-0-0-0 0 intersections offer 3 choices. That's all there is. Instead of creating a thousand
i i i i i i different branch points, the designer of Pac-Man created only 23. It's the con-
0 o-o o-o
0 0
! 0 text that makes those choices variable in meaning. We can quantify that context.
There are 4 power pills and 270 edible dots. Each of these has just 2 states-
I ?-o-o-? bits. Next come the 4 ghosts and Pac-Man himself; each of these has a position
that could be stored as just 9 bits of information. That's a total of 45 bits for the
o-o o-o 5 movable characters. Add up everything and we get a grand total of 319 bits of
information. That's the data context of Pac-Man. It may not sound like much,
?---? l
but it amounts to 1096 differentiable states. Yes, 1096 is a large number-ridicu-
lously large. The designer of Pac-Man built a system with a tiny number of
I branch points-but made it rich by giving it 319 bits of context, which trans-
formed a simple maze into something much more interesting.
0-0-0-0 0-0-0-0 Interactive storytelling is not so mechanical a subject that it can be handled with
: : : : : : simple geometric mazes and up/down, left/right decisions. The systems we build
OD 0-0-0-0-0-0 OD for interactive storytelling cannot directly use a system as elementary as that
used in Pac-Man. But we can use the example of Pac-Man to guide our efforts.
t t t t t t We cannot return our player to the same decision point a hundred times, but we
OD-0 0-0 0-0 0-00 can return him to similar decision points several times. For example, consider
i i i i the layout of a romantic storyworld; surely kissing plays a large role in such a
0----0-0------0 storyworld. What's wrong with presenting the player with an incipient-kissing
situation several times during a storyworld? The first time, it's a clumsy oaf who
FIGURE 8.8 Pac-Man directed graph wants to kiss her; the next time, it's a smooth operator; the third time, it's the
clumsy oaf who has since turned out to be quite sweet. It's the same situation in
Now Pac-Man finds himself right back at the same intersection, with exactly the
three completely different contexts.
same three choices: up, down, or right. But this time, the context is different; the
positions of the ghosts indicate that Pac-Man should go up. Thus, it is possible In general, branching stories don't work, even with foldback. But if you twist
to design a network of choices so that the player faces the same choices over and a branching system around enough, you can transform it from a tree into a
over, but they mean something different each time. Figure 8.8 shows the network directed graph. If you then set up appropriately differentiating context, you can
diagram for Pac-Man. have your players move through the network of dramatic p·ossibilities, revisiting
each point with a different context each time.
Computer scientists call this formal representation of the Pac-Man maze a
directedgraph, which is a network with arrows connecting the nodes.
126 Chapter 8
Conclusions CHAPTER9
There's an old tale, almost certainly apocryphal, about an Indian mathematician
who invented the game of chess. He presented it to the king, who was so impressed
with the game that he invited the mathematician to name any gift he desired. Interactive Fiction
The mathematician humbly asked for a little rice: one grain of rice on the first
square of the chessboard, two grains on the second square, four grains on the third
square, eight on the fourth, and so on until the entire chessboard was full. The king INTERACTIVE FICTION is something of a parallel universe to video
was taken aback by this modest request; he asked if the mathematician didn't want
games. The two genres are so different that interactive fiction thrives
gold, or jewels, or land. No, the mathematician told him, just the rice. So the king
ordered his steward to dole out the rice. Shortly thereafter, the steward returned in complete isolation from the video games universe. Few video game
and explained that he had already doled out three tons of rice and was only on the
aficionados play interactive fiction, and few interactive fiction enthusiasts
27th square. Fulfilling the mathematician's request would require more rice than
had been grown in human history. The king was astounded . play video games. Interactive fiction has matured on its own path and has
That's the problem with geometric growth: People can't grasp how quickly it come a long way since its earliest days.
grows to astronomical sizes. Branching trees also grow exponentially; to build a
decent branching tree requires hundreds of thousands of nodes.
Branching trees are the most obvious way to build interactive storyworlds, which
is why everybody tries them. In fact, I recommend that you try to build one,
because that's the only way you'll really learn how futile the effort is. But per-
haps you could build something like a branching-tree haiku: something tiny yet
elegant. Good luck!