Culture / Programming Languages

How a Developer Converted Wikipedia into a Text Adventure

8 Jul 2017 9:00am, by

You’ve heard of interactive fiction? Last week, Kevan Davis, a London-based web developer and game designer, revealed what might be the first instance of “interactive nonfiction,” releasing a text-adventure game based on material from the Internet’s own encyclopedia.

Mimicking the interface of the classic text adventure computer games of decades past, “Wikipedia: The Text Adventure” uses JavaScript to create a sprawling, globe-trotting experience using nothing but descriptions from Wikipedia pages.

“I always enjoy how different the same data can feel when you look at it from a new angle or fit it into a framework that it wasn’t really intended for,” Davis told VentureBeat. “Wikipedia is always a magnificent rabbit hole of links, and the text adventure adds a few that weren’t quite there, a way to stumble into bits of history that were right next to something familiar, without otherwise having any connection to it.”

Every time you reload the Davis’ page, you get a new selection of starting locations for your journey. For example, there’s Bubblegum Alley, “a tourist attraction in downtown San Luis Obispo, California, known for its accumulation of used bubble gum on the walls of an alley.” Or the Big Banana, “a tourist attraction and amusement park in the city of Coffs Harbour, New South Wales, Australia.” You can even start your journey at The Tree That Owns Itself, an Athens, Georgia white oak which according to local legend has been granted legal ownership of itself and all land within eight feet of its base.

Davis has a few favorite starting points to recommend, according to Ars Technica — like Pripyat, the northern Ukraine ghost town by the site of the Chernobyl Nuclear Power Plant, which was evacuated in 1986. From there you can go north to the abandoned Palace of Culture Energetik, east to one of the city’s abandoned indoor swimming pools, or south to the abandoned Ukrainian train station in the village of Yaniv.

But for a cheerier adventure, I decided to start my imaginary journey at Disneyland, where I discovered that my choices included going north to the Enchanted Tiki Room — which unsurprisingly turned out to be “a pseudo-Polynesian themed musical animatronic show drawing from American tiki culture.” From there the choices for a next stop included “Adventure Thru Inner Space” and “Monsanto House of the Future” which, according to its description, actually closed in 1967.

Globe Trotting

But how does the script decide where to position its locations? The map is pulled live from the Wikipedia API when the user types “about” at the prompt. The script filters for Wikipedia articles that are specifying a geographic location — and if two places have the same location, they’re placed nearby in a random direction. “If you can’t find a particular place even though it has an article, then either Wikipedia doesn’t know its coordinates (in which case you can help Wikipedia out by adding them), or it’s not sharing them with the API,” the game site explained.

There are still a few odd glitches in Davis’s Wikipedia text adventure. For example, typing in the name of a state apparently takes you to its geographical center, where, for many states, there’s not always a lot of nearby landmarks to visit. When I typed “go Texas,” the only possible direction to travel was south, to the Northern mixed grasslands. And from there, the only possible direction was… north, to Texas.

 

Ars Technica reports that the project stemmed from a 2015 attempt to generate a novel for “National Novel Generating Month” that drew its text from Wikipedia’s API. Sample line from that novel: “We wandered to Elephant & Castle tube station. Imagine my surprise to learn it was approved on 25 July 1890! Passepartout asked me if it was given a private bill that would be presented to Parliament for the construction of the BS&WR, but I did not know. It seemed handy for the Bakerloo line… ”

“I’m always interested in seeing what else can be done with large, organized data sets, and the fact that Wikipedia’s API can serve up coordinates and summaries of locations around the world made it nicely suited to being explored step by step,” Davis told Mashable. “Wikipedia gives coordinates for historical events and long-demolished buildings, so there’s a lot to stumble across.”

Just like in a text adventure, typing “examine” before the subject of your Wikipedia page will also pull up more details about your location. It is drawn, of course, from the next paragraph of the Wikipedia page.  Typing “wiki” will bring up the original page from Wikipedia while typing “edit” before a page’s subject will take you to the page where you edit that page on Wikipedia. And typing “language” will give you instructions for switching to pages from a non-English version of Wikipedia. You can even jump to a specific page in Wikipedia by preceding its subject with “go.”

Because Wikipedia content is created under the Creative Commons Attribution-ShareAlike license — which allows the creation of derivative works — all of its text and images were freely available for Davis’s game.

Many of the game’s “locations” also display an image — the main picture of the Wikipedia page (unless that image is an SVG file, which the game rejects as “invariably being a boring map or logo”). There’s apparently also a few hidden features. “Mobile users can also tap on keywords in the summaries,” reported Ars Technica, “which isn’t as cool, but it’s a welcome alternative.”

Davis also told Mashable there was a minor Easter Egg shortcut “if you know the magic word.” While I haven’t found it yet, I did discover that typing the magic word from the original 1976 game “Colossal Cave Adventure” — “xyzzy” — will take you to its page in the game.

While fun as a traveling adventure, “Wikipedia: The Text Adventure,” admittedly is short on action. “There is a conspicuous dearth of Yeti/cowboy/alien-induced peril here,” joked the Londonist. “But it is a cute way to explore the city — plus the heavily pixelated images add some 1980s je ne sais quoi to the proceedings.”

David admitted to Ars that he never added a definitive quest. “It seems like people are having enough fun making their own quests — trying to get home from far-flung corners of their home town, walking between two landmarks in different cities, or collecting an inventory of particular treasures or oddities,” he said.


A digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.