Skip to main content
  1. Other Projects/

Procedural Story Generation

procedural generation python graphs gaming

Background

Procedural generation is double-edged sword in modern videogames. Small studios can leverage procedural content to create massive worlds; however, these environments often feel empty compared to human-generated levels. The narrative (or lack thereof) is partly to blame. A human-made game like Skyrim has much more engaging questlines than a game like No Man’s Sky, with procedural objectives.

My goal with this project was to programmatically generate engaging storylines. While the intended purpose was for videogames, the stories had to reasonably stand on their own. As such, this project was motivated by the creation of believable stories, while allowing integration into a game engine.

The Project

In this project, stories are defined as a collection of vignettes. A single vignette describes an event or progression of the story. This can be as simple as a character obtaining a key item, or more sentimental, like the betrayal of a close friend. The task is to organize a set of vignettes into a reasonable story.

The key innovation of this project is in representing the story as a graph. This lets the program (in particular, the author) query whether a particular vignette “fits” in the story. For example, the following (program-generated) graph contains the Protagonist’s relationships at some point in the story.

Story association graph
Story association graph.

Because vignettes are effectively queries or insertions on the graph, we can design arbitrarily intricate vignettes, or completely distinct kinds of stories without changing code. The choice of vignette/story architecture is decoupled from the program, which is essential if others are to use this approach.

Current Status and Future Work

This project successfully generates stories from the supplied vignettes; however, random selection of “fitting” vignettes is a bad way to create a sensible story. The stories (as they currently stand) fail to capture a reasonable story arc; to do so, more imposing constraints on the number and type of vignettes must be implemented. These would likely follow established literary standards for narrative.

Capprin/stories

Generating stories from a collection of vignettes.

Python
0
0