Building an Escape Room Bot for Discord

Building an Escape Room Bot for Discord

Myself and a buddy from Uni teamed up for one of our projects for "Building Information Technology Systems". It was a vague enough course with little direction and very limited guidance, but it also meant we had a lot of freedom to create something pretty cool. Most of the teams had four people in them, but due to Covid attrition, we lost a couple of our teamsters quite early on - but not before we had agreed to build an Escape Room style game for Discord.

It was an ambitious enough project for four people, let alone just the two of us, but Tim and I work well together, we mapped out what we needed early on and ensured we put the extra effort into our design document and artefacts, as well as detailing our Minimum Viable Features (MVF) and Extended Viable Features (EVF) to ensure clarity and containment of ambition.

In addition to hitting our targets, we also had to ensure we had plenty of time for our final report and - despite being quite bonza at Scrumming it - we had a very dictatorial Trello board, and weekly tasks that had to be tackled to satisfy the class requirements.

Minimum Viable Features

  1. Code Bot Framework
  2. Location Based Movement
  3. Item Management System
  4. Story Driven Gameplay
  5. Deploy Discord Bot

Extended Features

  1. Save Game / Save States
  2. High Score Leaderboard
  3. Theme Music

MVF1 - Code Bot Framework

Early on we determined we would use Python for our bot, we were quite familiar with the language so that was an easy decision. For the most part Tim coded MVF 1 with myself just helping here and there; I had to review the code constantly though so I could understand what was being done so the pieces I was working on could fit seamlessly. Likewise Tim had to review my code for the same reasons. MVF1 was all about starting and stopping the bot and having it respond to various commands. For flexibility, Tim created the framework to allow multiple plugins / containers to be written and maintained independently, thus allowing me to write my part of the code without having to constantly mess up Tim's work.

MVF2 - Location Based Movement

MVF2 basic artefact.

We needed our game to have some dimension, ie, we didn't want to be simply stuck in one room typing "look for clue". So we let our imaginations fly a little and thought about how we could let the user move around an entire house; even in a text based game! I took the reigns on this one and developed a very basic system that allow us to create a series of rooms, the rooms would then be connected by doors, the doors would be locked or unlocked, and - if all the doors were unlocked - the user would be able to traverse the house quite freely. The rooms (and the items in MVF3) were all stored in and retrieved from a PostGreSQL database.

Our house - green doors were unlocked by default at the start of the game.

MVF3 - Item Management System

If you can't hoard is it really a game? The item Management System was initially "someone else's job" but when they pulled out Tim and I tackled this one jointly. It was quite simple; we created a list of items and an initial location. If the user was in the same room they could inspect an item, or even pick it up. If they had room ion themselves they could even keep the item. This simply changed the items location (for example) from kitchen - to - backpack.

MVF4 - Story Driven Gameplay

This one speaks for itself really, we needed a bit of a story as to how the user got stuck in a house, I'm certain it was Tim's brain that came up with the idea, I immediately loved it and we implemented it. Bearing in mind this is a text based game, we had one chance to hit the user with a scenario at the start, and could use limited text to do this.

MVF5 - Deploy Discord Bot

Our bot deployment diagram

Boy oh boy did we have to do some crash courses for this "simple" project! Databases weren't new to us, but Docker, and deploying on Amazon certainly was. I handled most of the deployment config as Tim was compiling the report and tweaking code. I decided on two docker containers, a generic PostGreSQL one, so I didn't need to maintain that myself and it separated the database from our production environment, the second container was the production environment minus the code. Deployed both containers to AWS EC2 virtual machine running Ubuntu Operating System, and added Git so our code could be maintained in the file system of the server - without having to tamper with either of the containers.

Game Execution and Summary

After adding the bot to Discord we found it worked quite well. It was fun, albeit limited. Ultimately the goal wasn't to build an in-depth game, but to design and build an IT System and we achieved that.  Unfortunately we both got busy another projects and no longer maintain the bot, this was inevitable as it was a temporary project for Uni rather than a shimmering light on the horizon about to make us into millionaires! We've both made other bots but I don't think any of them have been as complex as our EscapeBot!

The EscapeBot Team

timpower90 - Overview
GitHub is where timpower90 builds software.
JayArghArgh - Overview
Full Stack Developer who enjoys identifying opportunities to reduce costs, increase efficiencies, and drive new ways of working. - JayArghArgh

The Code

https://github.com/rmit-teamawesome/escapeBot