Machine Learning Meets Interactive Stories

Watchers of Bandersnatch must make decisions that may or may not affect the future progression of the plot.
A Choose Your Own Adventure book.

Background: Branching Stories

In choose your own adventure books, as well as in Bandersnatch, the plot can be visualized as a directed acyclic graph (DAG). Each page (or movie sequence) can be represented as a node in a graph. Directed arcs between nodes represent choices. Here is one for the book, The Mystery of Chimney Rock:

Branching Stories as an Optimization Problem

We have now set up an optimization problem: which path is the best one for a given individual? If there were one path through the DAG that was universally preferred, we could just send everyone down that path. In that case, one would have a non-branching story. We assume that there are a number of possible paths and that some individuals will prefer some paths over others.

  1. Which path is the best one for an individual?
  2. How do we improve the user’s experience given that they are still allowed to make choices?

Sequential Recommendation

Netflix uses a technology called a recommendation system (or recommender) to predict which movies you might be interested in watching. Recommenders work by either predicting the similarity between users based on their behaviors (viewing behaviors) or based on similarity between products (movies) or both. From this, the algorithm can guess at which movies you will be most likely to select.

Based on user ratings of items, predict the ratings that should go in the empty (*) spots.
A simple branching story with multiple paths to the same plot point.
Converting a branching story — a directed acyclic graph — into a tree.
Based on user ratings of plot sequences, predict the ratings that should go in the empty (*) spots.

Data Collection

Let’s take a moment to think about our data. To make sequential recommendation work, we must assume that we have some users who have played through some branches of an interactive story. We further have to have those users rate each plot point. This is an acknowledged limitation, though there are ways to reduce the number of ratings that users have to give by predicting the similarity between the nodes themselves.

Making Predictions

With what we have so far, we can predict the rating of possible sequences in a branching story. If we know the path the user has taken, thus locating them in the tree, we can identify the successor plot points and choose the one with the highest predicted rating.

Maximizing Expected Enjoyment

So what? If we force the user to the highest rated plot point, we have removed all choice. But if we all the user to have choice, they may make choices that diminish their enjoyment (recall the user is unaware of future plot points and thus cannot themselves choose to optimize their own enjoyment). What we need is a way of subtly nudging the user toward certain paths while still giving them agency to choose any possible path.


We know that companies like Netflix that produce streaming interactive stories like Bandersnatch can collect data on people’s choices. With a bit of effort, that data can be used to improve the probability that users enjoy the particular path they take through a branching story. The sequential recommendation approach described in this post is one way to do that, although it does require ranking and preference data that probably isn’t currently collected by companies like Netflix; bootstrapping the system will be the hardest part of using machine learning to increase user enjoyment.

Further Reading

For further reading on the sequential recommendation technique described above, including algorithm details and results of human subject evaluations, has been published in the IEEE Transactions on Computational Intelligence and Artificial Intelligence in Games, vol. 6(2), 2014. A pre-print is available here.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mark Riedl

Mark Riedl


AI for storytelling, games, explainability, safety, ethics. Assoc. Professor @GeorgiaTech . Associate Director @MLatGT . Time travel expert. Geek. Dad. he/him