Key & Compass Blog

February 20, 2011

Another type of text adventure: data management

Filed under: IFWiki, Interactive Fiction — davidwelbourn @ 6:55 pm

My last post was when? Never mind. Today I want to talk about data management.

Until now, I’ve been managing my private collection of interactive fiction data as a plain text file with the scintillating name “gamedata.txt”. I originally created it to help me generate HTML pages for what is now called my Key & Compass website. And, not having the newest of computers (nor all that much hard drive space, nor fancy software), a text file was really the way for me to go. The basic design was one record per game, and a list of key:value pairs delimited by or-bars. Cheap and simple.  For example, this was (until recently) what the record for one of my games looked like:

gid:kraka02|g:Krakatoa Tuna Melt|fn:David|ln:Welbourn|yr:2002|sys:z5|evg:Speed-IF|ev:SpeedIF 10^−|vers:r2|ifid:ZCODE-2-021215-1E6E|tuid:b6fz0awms527hja0|b:2071|r:2007|wc:W+m|w:sp/sp_10-9.html#davidw|x0:b2071|rline:Release 2 / Serial number 021215 / Inform v6.21 Library 6/10

Over time, my needs evolved—I started assembling the games list for the XYZZY Awards, then became the de facto admin of IFWiki—and gamedata.txt had to evolve too.

During January, I gave some thought to the name fields: fn (firstname), ln (lastname), and sfx (suffix). About the only advantage I had from them was I could sort by a single author’s surname, but it was very poor if I wanted to record multiple authors, publishers, or porters. So I thought and thought and I kinda liked how IFDB used curly braces after author names to record their TUIDs, so if I wanted to say “Nick Montfort {as:porter}” or ‘Marius Müller {as:”Taleslinger”}’, I could.

So I abolished the (fn,ln,sfx) fields and started replacing them with (na,mult,pub,test,adap) fields for authors, multimedia contributors, publishers, testers, and adaptors respectively. (By adaptors, I mean porters and translators). Names would be delimited by semicolons, subfields would be delimited by commas, and the curly braces would enclose the subfields.

Choosing semicolons as delimiters meant that I could no longer use them in HTML-entity style sequences, so I borrowed Inform 7’s square brackets for substitutions, and so “Müller” became “M[uuml]ller”. And I had to invent [c] to mean comma in one case where it was needed in a subfield value:

na:Jonathon Rosebaugh {as:"His Imperial Majesty[c] Shortwinker the Fifth"}

Oh, and I also invented ^ to mean a non-breaking space in names where the “surname” is two or more words. “Surname” can also mean a pseudonym in its entirety, not counting leading articles.

About a third of way through editing gamedata.txt via Notepad, I got disenchanted with the curly braces. Although they were fine for readablility, I worried about parsing the darn things when all I wanted was a delimited between name-proper and name-details. So I chose a pair of plus-signs for the honour. A bit uglier, perhaps, but I thought I could live with it.

na:Ryan Stevens++as:"Rybread Celsius";Cody Sandifer

And then I realized that I had all but re-invented the ?key=value&key=value format at the ends of URLs except I’d chosen different delimiters. So that gave me a little confidence that I wasn’t completely mad.

You may be wondering what subfields I’m recording per name. Well, lessee…

  • as:  For the name they chose to write as.
  • aka: For another name the person is also known as, especially for ADRIFT authors where the real names aren’t as well known.
  • role: For noting how the person contributed. For example, in the authors field, I might want to specify writer or programmer. In the adaptors field, I want to know if s/he’s a porter or translator.
  • wna: His/her article name at IFWiki, if needed.
  • pre: A bit of notation to display before the list of names.
  • sfx: A bit of notation to display after the list of names.

So, all well and good. Except then I decide to chat a little about this on ifmud, and after the usual queries about why this isn’t in a database, someone told me about JSON (see json.org).

So I thought about it, and how ugly my gamedata.txt file is with respect to competitions and versions of different games and links to other sites, etc. … and so I’m moving all my IF data into a file with the scintillating name of gamejson.txt.

And when it’s all ready, I’ll let you all have a look at it, eh? And maybe I’ll make another post too.

Advertisements

May 20, 2010

IFWiki raw scribbles

Filed under: IFWiki, Interactive Fiction — davidwelbourn @ 7:12 am

Recently, I’ve been scribbling down notes on overlarge index cards to remind me of things to do. In case people are curious, here’s what my IFWiki cardset currently looks like (and I wish there was a  ✓ character — hm, I suppose I can use √): (more…)

Blog at WordPress.com.