📕 Node [[scene sequel post mortem of a fiction generator]]
📄 Scene-Sequel--Post-Mortem-of-a-Fiction-Generator.md by @enki

Scene/Sequel: Post-Mortem of a Fiction Generator

Abstract Fiction generators based on goal-directed planning in a simple state machine can produce reasonably human-like output without…


Scene/Sequel: Post-Mortem of a Fiction Generator

Abstract
Fiction generators based on goal-directed planning in a simple state machine can produce reasonably human-like output without explicit modeling of multiple characters by treating the planner as the narrator and protagonist.

Background
Fiction generation using world models is not new. The same kind of planning used in SHRDLU (Winograd, 1972) drove early planner-based fiction generators like TALE-SPIN (Meehan, 1976). This class of fiction generators is a middle ground between ‘simulationist’ models, wherein a large number of variables are modeled carefully and a story is extracted from the progression between states by dropping most of the information modelled, and ‘texture’ models, wherein large pieces of preexisting flavor text are pieced together. (An example of the former would be the history of the world produced by Dwarf Fortress, and an example of the latter would be BRUTUS (Bringsjord, 2000).) TALE-SPIN-like planner-based fiction generators have, historically, like TALE-SPIN, modeled a set of characters and modeled their interactions. The most interesting stories generated by these generators remain the “mis-spun tales”, wherein assumptions by the generator are flawed in a way that produces absurd violations of common sense; the remainder of tales are fairly mundane transcripts of interactions between characters. As demonstrations of a functional model, these transcripts are serviceable; as stories, they lack interesting forms of structured conflict.

