Saturday, July 27, 2013

Another look at dynamic story generation for computer role playing games

I've taken a wildly different direction with the Dark Stars Traveller theme, and am currently working on a roguelike CRPG called Snapshot.  As a work in progress it is coming along fine, using the excellent LÖVE 2D game framework for Lua.  As it is intended to be a CRPG, the notion of missions/quests/adventures automatically comes into play and, as a roguelike game, the automated generation of them becomes an important goal.  So, I've revisited the past and dug up a 1996 paper I had started when I last spent serious time on the topic.  The essential portion is republished below.

The dynamic plot element node logic theorem

January 14, 1996

by Brian L. Price

Part I. Hypothesis

A story can be expressed as a combination of three plot scopes; the master plot, the sub-plot, and the random event (or micro-plot). A master plot consists of a dozen or more significant scenes spread, on average, widely through the story’s time and space. Generally, the master plot begins near the beginning of the story and continues through to the end. The master plot is the main story line.

The main difference between a synopsis and an actual story is that the synopsis covers only the most significant portions of the story, in other words, the master plot. Thus it can be stated unequivocally that a story consists of more than the master plot. One of these other ingredients is the sub-plot. A sub-plot is a short story interwoven within the confines of the master plot. Although most sub-plots are related to the main plot, the relevence of the sub-plots vary even within the same story. A sub-plot typically consists of less than half a dozen or so significant scenes and is expressed in a time and space scope significantly smaller than the master plot.

One difference between a novella and a novel is the drastic reduction with the novella form in the number of seemingly inconsequential events interspersed throughout main and sub-plot alike. These events can be described as random events or micro-plots. These micro-plots typically have a scope of only a single scene and have only minor relevance to any sub-plot or master plot serving mainly to add color although occasionally effecting plot direction.

A reoccurring component of master plot, sub-plot, and micro-plot alike is the concept of a scene. A scene can be expressed as a story node, and a story can be viewed as a sequence of interconnected nodes. Furthermore, these nodes can be subdivided as to ownership by master plot, sub-plot, or micro-plot. Each scene, or node, is composed of a collection of elements. Not all scenes possess all elements, but all scenes are expressible as a subset of a common set of plot elements.

A somewhat arbitrary choice of basic plot elements can be made to form the common set of plot elements. The current plot element node logic theorem holds that these elements can be defined as setting, character, information, features, and events. The element setting can be described as the physical surroundings in which the scene occurs. The character element consists of the characters and creatures which are within the setting during the time the scene occurs. The information element consists of knowledge which may be obtained by or imparted to a character from some other element during the course of the scene.

Features are generally immovable physical objects within the setting which have some special significance to the plot and which may be accessed and/or activated during the course of the scene. Events cover a wide range of elements which may exist or occur within the scene and perhaps beyond but which are usually beyond the control of any of the characters, this covers elements such as weather, war, natural disaster, etc. Of course, the scene would not be complete without resolution, that is, the interaction between the various elements during the time frame of the scene.

Given that:
a. Any scene can be described in terms of a subset of the set of plot
elements together with the interaction between them.
b. Any plot can be described as a sequence of scenes,
c. Any story can be described as a collection of plots.
Then any static story can be completely described using plot element node syntax.

Assuming this to be true, a dynamic story, that is one where the various plots have multiple possible paths, could also be described using plot element node syntax if, and only if, a system of logic was developed that could express the relationships between the plot nodes in a non-deterministic form. That is to say, a system of logic which could resolve the various scopes, probabilities, exclusions, and dependencies between various plot element nodes in such a way as to allow character action and story universe mechanics to determine the plot path, and thus the story’s evolving reality.

In a dynamic story, each plot node (or scene) has a number of defining states or boundary conditions. A plot node has a region of space in which it can occur, a frame of time in which it may occur, a probability of occurrence, a uniqueness factor, and an existence factor. A unique node may only appear at most once in a story. An existent node’s setting and possibly its feature(s) or characters may be revisited. Existent node events which are of a persistent and regional or global effect will alter the reality state of the story universe for their duration.

Still, in order to form plots, relationships between plot nodes must be defined. The primary relationships are: exclusion, dependance, time frame acceleration, time frame deceleration, probability increase, and probability decrease. That is, the transition from non-existent to existent of one plot node will: cause the removal of all plot nodes which are related to it by exclusion, the existence of all dependent plot nodes, a time frame shift toward or away from the present for all plot nodes related through time frame acceleration or deceleration, and the alteration of the probability for future existence of all plot nodes related by probability increase or decrease.

The primary mechanism for bringing a plot node into existance is that of main character action and present plot node resolution. All plot elements except setting can possibly trigger the existance of a plot node or alter plot node boundary conditions. A plot thread is defined by the set of possible existence triggers and dependencies within the starting plot node and possibly at each subsequent plot node within a main or sub plot. These triggers can be represented by a change in plot element condition, ie the death of a character, the gaining of information, the activation of a feature, etc.

Plots become defined as their starting nodes come into existence and, one by one, all but one reality thread eliminated. (A reality thread being a sequence of plot nodes.) The relationship mechanism described herein automatically allows for maintenance of story integrity and proper interaction between main, sub, and micro plots. Application of this theorem to computer games should provide sufficient dynamic plot complexity so as to prevent most players from guessing the game future even after many replays.

Now I realize the above isn't a proper theorem, merely the first steps towards one.  Likewise there has been a lot of progress in the general field, yet still the central problem I encountered 17 years ago remains today.  That is, how to create a friendly and usable authorship tool usable by non programmers so that they may express dynamic stories using such a framework as hinted at above.

I look forward to hearing any comments, suggestions, advice, links, etc.

No comments:

Post a Comment