Amy Guy

Raw Blog

Sunday, May 13, 2012

UI for IF


This is the first in an upcoming series of posts about my final project for my MSc by Research.  For those who don't know, my programme is Interdisciplinary Creative Practices, or ICP for short, and my main focuses so far have been on Interactive Fiction (IF) and the Web.  My final project needs a log book.  Traditionally such a thing would be compiled by me at the last minute based on notes scattered around my workspace, emails to myself and entries on Google Calendar and Tasks.  It's high time I got a grip on my organisation and did this properly, so blog posts tagged "icpLog" will help me keep a proper track of ongoing thoughts and progress.

For my final project, I endeavour to create in a "location-aware Interactive Fiction engine".  If at this stage you don't know what IF is, read this nice description by Emily Short.

Historically IF is programmed using one of several specialist languages along with specialist software packages.  The one I am most familiar with is Inform 7, a brilliantly simple but incredibly powerful natural language.. language.. which is perfect for non-programmers who want to create IF.  I haven't actually made anything myself with Inform yet (I plan to, in the name of research), but I have read a lot of source code and tutorials.

Similarly, IF is traditionally played/read on a user's computer, in their local environment.  The open source JavaScript IF interpreter, Parchment, brings playing IF to the Web; much more flexible and shareable, and enabling of many possibilities.

One such use of Parchment can be seen in Playfic, which appeared around March this year.  Playfic offers a fully in-browser Inform development environment for authors, similar to the Inform software the experienced would be used to running on their own machine.  And of course, an online read/play interface for the IF consumers.

This interface affords the user the chance to share their work-in-progress with the IF community.  The source code for all of the games can be viewed, making it really easy for newcomers to learn how to get started, and for anyone to figure out how a particularly creative experience or interesting quirk has been achieved.

One of the aims of my project when I laid out my ideas last October was to lower the entry barrier for prospective new IF authors.  Having spent several years weaving in and out of technical and non-technical environments or groups of people, it's plain to see that even Inform might be daunting to some.  Whilst it appears like uber high-level natural language to us programmers, for a writer, things like verbose if statements, oddly structured sentences and repetition of logic that would be inferred by a human from just a few words, can be pretty alien.

In other words, the programmer in me looks at Inform source code and sees prose; no complex syntax to remember, and logical and basic programming concepts.  The writer in me doesn't see prose; she sees awkwardly formed statements and struggles with maintaining the fluidity of a story whilst attempting interlace it with conditions and behaviours of things.

I'm sure if they work together, they can figure something out.

But more importantly, I'm sure my creatively split personality can offer some useful insights when it comes to designing my own online interface for IF authoring.

During a few weeks in April this year, I built the first iteration of Palimpsest, as my project is so named, around the requirements of some folk from the University of Edinburgh's English Literature department.  Concentrating on the 'location-aware' part and ignoring the 'Interactive Fiction' part, the current alpha allows the author to input bodies of texts and allocate them areas on a map.  The user, upon starting a particular 'experience' on their smart mobile device, could wander around a particular area and have these texts dynamically pushed to them, to read in the surroundings intended by the creator.  English Lit. are using this to deliver historical and contemporary literary works written or set in Edinburgh, as part of the celebration of 250 years of Edinburgh literature.  There's more work to be done for them before it meets all of their specifications, and it'll be premièred during the summer.  I built it on Google AppEngine with Python and jQuery and at the time of writing anyone can sign in and create an 'experience' for their own city, at http://palimpsest.rhiaro.co.uk.

It's time for the project to branch, as I must turn my attention to the IF side.  I will be pondering the source code of Nick Montfort's Curveship for inspiration about processing user input (one of my initial ideas was to adapt Curveship itself to add the location-aware aspect and a Web interface, but the complex narrative stuff that Curveship does goes waaay beyond my needs, and I think that would end up being more complicated than starting from scratch).

I will also be filling my flat with paper sketches of user interfaces for the authoring of Palimpsest works.  I need ways to model characters (playable and non-playable), locations and connections between locations (shouldn't be too hard, as this will be based on the real world), objects and their properties, and interactions with objects and characters.  I have so far concluded that I need a system of actions and consequences; I should be able to apply this to everything.  Most importantly, I need to a user to be able to input this information as if they were writing a story.  Obviously there will still be some differences; it may be a disjointed story, spread across a series of input fields.  But there won't be any degree of programming syntax, or unnatural prose.  The system needs to do that work, and help the author to put the right information in the right places to allow this.  For the programmatically-inclined, we could perhaps consider the writing of a traditional story (novel, etc.) as procedural writing, and the writing of a Palimpsest interactive piece as object-oriented writing.  Maybe.  We'll see how that analogy holds up as the project progresses.

In terms of functionality, all that I'm really changing compared to regular IF is stripping out the directional commands - north, south, east, west, and alternatives - and replacing them with physical movement.  The system will know where the rooms in a particular story are on a world map, and the wonderful HTML5 geolocation API will know where the player is (once they've given permission for Palimpsest to track their device).  I've already done this.  It works.  There are varying degrees of accuracy.  If you're in a building, you're looking at between fifty and two hundred metres of accuracy, depending on your device.  Outside, I had it accurate to three metres, and the average was five to ten.

Now all I need to do is... everything else.  The idea of building an IF engine from scratch is pretty daunting, especially given the huge complexity of actions people can squeeze out of languages like Inform.  Palimpsest will have nowhere near these capabilities, not at this stage, and I need to remember not to get hung up on that.  I'll probably leave out scoring, and whilst saving progress is a must, 'undo' won't be a priority.  With Inform you can create random events and complex algorithm-based behaviours of objects and characters.  That's not going to happen for Palimpsest this round.  I also can't shake the nagging inferiority I feel thinking about the usefulness of the Inform development environment in letting you visualise paths through your narrative to check for bugs and dead ends.  My subconscious will be working hard on a solution to that, but I can't hope too hard for it to be an outcome of this stage of the project.  Based on the actions-consequences idea, it would probably be feasible to generate a flow chart of some kind to help an author fish out paths through the narrative that don't work.

As anticipated, writing this post has helped my brain spin into ideas mode.  Likely before the day is out, I will post again with some doodles and diagrams and a more solid idea of how to make this UI work.

Comments, questions and suggestions welcome.
At 1:54 pm Serrah said...

do you mind if I re-post this on my blog?