Winter Mocha Random Story Generator: Propp’s Ratchet

Vikki's Thorshammer fires its flame cannon on a hapless Claymore.

The flame cannon is working. Yay!

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.

SDH-22 Corsair

For many years, the Corsair was the main battle mecha used by the Terran Defense Force. The Corsair was designed to fulfill every possible combat role. It exemplifies the “multi-purpose battroid” model that was popular in the 120s: a handheld ranged weapon, a collar mounted support weapon, a shield, and a secondary movement mode. The standard model does not include a close combat weapon because at the time it was believed this would be a waste of mass.

As time went on and the threats faced by the Defense Force became more varied, the shortcomings of the Corsair design became apparent. Rather than having one mecha that tries to do everything, the current strategy is to employ a variety of models with differing specialties. Although many Corsairs are still used by the Defense Force they are slowly being phased out in favor of newer models such as the Kojedo, Fenris, and Daum.

A large number of Corsairs have fallen into the second hand mecha market, where they are popular with both truckers and bandits.

Future Plans for GearHead Caramel

Hopefully, by now at least a few of you have tried the latest version of GearHead Caramel: Winter Mocha. How do you find it- too easy? Too hard?

My plan for Winter Mocha is to use it as the introductory scenario and tutorial level for GearHead Caramel. As the planned features get added to the game, they also get added to the scenario as demonstrations. Currently there are two possible lancemates; each of the lancemates other than Vikki (who just fights, and is pretty good at it) is going to have one specialist skill. By trying out different lancemates, you can learn how each of the specialist skills work (Carter is slated to be the Mecha Repair character, but I haven’t added the skill use interface yet). The other planned lancemates are:

  • Omega 1004: Computers
  • Either Jiro or Onawa: Stealth
  • Skippy: Scouting

Currently, the enemy AI is pretty bad. Today on the KTX train I decided to write a better AI, but it worked a little too well. Whereas before I could almost always complete the mission with a random pilot and the garbage meks, now I have trouble getting through it with a character that finished GearHead1.

I have two scenarios planned for the near future. Summer Caramel will be a story-heavy scenario set at the Mauna Arena in the summer of NT159. A group of famous cavaliers from all over the solar system is taking part, but not everyone is there for the tournament. One of the pilots is actually a thief planning to steal a sample of Typhon’s corpse as it is transported from Last Hope’s Mesa Research Station to Hogye’s Calmegie Lab. The player will be able to uncover the thief, join the thief, ignore the intrigue and just try to win the tournament, get a hot date for the big party, or some combination of the above.

The second scenario, tentatively titled The DeadZone Tour, is more action focused. The player sets off on a journey across the Central Eurasian deadzone. Each stop along the way is a Dungeon Monkey Eternal-esque randomly generated scenario. Maybe you pass through a village that needs your help, get accosted by ravagers, or discover a PreZero ruin that contains fantastic treasure. This one was inspired by the Judge Dredd Cursed Earth saga and is meant to provide more freeform, thrill-powered play.

GearHead Caramel: Next Day Ruckus

I’ve just uploaded a new release of GearHead Caramel to GitHub. The Winter Mocha mission scenario has been expanded with a full random plot generator; play time should now be 15 to 20 minutes, moving this into the category of genuine coffeebreaklikes. You can import characters from GearHead1, and there’s another possible lancemate in Mauna. Best of all, this release can be downloaded in one file executable versions for Windows and Linux, so you don’t have to mess around with Python and PyGame (though you really should if you’re into that kind of thing).

Try it out and let me know what you think.

Fantasy Portrait Set at

I’ve uploaded a series of 26 fantasy portraits that I did in traditional media (mostly acrylic, some watercolor and gouache) to The pictures are licensed under CC-BY 4.0, but any donations I get for the set will go towards hiring artists to help with GearHead Caramel.

In related news items, you can soon expect a review of AssetForge and an article about the great new world idea I have for Dungeon Monkey.

Reworked Conversation System

Last week, I reworked the way conversations work in GearHead Caramel. Originally, the conversation generator gathered conversation bits from every plot in which the NPC may be involved and arranged them into a conversation tree. Unfortunately, this means that certain dialogue paths might get hidden in the maze. For instance, if you wanted to ask Vikki to join your lance, sometimes it would take two or three conversations before the option would present itself.

