Wednesday, May 6, 2009

Towards procedurally generated content in Inform 7

Recently, there was a bit of newsgroup discussion about procedurally generated content, and how this has been a relatively unexplored field in IF. Which is curious, because text, at least in certain forms, is a lot easier to procedurally generate than most other media.

The discussion was a happy coincidence, because this is something I've been interested in and playing around with for a while. In the process of this playing I've created a pair of low-level extensions, which you can preview at the links below and should be appearing on the Inform 7 Extensions Page before long.

Procedural Randomness lets you create predictably random sequences of text, so that for instance you could have the walls of a room be random but consistent colors:

set seed to location;

say "The walls are [one of]green[or]white[or]red[or]fuchsia[or]maroon[with procedural randomness].";

Every time you returned to the same location, the walls would be the same color.

The second extension, Dynamic Rooms, makes it easy to create and destroy rooms during play. (It's so easy because the extension's just moving around a stock of unused rooms, rather than fiddling with creating objects in memory, like the more advanced Dynamic Objects by Jesse McGrew.)

Understand "dig [a direction]" as excavating. Carry out excavating: let rm be a newly created room noun of location with name "Cave".

Neither of these are terribly exciting in and of themselves, but will serve as the bedrock underneath more elaborate extensions to come (which in turn were spin-offs of the really interesting problems I'm working on). I'm also curious to see what other uses other people put them to; I'd also love to hear from anyone with ideas, suggestions, or similar work along these lines.


emshort said...

If you're looking at this kind of thing, you might also be interested in Jim Munroe's game/journalism piece "Game Developers Conference 2009" ( ) -- as far as I can tell, it autogenerates characters and their interests, and then applies some mostly-straightforward social rules to determine how everyone interacts.

Scixual said...

When we do our collaborative project, a lot of this will have to be your doing, but it's fascinating. (hint: the Well is languishing)

Ron Newcomb said...

Is it possible for the [one of] tag to absorb the seed, like [(seed) has one of] or some such?

Aaron A. Reed said...

Ron-- as far as I know, you can't include this kind of construct.

Wiley said...

I've been looking for something like this to procedurally generate npc's with randomized names and attributes. It would also be huge to procedurally generate maps that are different on every runtime, but consistent during the course of each playthrough.