The answer set programming approach towards story generation
Report from Team Oddjob
Pantelis P. Analytis
ProSecco Code Camp Antwerp
The goal of the system was to create stories using Answer Set Programming, and by composing them out of tropes.
Answer Set Programming (ASP) is a form of declarative (logic) programming, similar to Prolog, where a program consists of rules that evaluate to true or false. Using this method, the programmer is able to generate stories by describing the story itself, rather than how to generate it step-by-step. The system then searches all possible answers, with the output being constrained by the rules that form the story description.
Tropes are recurring themes or motifs in a story, and each trope has a list of associated roles. For example, the “Hero’s Journey” trope contains a Hero, a Villain and a Dispatcher (to send the Hero off on their quest). The idea is that a story contains many tropes at once, which describe the structure, themes and characters in it. Constructing a narrative using tropes as components therefore gives the author some control over its structure.
To generate our stories, we take characters from the NOC list based on the roles they have in a trope, and feed them into an ASP solver to generate a story. This is all done through a web-based UI.
Based on the information on the TV Tropes website and the Periodic Table of Storytelling, we added trope information to characters in the NOC list. We did this by first selecting categories of tropes that seemed most within our time range to implement and those most likely to produce successful results. These included: Structure, Setting, Story Modifiers, Plot Devices, Archetypes, Metatropes and Fandom Reactions. A new document was created and the selected storytelling tropes were listed along with their popularity in ‘kilowicks’ (thousands of links to their pages within the wiki). The goal of this was to give a reasonable sense of the precedence of a particular trope - and therefore its relevance to the project. The various classifications of tropes were assigned to members of Oddjob; using the ‘Identifier’ provided by the Periodic Table of Storytelling individuals were to ideally select the top ten most popular tropes and assign them/their Identifiers to the entirety of the NOC list where appropriate. This proved to be a very time-consuming (and subjective) task. Later, we also specifically updated our “Trope List” to include whether or not a given trope featured one or more characters in its implementation.
We programmatically created tropes by searching for certain verbs in the relationship verbs triples. For example, to generate the “Film Noir” trope, we searched the triples for the “is_investigated_by” verb, and used the roles listed in the triple sets to get a list of suitable roles for that trope. The user can then select a trope from a drop-down menu, and its “role” menus will automatically be populated with suitable characters.
We created a web-based UI with which a user can combine tropes from the database with which to generate stories. The user selects the tropes that they want in their story, and the characters they want to fit the roles for each trope. The characters and roles from each trope are then sent to the ASP solver, which generates the story text.