Interactive Fiction Player

Today, I invented a new scripting language for interactive fiction.

I also wrote a console application in C# to play these scripts.

The script is XML based and has a schema like the following:

<rooms start=””>
<room name=””>
<include name=””/>
<set flag=””/>
<clear flag=””/>
<if flag=””>
<ifnot flag=””>
<option destination=””></option>

The player is about 150 LOC, does practically no error checking, but implements the full schema.

This was an idea I had some time in the last week.  After reading Atwood’s CYOA post (where he quit his job), I thought about all of the Choose Your Own Adventure books I had as a kid, and similar books which are now referred to as interactive fiction.

And so I came up with a minimal set of functionality I would need to make my own IF language.  I figured I needed:

  1. A way to inform the player of his current state.
  2. A way for the player to change his current state.
  3. The ability to have conditions that can be set, cleared, and tested

So, at the moment, I have a total of nine tags that the player can process.

  • rooms: this is the root tag of the document, and contains all of the rooms.
  • room: this represents a story node.
  • text: the contents of this tag will be displayed to the user
  • option: this represents a choice the player can make.
  • set: this will set a flag variable
  • clear: this will clear a flag variable
  • if: this will execute the commands within it if a flag variable is set
  • ifnot: this will execute the commands within it if a flag variable is clear
  • include: this will execute the commands inside of another room

The “include” tag is not strictly necessary, but I put it in there to ease writing of scripts.

So, basically, I have written an interactive simple preprocessor.

Once I have a demo-able script, I’ll share it.


One thought on “Interactive Fiction Player

  1. While infocom-like games never really endured for me past a couple of hours, I do like the idea of a computer-based choose your adventure book. Rather reminds me of those pre-Infocom multiple choice adventure games that we all wrote before we learned how to make a decent verb-noun parser.

    And, like the choose your adventure books, it should be amusing for about an hour.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s