February 15, 2009

Procedurally Generated Text Adventures - Can It Be Done?

Text adventures are fun. I remember wasting a lot of time with Colossal Cave as a kid with an Amiga and lots of free time. Once i found Baf's Guide to the Interactive Fiction Archive, I got stuck again. From the archive, I'd have to recommend Spider and Web, Babel and the oddity Aisle.

But the point of this post is to ponder whether one could generate text adventures procedurally in the way that roguelikes generate level maps? Shouldn't be impossible, after all Yoda Stories and Indiana Jones and His Desktop Adventures are graphical puzzle games with procedurally generated maps. Those create very basic quests, though. Basically drag items all over the map in a series of fetch-quests, with some rock-pulling puzzles thrown in, until you get the final McGuffin.

The generation code would have to be able to structure puzzles in order to make them solvable. Entering a temple would be hard if one of the required items (a key) were already inside it, for example. (Let's ignore puzzles that are based on manipulating items remotely for the sake of that example.) Designing flowcharts for that purpose is nothing new to regular text adventure designers. But how do you make the game more complex than the item hauls linked above?

I think you'd have to assign general qualifiers to every object, and to every puzzle. For example, a ventilation grille can be pried loose with any object with the "prying" qualifier, or screwed loose with an object with the "screwdriver" qualifier. A knife of screwdriver both have the "screwdriver" qualifier and a crowbar counts as "prying", so all those work.

Ergo, if the generator blocks off a part of the map with a ventilation grille, it should look through a list of ways to open it (items with the "prying" or "screwdriver" qualifier) and add at least one of those on the right side of the grille. This still doesn't quite create a Curses-level of puzzles. Also, when you add a new object or puzzle, you will have to go through all existing puzzles/objects to see how they interact with the new thing. (Do new qualifiers have to be added?) I will have to think more about this.

Finally, another concern is that about reasonable maps. The game will have to draw from a narrow pool of locations, otherwise you may get the top of Mount Everest next to the Japanese Pagoda next to the Garage. Sticking to cave rooms ala Colossal Cave is probably a decent approach.

2 comments:

Richard said...

Still got this tab open, so will post the comment now that the word verification is hopefully working :-)

This post reminds me of this post to rec.arts.int-fiction.

Another thought is that this makes me want a contest of some kind for writing a MUD server, where the goal is to get as much interesting procedural world interaction as possible.

Anders Hällzon said...

Hmm, MUD servers. Interesting. Vaguely like the NetHack and Crawl servers where you can fight the ghosts of other players, except, well, a MUD.