Twitter Plays Zork: @DemocraticZork

Multithreaded JavaScript, O'Reilly 2021, is available for early access and pre-order!

I just finished an early version of a Twitter Bot which generates playable Zork-like levels and post them via Twitter. Levels can be interacted with by replying to the bots tweets.

You can check out the bot at @DemocraticZork on Twitter.

The game itself was inspired by a recent conference I attended called Roguelike Celebration. This conference covered a lot about Procedural Generation, and near the end a few people talked about their Twitter bots which would generate random Emoji scenes of gardens and forests and fishtanks. This bot is sort of an amalgamation of several concepts covered at the conference.

The level generator can be found at github.com/tlhunter/node-roguelike. This is the Grid with Keys and Locks Level Generator generator. For terrain generation I am using a perlin noise generator, dividing the results into different “strata”, and then grabbing a terrain type from an array. This helps ensure similar terrain is likely to be adjacent and the map has a more natural flow to it.

The room adjectives are randomly selected from an array of predefined entries, classified by terrain type. For example a Cave can be Damp, a Meadow can be Gloomy, etc.

When deciding actions to perform I simply poll for replies on the last created tweet. The most popular action wins.

If the project is popular I will keep updating it. Some improvements I'd like to make include adding a minimap, puzzles, bad guys, and if the Twitter API ever supports it, creating polls for voting for actions.

Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript, is an O'Reilly published author, and is an organizer of NodeSchool SF.