Imperilus tech stack

ImperilUs Tech Stack for Text Adventures

ImperilUs is currently a Rails monolith, but has been designed to flexibly scale if required. Here's the bit and pieces, and the reasoning behind each.

The backend - Ruby on Rails and friends

Rails has been around for 20 years, and I've been using it for 15. Ruby is a lovely language to work with, and Rails is a solid and fast to iterate with platform. I love it. It's a little sad that it's operating almost solely as an API backend for this app.

Tied in with Rails are Postgres for a database, which has good support for JSON as well as relational data. I use JSON to store stories and relational aspects, with Rails ActiveRecord for housekeeping and data access control.

The backend feeds JSON to the frontend which is, somewhar ironically, served from the same place as the backend.

The Frontend - React and JSON

On the Frontend is a TypeScript coded React site using TailwindCSS which has two main aspects – the creation and playing of stories.

Creating text adventures

Creators are presented a fairly traditional we site where they can create a story, add pages describing an enviromnent, add obstacles a player passing through an environment, and presenting a player with optional ways forwards if they pass.

Pages are written in Markdown, a super easy way to create text that looks good on the web, and can contain images.

React Flow is used to present the creator with an overview of the page flow within a story, and to show where the story is incomplete.

Playing text adventures

Players can open a story, which comes through as a JSON file, they play through the whole story without needing to access the server again (except for loading images which come through AWS). Instead, a simple JavaScript engine resolves any conflict or randomness for each page.

This takes most load off the server and places it on the player's browser. This means the server can run much lighter, and I can pay for it without breaking the bank while getting the site established.

The only potential issue with this is that players can alter the JavaScript on their machine and effect gameplay. Cool :) It's only on their browser and good luck to them – I loved mucking around with game code when I was a kid and I hope they have fun!