Skip to main content

The US town ruled by an AI storyteller

“These are all tools of expression...”

Storytellers often talk about writing as a kind of mystical process. The beat generation poet Philip Lamantia believed that in order to create authentic writing one had to first reach a trance-like state in between sleep and wakefulness - a place of the primal sources of creativity that, according to him, could be attained with the help of a little peyote. A thousand years before that the poet Homer was invoking the muses of Grecian myths in reach a similar state of inspiration, suggesting that as far back as the writing of The Odyssey, storytelling was viewed as a partnership with something other than human.

What about stories developed in partnership with artificial intelligence?

This can feel at odds with the romantic view of storytelling, where the author inhales creative inspiration and exhales exacting prose. But perhaps it presents another way of understanding the muse - an electric muse working in partnership with the artist.

James Ryan, a Ph.D. student at the University of California, Santa Cruz, uses code to tell stories. Sheldon County is his current project (a proof-of-concept released to Soundcloud earlier this year can be listened to here.) Named in honour of Sheldon Klein, an early pioneer of expressive artificial intelligence, Sheldon County is an AI-powered podcast capable of generating an infinite number of procedural stories.

Sheldon County tells the story of a fictional American town and the people who inhabit it over the course of 150 years. It is the result of two programs that run in parallel: Hennepin, which simulates each day and night in the history of a fictional American county over 150 years, and Sheldon, which in turn sifts through this accumulated history to find the interesting storylines and dramatic nuggets that have actually emerged over the course of the simulation based on narrative patterns authored by Ryan.

On any given day or night, all the characters in the county can take an action in the world: A social interaction like an insult, a hug, or the spreading of gossip between townfolk, an action that fundamentally changes the world like a birth or a death, and introspective actions like mourning the loss of a loved one, obsessing over a love interest, or regretting a past action. Which actions characters can take at a given time depends on aspects of that character - their personality, their value system, their relationships with other people, their past, their knowledge, where they work, where they are right now, what time of day it is, and on and on.

Critically, when a character takes an action, it may cause either her or another character to decide to take another action in response. The response could be immediate (if someone insults her, she might insult back), or latent (before falling asleep that night, she cringes over the experience). In this sense, actions beget subsequent actions which may beget further actions, and so forth, and this is the mechanism for generating plot.

Ryan explains: "Imagine a character insults another character, and the person who was insulted has a vengeful personality. The insult thus causes the insulted character to later on decide to hatch a revenge scheme on the culprit. This decision to hatch the scheme then causes the character to later on sit down to lay out the plan. Laying out the plan then causes the character to later on carry out the first step of the plan. This causes them to show up at a business that is owned by the insulter. This causes the avenger to look around and see if anyone is there. She doesn't see anyone, so she sets fire to the business. She leaves the scene."

There is a butterfly effect of complications that arise from here.

"This is the kind of thing that's happening over the course of a few hundred years of simulated story time," James Ryan says. "The result of all this is something on the order of a few million character actions, along with a lot of data about who exactly everyone is - personality, values, life history, knowledge."

Ryan's role in this storytelling process is similar to a sculptor, he says, gradually molding the simulation through addition, subtraction, modification just as a sculptor chisels form out of a block of stone.

"In my own work, I build computer simulations of storyworlds that are highly generative and very emergent - things can happen in these worlds that I didn't anticipate, but usually I can think about the programming that I've done and come up with explanations for why things occurred," says Ryan. "I don't plan my projects ahead of time, but I generally have a sense of the kinds of things I'd like to do in the future. I start with something very simple, and then improvise each day to add in new things so that the characters living in the little abstract world become more interesting to me, and so that the storylines that emerge out of these little worlds also become more interesting."

Games like Bad News use town simulations to drive peculiar social storytelling.

"To me, personally, building these worlds feels kind of like sculpting, but instead of sculpting a single artifact, I'm sculpting a possibility space that defines all the artifacts that can be generated by my system."

