Twitter Text Adventure Bot

Some while ago, I wrote the skeleton to a text adventure game that was played by Tweeting at and receiving responses from a Twitter bot. You can find the initial version on my GitHub. The idea was spawned by a friend and I quickly turned it into a working prototype, it was also a good chance to learn about web APIs (with JavaScript/Node.js in particular) and OAuth. It’s initial iteration worked, but was plagued by some major user experience issues. In particular, the inability of users to tweet the same thing in a short space of time (such as repeated directional commands) and the same inability of the bot to tweet the same thing to a user in close succession (such as location/refusal responses) hampered play. The latter was solved by appending ~4 randomly generated junk characters to the end of the tweet so as to avoid duplicate tweets. The former possessed a bigger problem though, as requiring users to do the same would break engagement and flow-of-play quite heavily. To create a play style that would work for users we decided to try and make the game more focused on using and examining different objects, while moving to a new area was signified by “go to [x]” and the labels for were generally different to prevent common duplication.

The script works by waiting for tweets directed at the bot, then checking the Twitter user’s unique ID (not their username, which can change) for an existing match in the database and creating a new user entry if not already available. For existing users, the game analyses the tweet for specific phrases based on the “room” that the player is in and the objects available in that room. If a key phrase is matched, it may set/remove flags on the user account (or shift them to a new “room”) and return with a description; precluding/required flags can alter how a transaction is processed.

The current iteration of the game is still in development, both the engine itself and the story which it weaves. A demonstration version is currently running on @140charADV, so feel free to tweet at the bot and try out a test level. If you have any problems, tweet me @adamjogrady and I can look into it for you.