Legend generator

I love reading little snippets of background story in RPGs. These snippets can be in form of discussions with NPCs (or between NPCs), little notes, scrolls or even pages of books. But I generally don’t like reading long paragraphs that keep going and going. Information needs to be in tiny, bite-sized chuncks and it shouldn’t be mandatory to read all of them to proceed in game. I really liked for example how Dragon Age: Origins did this. There are tons and tons of stuff to discover, it’s delivered in varied means and it’s interesting.

So, naturally I added scrolls in my game long time ago. They don’t have any other function than to provide tiny pieces of background story (I like giving player dots and letting them to connect them in their preferred way) and little amusement. But I don’t want the content to repeat too soon and I would like to be surprised too now and then. So procedural generation of lore and particularly legends came to my mind.

cogitor

Steam powered content generation in progress

I’m not the first one to think of this. Dwarf Fortress for example does stellar job in this. But I would like to have a slightly different take on the matter. There would be fixed cast of characters, probably relatively closely resembling archetypical characters that have appeared in stories time after time. There would have to be an overarching story, albeit quite loose and not well defined and characters would maybe change over the time. And legends being generated would be same for each player and same story could be found in two different scrolls. Bonus points if I could mix this with some hand-crafted stuff that would be used to define more pivotal points of the story.

Having identical legends generated for different players is probably the easiest step. Every legend has ID number that is used as a seed when the legend is generated. The generating code just needs to be written in a way that same seed results to same legend being generated. This is easy to achieve if we instantiate a new pseudo-random number generator and use the ID to seed it. Mersenne twister is one of the most well known of these and incidentally what Python uses for generating random numbers.

Mixing generated and hand-written content is likewise straightforward. We need to create a lookup table that contains legend IDs of hand written legends and their content. When new legend is about to be generated, routine first checks this table and uses content defined there. If there isn’t a matching legend ID, new legend will be geneated with a procedural system.

But the gritty details are where I’m quite lost still. How to represent procedure that generates legends? How do I ensure that correct type of legends get generated? How will the system manage personal interactions of the characters? If in the first legend Librarian and Warrior are close friends, they probably shouldn’t be sworn enemies in the second one. And if in one story Charioteer manages to snatch some prized object, they probably shouldn’t forget that item exists by the time next legend rolls around. Creating content procedurally and referring to items for example back and forth sounds quite nightmare to implement correctly. Currently I’m mulling over a system where special items or artefacts would have IDs, just like legends, and their name and other properties were generated based on that. Then there would be a hand-crafted table that would contain relevant information for each artefact and story phase. This was it would be possible to hand-craft high-level content: “In act 1, artefact 21 was stolen by Charioteer. In act 3, Charioteer lost artefact 21. In act 6, artefact 21 was found by a mortal named X.”

So, in a sense there would have to be a pile of hand-crafted tables that would define broad strokes of the story: characters, their relations with each other, artefacts, locations maybe. Then there would have to be a routine that can take all that information and a seed number and use those to generate a legend. The generated legend would have to be sensible (in a sense that it wouldn’t jump all around) and consistent with the current story arc. There would have to be a way of specifying style or form of a legend:

  1. Hero meets seer
  2. Seer gives hero a mission
  3. Hero refuses
  4. Hero later gets forced onto mission by circumstances
  5. and so on…
ink-well

Muscle powered content generation

This all sounds really ambitious and complex project. And I haven’t even thought about how to actually generate readable prose from a legend description. But it also sounds like a fun project and offers neat possibilities. For example, player could come across one of the rare artefacts mentioned in the legends. If they had read about the background of it, they immediately would have sort of idea of item and start wondering how it ended up there.

Advertisements

One thought on “Legend generator

  1. Pingback: Generating scrolls | Engineer's Journey

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s