In his role as a kind of narrative sculptor, Ryan sees a method of bypassing what is known as the "10,000 Bowls of Oatmeal Problem," a turn of phrase first coined by indie developer Kate Compton which refers to just how boring procedurally generated stuff can get. You can procedurally generate 10,000 bowls of oatmeal that are technically each unique, but ultimately to the human who experiences them it's still just oatmeal.

"One thing I'm doing in an attempt to overcome this is targeting emergent feedback loops whereby character actions fundamentally change how the county itself works," Ryan explains. "For example, a group of characters in the simulation may decide to start a new town in the county on the premise of having a shared view of how the world should work. So, for instance, a group of characters may start a town based on the idea that merriment is wrong and the law is almighty. After starting a town, characters hold town meetings where they propose new legislation that may change how the town operates. So in this town the characters may decide to ban alcohol and other forms of merriment. Now the police in the town may actually arrest someone for taking a merry action. Maybe a group of merry characters in another part of town now decide to infiltrate this town to change it from the inside out. You can imagine how this kind of weird evolution could work to propel each county off into its own weird part of the possibility space.

"At the next level of variation, I can quickly define abstract narrative patterns that could recognize the kind of wild variation happening in the simulation. But at the level of variation above that, where I'm defining the patterns of how to actually generate narration, it's way harder to maintain the level of variation. This is simply because it takes a lot of authoring to ensure that the generated scripts will be aesthetically pleasing. Since I care foremost about the quality of generated narration, I'm not willing to just, e.g., generate a sentence that renders each action that occurred in an emergent storyline. So the real bottleneck comes in terms of the number of kinds of episodes that [the Sheldon system] will actually have at its disposal."

"In the end, the major variations between the various podcast series will come in terms of the sequencing of the episodes. While variations on each kind of episode will sound alike in the oatmealish sense - there will be a lot of variation technically in terms of the words that are used, but they'll have the same essence to a human listener - my goal is for every listener to have a unique set in terms of the kinds of episodes that are sequenced together to form the podcast series. So if we each have, say, 20 episodes in our series (I'm not sure how long they will be yet), then my goal is for us to have very little overlap in terms of the kinds of episodes that appear in our respective series. We will have a similar first episode, everyone will have the same kind of episode here, since it's meant to serve as a pilot, but beginning with the second episode our series will totally diverge."

Ada Lovelace.

AI art feels new but its theoretical history stretches back in time, born alongside the work of 19th century mathematician Charles Babbage and the invention of computing. Writing in 1842 about the prospect of programming the first designed computer, Babbage's analytical engine, Ada Lovelace proposed using it as a means for procedural music generation. Lovelace argued that the engine, which was intended to store numerical information and perform different mathematical operations, had creative capabilities:

"Supposing, for instance, that the fundamental relations of pitched sounds in the science of harmony and of musical composition were susceptible of such expression and adaptations, the engine might compose elaborate and scientific pieces of music of any degree of complexity or extent."

Later, with the advent of the electronic computer Alan Turing was already proposing computer poetry, describing the potential for computational expression in 1949: "It may takes years before we settle down to the possibilities," he writes, "but I do not see why it should not enter any one of the fields normally covered by the human intellect, and eventually compete on equal terms."

So what of the romantic view of the artist?

Ryan says the role of the computational artist isn't much different from the role of the traditional one.

"Humans are always out to express themselves," he says, "and the idea of creative coding is actually as old as the idea of coding itself. I view coding as a kind of literacy that works a lot like regular literacy: just as writing enables modes of human expression that span from the boring, mundane, functional to the creative, poetic, profound, coding does as well. So, to me, creative coding is to coding as creative writing is to writing."

"I try to make sure that each day I spend working on a simulation leads to interesting new possibilities being generable by the time I stop working that day. Again, the whole process feels kind of like sculpting to me, as opposed to writing, for instance, where the work is more linear. The artist is simply working in a different material context. Working with oil paints is a lot different than working with clay which is a lot different than working on a typewriter, and all of these are different than working with code."

"But these are all tools of expression."

Read this next