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:
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:
- A way to inform the player of his current state.
- A way for the player to change his current state.
- 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.