The GearHead Caramel mission generator uses basically the same random story generation process as the GearHead2 core story, but since you can play through Winter Mocha in about ten minutes it makes a much better demonstration model.
This story generator uses what I call Propp’s Ratchet. Vladimir Propp was a Russian folklorist who broke folk tales down into a set of 31 narrative functions. According to his research, not every tale would invoke every function, but the functions that were present would always appear in the same order. That is to say, Function 2 (Interdiction) would always take place before Function 6 (Trickery) if both appeared in the same tale.
In a Propp’s Ratchet story generator, the state of the plot is described by at least three variables. In the Winter Mocha mission generator these variables are Enemy, Stakes, and Complication. For each story beat, a new event is selected based on the current state of two of these variables, and the event’s consequences will change one of them.
For instance, let’s look at the encounter “Instant Karma”. You are on the trail of bandits who stole a shipment of toys, and find that they’ve wandered into a nest of hunter-synths. This encounter may be generated if the Stakes are Stolen Toys and the Complication is No Complication Yet. It changes the Complication to Feral Synths.
Each set of plot states has an order, and a plot can only change a plot state to one later in the list. This way we can guarantee that the plot will never repeat itself, which was a big problem in GearHead1.
The fact that there are three (or more) state variables but each plot event focuses on just two of them means that the story space increases in size cubically (or more), while the number of plot events I have to write increases just quadratically (at worst). If there are three states with ten possible values each, that means there are 1000 possible plots requiring at most 300 plot events to cover every possible situation. In practice, though, not every situation needs to be covered because not every plot state will be reachable.
One problem that may arise, especially if more than three state variables are used, is that the generated plot may end up sidestepping certain important features of the plot state because it’s only focusing on two of the state variables at a time. GearHead Caramel’s modularity can help to counteract this. An in-game event is typically constructed from multiple subplots. Details can be added to an encounter to remind the player of other parts of the story state.