Author Jim Butcher presents a model of plot construction I call the ‘scene-sequel model’ that diverges from the idea of the world as a perfect simulation and focuses on the kinds of stories readers find interesting. While Butcher’s interest is in human-written stories, his ideas lend themselves to generative fiction more so than other seemingly more mechanical models of plot construction like Plotto and the [BS2](http://www.savethecat.com/tools/the-blake-snyder-beat-sheet-the- bs2). Quickly: within the scene-sequel model, a story has a single protagonist and consists of scenes (wherein the protagonist attempts to achieve his or her goal) and sequels (wherein the protagonist reacts to the content of the scene emotionally and performs his or her planning); scenes have scene-specific goals that are either achieved or not achieved and each scene may introduce complications that change the protagonist’s state.

Current work
For NaNoGenMo 2015, I present a fiction generator based on a simplified scene-sequel model for caper novels. In this model, there is only one character modeled: the protagonist, who is also the narrator. The content of the story is generated by the planner with the help of flavor text.

The story is generated by the planner from a ‘world model’, which is a state machine with associated flavor text. The world model consists of a list of state objects; each state object has a list of other states it can transition to (along with a probability for this transition to occur and optional flavor text for describing attempted, successful, and failed transitions). It furthermore contains a set of potential complications, which themselves are state names paired with probabilities.

The planner is provided with a world model, a weight for state transition success rate, a weight for complication accretion rate, a starting state, and a goal state. The planner keeps a ‘goal pool’ consisting of a set of state names and weights, and this goal pool is initially set to the goal state. Typically, the goal state is the overarching goal of the protagonist. As complications are accrued, they are added to the goal pool.

At each step, we perform a sequel followed by a scene.

The sequel consists of information produced by the planner, which (starting from the current state) performs a walk of the state space, depth-first, searching for the goal state. Because the world object contains cycles, the tree-walking portion of the planner is provided with a recursion depth limit. The planner, multiplying and adding probabilities, determines the immediate next state with the greatest composite likelihood of reaching each state in the goal pool — in other words, the likelihood of reaching each goal is determined, adjusted by its goal weight, and then a composite is produced for ranking purposes. During this tree-walking and goal-weighing process, at an adjustable rate, information about the planning process and the decisions being made is emitted in the style of first-person narration of planning in a caper novel:

So, I thought, what if I tried to steal them jewels by trying to get a museum uniform… So, I thought, what if I tried to steal them jewels by trying to pass as a museum employee… So, I thought, what if I tried to steal them jewels by trying to go to the hospital… I’ll try to remember that.

So, I figured, if I tried to steal them jewels by trying to pass as a museum employee I’d have maybe a 35% chance of succeding. I’ll try to remember that.

If I’m trying to get a museum uniform, what if In order to steal them jewels, I tried to pass as a museum employee. That has about a 1 in 10 chance of working. So, I figured, if I tried to steal them jewels by trying to get a museum uniform I’d have maybe a 10% chance of succeding. I’ll try to remember that.

So, since I’m trying to go about it the obvious way I decided to steal them jewels by trying to get a museum uniform. So, I have to get a museum uniform. I also have to steal them jewels. Right now, I’m trying to go about it the obvious way.

Once the planner has produced a candidate state, it uses the likelihood of success for the specific state transition and the global state transition weight to determine whether or not it succeeds, producing the appropriate flavor text (or a default if undefined), and then produces the set of complications to add. If the state transition is successful and the new state is the end goal state, the program stops here; if the state transition is successful and the new state is in the goal pool, that entry is removed from the goal pool.

Here is an example of the full output, using a world model about jewel theft:

This is the story of that time I decided to try and steal them jewels.

So, I thought, what if I tried to steal them jewels by trying to get a museum uniform… So, I thought, what if I tried to steal them jewels by trying to pass as a museum employee… So, I thought, what if I tried to steal them jewels by trying to go to the hospital… I’ll try to remember that.

So, I figured, if I tried to steal them jewels by trying to pass as a museum employee I’d have maybe a 35% chance of succeding. I’ll try to remember that.

If I’m trying to get a museum uniform, what if In order to steal them jewels, I tried to pass as a museum employee. That has about a 1 in 10 chance of working. So, I figured, if I tried to steal them jewels by trying to get a museum uniform I’d have maybe a 10% chance of succeding. I’ll try to remember that.

So, since I’m trying to go about it the obvious way I decided to steal them jewels by trying to get a museum uniform. So, I have to get a museum uniform. I also have to steal them jewels. Right now, I’m trying to go about it the obvious way.

I failed to get a museum uniform while trying to go about it the obvious way. Bummer. Now I have to get a smaller gun. I still need to steal them jewels.

So, I thought, what if I tried to get a smaller gun by trying to get a museum uniform… So, I thought, what if I tried to get a smaller gun by trying to pass as a museum employee… So, I thought, what if I tried to get a smaller gun by trying to go to the hospital… So, I thought, what if I tried to get a smaller gun by trying to steal them jewels… I’ll try to remember that.

So, I thought, what if I tried to steal them jewels by trying to get a museum uniform… I already figured that if I tried to steal them jewels by trying to get a museum uniform I’d only have about a 1 in 10 chance of succeeding.

So, since I’m trying to go about it the obvious way I decided to steal them jewels by trying to get a museum uniform. So, I have to get a museum uniform. I also have to get a smaller gun. I also have to steal them jewels. Right now, I’m trying to go about it the obvious way.

I failed to get a museum uniform while trying to go about it the obvious way. Bummer. I still need to get a smaller gun. I also still need to steal them jewels.

So, I thought, what if I tried to get a smaller gun by trying to get a museum uniform… So, I thought, what if I tried to steal them jewels by trying to get a museum uniform… I already figured that if I tried to steal them jewels by trying to get a museum uniform I’d only have about a 1 in 10 chance of succeeding.

So, since I’m trying to go about it the obvious way I decided to steal them jewels by trying to get a museum uniform. So, I have to get a museum uniform. I also have to get a smaller gun. I also have to steal them jewels. Right now, I’m trying to go about it the obvious way.

I failed to get a museum uniform while trying to go about it the obvious way. Bummer. I still need to get a smaller gun. I also still need to steal them jewels.

So, I thought, what if I tried to get a smaller gun by trying to get a museum uniform… So, I thought, what if I tried to steal them jewels by trying to get a museum uniform… I already figured that if I tried to steal them jewels by trying to get a museum uniform I’d only have about a 1 in 10 chance of succeeding.

So, since I’m trying to go about it the obvious way I decided to steal them jewels by trying to get a museum uniform. So, I have to get a museum uniform. I also have to get a smaller gun. I also have to steal them jewels. Right now, I’m trying to go about it the obvious way.

I totally succeeded in my attempt to get a museum uniform by trying to go about it the obvious way. Yay! Now I have to get a smaller gun, again. I still need to steal them jewels.

So, I thought, what if I tried to get a smaller gun by trying to pass as a museum employee… So, I thought, what if I tried to steal them jewels by trying to pass as a museum employee… I already figured that if I tried to steal them jewels by trying to pass as a museum employee I’d only have about a 3 in 10 chance of succeeding.

So, since I’m trying to get a museum uniform I decided to steal them jewels by trying to pass as a museum employee. So, I have to pass as a museum employee. I also have to get a smaller gun. I also have to steal them jewels. Right now, I’m trying to get a museum uniform.

I failed to pass as a museum employee while trying to get a museum uniform. Bummer. I still need to get a smaller gun. I also still need to steal them jewels.

So, I thought, what if I tried to get a smaller gun by trying to pass as a museum employee… So, I thought, what if I tried to steal them jewels by trying to pass as a museum employee… I already figured that if I tried to steal them jewels by trying to pass as a museum employee I’d only have about a 3 in 10 chance of succeeding.

So, since I’m trying to get a museum uniform I decided to steal them jewels by trying to pass as a museum employee. So, I have to pass as a museum employee. I also have to get a smaller gun. I also have to steal them jewels. Right now, I’m trying to get a museum uniform.

I failed to pass as a museum employee while trying to get a museum uniform. Bummer. I still need to get a smaller gun. I also still need to steal them jewels.

So, I thought, what if I tried to get a smaller gun by trying to get a museum uniform… So, I thought, what if I tried to steal them jewels by trying to get a museum uniform… I already figured that if I tried to steal them jewels by trying to get a museum uniform I’d only have about a 1 in 10 chance of succeeding.

So, since I’m trying to go about it the obvious way I decided to steal them jewels by trying to get a museum uniform. So, I have to get a museum uniform. I also have to get a smaller gun. I also have to steal them jewels. Right now, I’m trying to go about it the obvious way.

I totally succeeded in my attempt to get a museum uniform by trying to go about it the obvious way. Yay! Now I have to get a smaller gun, again. I still need to steal them jewels.

So, I thought, what if I tried to get a smaller gun by trying to pass as a museum employee… So, I thought, what if I tried to steal them jewels by trying to pass as a museum employee… I already figured that if I tried to steal them jewels by trying to pass as a museum employee I’d only have about a 3 in 10 chance of succeeding.

So, since I’m trying to get a museum uniform I decided to steal them jewels by trying to pass as a museum employee. So, I have to pass as a museum employee. I also have to get a smaller gun. I also have to steal them jewels. Right now, I’m trying to get a museum uniform.

I totally succeeded in my attempt to pass as a museum employee by trying to get a museum uniform. Yay! Now I have to escape the museum. I still need to get a smaller gun. I also still need to steal them jewels.

So, I thought, what if I tried to get a smaller gun by trying to go to the hospital… So, I thought, what if I tried to escape the museum by trying to go to the hospital… So, I thought, what if I tried to steal them jewels by trying to go to the hospital… So, I thought, what if I tried to get a smaller gun by trying to steal them jewels… So, I thought, what if I tried to escape the museum by trying to steal them jewels… So, I thought, what if I tried to steal them jewels by trying to steal them jewels… It turns out there’s no way to steal them jewels by trying to go to the hospital after you already tried to pass as a museum employee.

So, since I’m trying to pass as a museum employee I decided to steal them jewels by trying to steal them jewels. So, I have to steal them jewels. I also have to get a smaller gun. I also have to escape the museum. Right now, I’m trying to pass as a museum employee.

I totally succeeded in my attempt to steal them jewels by trying to pass as a museum employee. Yay! Now I no longer need to steal them jewels. Now I have to heal my arm wound. Now I have to heal my chest wound, too. I still need to get a smaller gun. I also still need to escape the museum.

THE END

Here is the world model that produced that story:

world={}
world[“go about it the obvious way”]={“get a museum uniform”:{“probability”:0.5, “complications”:{“get a smaller gun”: { “probability”:0.9 }}}, “go to the ninja supply store”:{“probability”:1}, “go to the gun store”:{“probability”:1}}
world[“go to gun store”]={“get a smaller gun”:{“probability”:0.7, “complications”:{“find my stolen wallet”:{ “probability”:0.2}, “success_descr”:[“The gun store carried an antique gun intended for defending women on bicycles against dogs in the late nineteenth century. “, “The gun store carried a half-scale airsoft dart gun version of a Walther PPK, and poison darts. “]}, “descr”:[“The gun store was a tiny brick building by the side of the highway, in the bad part of town. “], “success_descr”:[“The owner glared at me, and then at my ID, and then back at me. Then he grunted, accepted my cash, and handed me the new gun. “], “failure_descr”:[“After banging on the locked door for ten minutes, I noticed a tiny sign at the lower left hand corner of the window embedded in the door. It had hours. It turns out, this store is closed on Tuesdays. “]}, “goal_reqs”:{“or”:[“get a smaller gun”]}}
world[“get a smaller gun”]={“go to gun store”:{“probability”:1}, “go about it the obvious way”:{“probability”:1}, “pass as a museum employee”:{“probability”:0.3}}
world[“get a museum uniform”]={“pass as a museum employee”:{“probability”:0.3, “complications”:{“heal my leg wound”:{ “probability”:0.2}, “escape the museum”:{ “probability”: 0.7} } }, “descr”:[“The costume shop was tucked into a strip mall down town, between a laundromat and a chinese take-out place. It smelled like soap. “], “success_descr”:[“There was a perfect museum employee uniform sitting on the rack to the left of the entrance. “], “failure_descr”:[“After looking through the racks several times, I finally decided to ask the cashier — a wrinkled but plump old woman with a puff of curly white hair — if she carried museum employee uniforms. She shook her head, and I left, dejected. “]}
world[“pass as a museum employee”]={“steal them jewels”:{“probability”:0.7, “complications”:{“heal my leg wound”:{ “probability”:0.3}, “heal my arm wound”:{ “probability”:0.3}, “heal my chest wound”:{ “probability”:0.3}}}, “go to the hospital”:{“probability”:0.9}, “reqs”:{“or”:[“get a museum uniform”]}}
world[“go to the ninja supply store”]={“get a smaller gun”:{“probability”:0.4, “success_descr”:[“In the glass display case, there was a poison dart gun that looked like a fountain pen. I bought six! “], “failure_descr”:[“The cashier claimed that they had a moral aversion to projectile weapons, and thus did not carry them. “]}, “purchase a black leather catsuit”:{“probability”:0.7, “success_descr”:[“A beautiful black leather catsuit greeted me from the rack to the left of the doorway. “], “failure_descr”:[“All the black leather catsuits they had in stock were sized for literal cats. “, “All the black leather cat suits they had in stock were way too big for me. “, “All their black leather catsuits were covered in shiny chrome studs and buckles, and wouldn’t help me disappear into the night at all. “]}, “purchase a grappling hook”:{“probability”:0.7, “success_descr”:[“There was a grappling hook with two hundred feet of rope sitting right behind the counter, on display. “, “I spent twenty minutes looking through the discount bin, before finding an absolutely perfect grappling hook for thirty cents. When I went up to pay for it, the cashier waved me off — no charge. “],”failure_descr”:[“\”Are there any grappling hooks in stock?\” The cashier, impassive behind his mask, shook his head slowly in response to my question. Then, after a moment of staring at me, he threw a smoke bomb at his feet. I found myself outside the shop, which was now locked. “]}, “descr”:[“The ninja supply shop was in the middle of the second floor of the mall, between a Hot Topic and a Zappo’s. It was dimly lit, and the scuffed floors had a fake tatami-pattern print. There was a wad of gum stuck to the doorway. “], “failure_descr”:[“The shutter was shut, and a great big lock hung from the side of it. “, “The door was shut and locked, and a sign said \”Back at 2:00\”. It was four. I waited until six. “],”success_descr”:[“As I entered, a machine emitted a little beep to indicate that customers were about. The cashier appeared out of a plume of smoke behind the counter. “]}
world[“purchase a black leather catsuit”]={“sneak into the museum at night”:{“probability”:0.8}, “go to the ninja supply store”:{“probability”:1}}
world[“purchase a grappling hook”]={“sneak into the museum at night”:{“probability”:0.9}, “go to the ninja supply store”:{“probability”:1}}
world[“sneak into the museum at night”]={“steal them jewels”:{“probability”:0.8, “complications”:{“heal my leg wound”:{“probability”:0.3},”heal my arm wound”:{ “probability”:0.3}, “heal my chest wound”:{ “probability”:0.3}}}, “go to the hospital”:{“probability”:0.9}, “reqs”:{“or”:[“purchase a black leather catsuit”, “purchase a grappling hook”]}}
world[“go to the hospital”]={“heal my leg wound”:{“probability”:0.9}, “heal my arm wound”:{“probability”:0.9}, “heal my chest wound”:{“probability”:0.7}, “escape the museum”:{“probability”:0.7},”goal_reqs”:{“or”:[“heal my leg wound”, “heal my arm wound”, “heal my chest wound”]}}
world[“heal my leg wound”]={“go to the hospital”:{“probability”:1}, “get a museum uniform”:{“probability”:1}, “get a smaller gun”:{“probability”:1}, “go to the ninja supply store”:{“probability”:1}}
world[“heal my arm wound”]={“go to the hospital”:{“probability”:1}, “get a museum uniform”:{“probability”:1}, “get a smaller gun”:{“probability”:1}, “go to the ninja supply store”:{“probability”:1}}
world[“heal my chest wound”]={“go to the hospital”:{“probability”:1}, “get a museum uniform”:{“probability”:1}, “get a smaller gun”:{“probability”:1}, “go to the ninja supply store”:{“probability”:1}}
world[“steal them jewels”]={“steal them jewels”:{“probability”:1, “complications”:{}}}
endGoal=”steal them jewels”

By John Ohno on December 17, 2015.

[Canonical link](https://medium.com/@enkiv2/scene-sequel-post-mortem-of-a- fiction-generator-583ad51f3c1b)

Exported from Medium on September 18, 2020.

Loading pushes...

Rendering context...