Tuesday, February 5, 2013

Choose your own Closure

In another bout of nostalgic computing, I recently had the idea for a twist in the classic gamebook mechanics: instead of navigating an explicit menu of options, you play via a (web-based) text console in which you are free to type any command, using clues from the text of the current section. The engine then tries to match your input with one of the predefined options, yielding a gameplay more akin to interactive fiction.

Given that the options of a typical gamebook section are somewhat limited, it would be useless for the command parser to be very sophisticated. For it to be fun however (and not just an exercise in guessing), it has to be relatively flexible, which is achieved using different techniques such as synonym matching, spelling tolerance (based on the edit distance) and some other tricks. When stuck, it's always possible to reveal the section options:

Inventory and stats are fully implemented, and can be handled with textual commands:

as well as combats, of course:

Project Aon

The engine currently implements only the 53 first sections (in story, rather than numeric order) of the Fire on the Water gamebook (second in the Lone Wolf series, always one of my favorites), whose electronic version is available through Project Aon.

It's written in 100% JavaScript, and should run in most modern browsers (though I think there are currently some issues with Firefox, unfortunately). Although the code of the engine is open and available on GitHub, the gamebook content (as well as some of its logic, fully contained in a single JSON file) can only be hosted on Project Aon, given their copyright restrictions.

It's a work in progress (the current version is more than likely to have bugs) and if there is interest for it, I will certainly implement the remaining 297 sections of FotW. I could also study the question of making the engine more general, to allow the support of other gamebook series (although the current demo is tightly coupled to the LW mechanics, it would be relatively easy to modify). I plan to write soon another post to describe and explain some implementation details.

>>> Try it! <<<