Ben Hallett

Game developer & web programmer



Phable is my attempt to port Kate Compton's Javascript procedural story-generation library Tracery into PHP. It takes a JSON file that specifies a "grammar" containing all the sentence fragments that are used to generate an entire story and generates random "traces" (paths) through that grammar. The result is a story (or a paragraph or a sentence) that's different every time.

I've written a few demonstrations of Phable in action:

  • Otherspace scanner [grammar] - A scanner that surveys another, uglier plane of existence congruent to our own, and reports the results. This demo uses Geolocation to set the seed used by the random story generation process, meaning that you'll always get the same results from the same location, although locally occurring events may slightly alter over time...
  • The Next Big Thing [grammar] - Generates humorous pitches for new freemium videogames, complete with lists of emotions that the design is expected to evoke.
  • International super-spy codephrase generator [grammar] - A tool for Cold-War-era spies to generate secure codephrases to authenticate their first contact with a friendly agent in hostile territory without alerting nearby civilians that anything unusual is going on. This was a tool I built for a (now-defunct) narrative game project that would require two players to "pair" their accounts in order to play through the story together. The intent was to generate one of these phrases for each player, which they could then give to their counterpart to enter on the website to pair their accounts. The grammar already provides a fairly high (55,013,376 possibilities) level of information entropy, although it might need a few more additions in order to guarantee picking a unique passphrase for every player if the game were extremely successful.
  • Carmack Tweet generator [grammar] - A completely accurate simulation of the Twitter posts of programming uber-genius John Carmack.
  • Lord name generator [grammar] - Another aborted feature, this was a prototype for a system where new players joining an online game would not initially be prompted to set a name for their character, instead being randomly assigned a unique lore-friendly name, allowing them to skip straight to the fun part of actually playing the game rather than trying to think up a cool name.
  • Macguffin generator [grammar] - Who needs complex writing and story structure? Certainly not MMORPG players.