Friday, December 25, 2009

Status Update.

Mystery machine finally got its packfile save and load methods over the Yule weekend. My next task is to move all the existing print statements into a python log object so that the debug messages et al can be managed sensibly. Then will look at a bpython integration so that MysteryMachine can at least be experimented with by extreme geeks.

Wednesday, December 02, 2009

Writing Freeform games

The main sink for most of my free time last year (up till November 2008) was a freeform game set at a Victorian wedding. I ran it with a small number of players -about 25% the available spaces and consequences that November.

This was the first fully plotted freeform I tried to write, although it wasn't the only one I did during that period as it overlapped with my first visit to Peaky.

After getting back from Peaky looking at what I had done was an eye opener. I realised how little I had actually done. I also began to find my everything in one file approach was finally reaching the end of it's usefulness.

Now I normally start projects with an everything in one file approach then as I have ideas I can jot them down in that file and can move things around easily. However after a while it will become unwieldy and I expected that.

The question though became what is the structure I need to move on to. I asked around, some people could apparently use databases others just used word docs and the magic of cut and paste to move paragraphs between files.

Now for those of you who aren't familiar with Freeform games , or the writing of them - Steve Hatherley provides a overview of the process here , and his site contains a wealth of other tips on writing in this genre.

There a couple of interesting quirks to this process - notice you don't use the final document or even a version of it to search for plot problems. You have special plot document which is not part of the 'deliverables'1 of the project.

Another quirk which is not so obvious is that sometimes quite late in the design you need to change elements of the games which are fundamental the the grammar used tin the descriptions of them, the classic example is the gender of a character - you need to change the characters gender and name because you haven't got exactly the right mix of Men & Women signed up and you need to make a few changes. So you swap a character gender and change it's name and that sorts that.

Except you now have to go through every document you written look for any references to this character and change it those appropriately too. Taking care not to miss any.

You don't need to be a genius to see that there are opportunities for automation here. From search and replace to XML based character definitions , too something a whole lot weirder. Which is of course what I did.

First off lets look at what's wrong with XML and the answer is not a lot but I was writing a game not writing Game writing software.

So I was not wanting to write a huge parser and complex programs to deal with finding the element to replace inside a XML doctree replace it, and reseriallise the XML . Also I find that the XML/HTML/SGML type tags do interfere with the layout on the page - and hence the creative flow a little bit.

I've been using resturctured text , or something similar as a format since before ReST was formalised . So I can think easily in that format - which makes it natural for me to keep my documents in that format, particularly since it has good pdf and html publishing tools.

That leaves actually doing the replacement and as far as I could see a the time ReST doesn't have macro support (more on this in a later post). But it seemed simple to used some unusual character to create and escape to a small macro parsing utility.

I restricted the macro language to just simple value substitution and the ternary operator. The only boolean expression which I needed to implement was equality. The most recent version of the parser alone is here at the Mystery Machine repository.

One additional element was required and that was a script which produced character sheets and plot summary documents. But more on those and the storage model in a later post.


  1. Well technically there they may be deliverables by which I mean documents useful to the running of the game, as they can be useful to the gamesmaster. But the primary documents are the character sheets.