Instead, now the conversation gets rebuilt at each dialogue exchange. Because of the dialogue construction rules not every offer can lead to every possible topic, but you should be able to get to any other conversation topic via “Could I ask you about something else?”. This seems to be working very well so far.

I’m hoping to make a new release soon. There’s a lot more stuff now than there was in the Tip’s Eve release, but I want to have a bit more randomization in the combat mission.

In related news, I’ve started commissioning artists to make portraits for GearHead Caramel. If you want to help me out with that you can support the game through or using the tip jar in the sidebar.  GearHead is and will remain free, but it’ll get done much faster if I can afford some help.

THD-36 Thorshammer

The Thorshammer is a heavy weapons battroid produced by RegEx Corporation. It is that company’s most popular model, being used by the Federation Defense Force, the Pro Duelist Association, the Bohemian Collective, and various other organizations throughout the solar system.

Z45-60 Zerosaiko

The Zerosaiko is one of the most popular mecha in the GearHead universe. It is designed for mobility and maneuverability. The basic version lacks firepower, but this is easily fixed with a little modification.

Originally the Zerosaiko was produced exclusively by Zero Tech, a family-run company in Namok. In NT160 Zero Tech was acquired by Kettel Industries. This has caused some controversy, as many cavaliers believe that the Kettel-manufactured Zerosaiko isn’t built to the same quality as the Zero Tech-manufactured models.

Zero Tech’s longtime rival is Vadel Industries. These companies are the GearHead universe equivalent of high quality/low volume sports car manufacturers like Ferrari and Lamborghini. The name Zerosaiko comes from the nickname of one of my students- “Zero Psycho”. Zero was a Korean card game popular among elementary school students; this particular girl was absolutely nuts about it. I thought it would make a good name for a giant robot, and it did.

My Computing Adventures

Last week I had to bring my laptop into the shop because its creaky old case had finally blown a hinge. This week I had to bring it back to the shop because the ROM BIOS suddenly stopped working. These are the first problems this machine has given me in the five years that I’ve had it, but when it rains it snows I guess. Thankfully, Samsung after-service is fantastic (at least in Korea) and both problems were solved quickly and cheaply.

GearHead Caramel now pre-loads the music and graphics when a new scene is entered. Unfortunately, this causes a noticeable delay. I’m going to add loading screens, and I thought it’d be a great idea to make them look like eyecatch cards from classic mecha cartoons. If you’re an artist and would be interested in making a GearHead eyecatch, please contact me with your commission rates. If you’re not an artist but would like to see me hire some good ones, you can support GearHead on I’m hoping to make a new release of GearHead Caramel next week, with new content, new weapons, and a whole bunch of improvements.

On Roguelikeness and Ultimatude

I’d like to talk for a bit about the design of GearHead Caramel. As usual, most of the big decisions were motivated by the type of game I want to play and the systems I want to program. Many of the changes are moving the game away from a classic roguelike, but I don’t think that’s a bad thing. Genre definitions can be a useful thing when talking about games. Rigid adherence to definitions, on the other hand, can often impair creativity and growth.

The main characteristics that GearHead Caramel will retain from the roguelike genre are replayability, procedurally generated content, and consequence persistence. Some of the non-roguelike features it will have are tactics style combat, a non-ASCII interface, and a focus on story. Whether this means GHC is still a roguelike or a roguelite or something else is left as an exercise for the reader.

The part of the game I am most interested in programming is the scenario generator. There’s a lot more going on now than simply random story generation. There is also procedural puzzle generation, a bit of which you can see in Winter Mocha (please forgive the fact that the puzzle is trivially easy; this is proof of concept work only). There’s generative text and dynamically constructed conversation trees, both of which should revolutionize NPC interactions in GHC. There is also reactive story generation, in which the player is given opportunities to alter the world state and the story reacts to those changes. In short, there are a whole lot of things I want to experiment with and I can do that better if the game consists of short linked episodes rather than a single epic adventure.

I’d also like to talk about the visual design of GearHead Caramel. I decided early on that I wanted to make the graphics attractive, functional, and low-maintenance. As you can see, each character and mecha has a single forward-facing sprite. In my notes I describe this style as “Neo-Ultima”.

The GearHead Caramel mecha sprites are scaled so 3 pixels = 1 meter; all of the mecha in the picture above are to accurate fictional size with one another. There is no definite scale for human sprites, but I plan to eventually introduce a paper doll system showing the character’s clothing and equipment.