DEAD HORSE v1.0.0

Today I launched my first video game, DEAD HORSE. You can play it on the internet here or grab the source from the project’s GitHub.

DEAD HORSE is a text adventure that takes place in real time, drawing inspiration from series like Animal Crossing, Peasant’s Quest, and Thy Dungeonman.

The History of DEAD HORSE

In 2014, I made a game called Horse Simulator for a class on C#. Horse Simulator was a text adventure about a horse who dreamed of becoming a rockstar like his hero Horse David Byrne from the band Horse Talking Heads. At the start of the game, an electric guitar falls out of a nearby tree, and the horse soon goes on tour. It was coded in C# and built as an .exe file for Windows. For quite some time, I wanted to remake the game as either a web or cross-platform app.

The other precursor to DEAD HORSE was an idea I had for a game tentatively-titled Ghost Crossing. This was to be a 2D game taking place in the same universe as my short-lived webcomic Ghost Princess, and would essentially be an Animal Crossing clone set in the afterlife. I drew a game map in my journal with a list of locations I came up with, which wound up getting largely adapted into the world of DEAD HORSE. Additionally, I wanted Ghost Crossing to have a real-time tidal system, with certain areas only being available at high tide or low tide, and special events occurring on new and full moons. I wanted to take the real-time nature of Animal Crossing to the next level by having the gameplay rely on the player’s awareness of real-life cosmological and geophysical phenomena.

DEAD HORSE began life as a remake of Horse Simulator. Very quickly, however, I realized that I didn’t want to just remake a game I coded a decade ago – I wanted to make Ghost Crossing! So I decided to combine the two ideas and make a real-time text adventure set in the afterlife where you play as a horse. DEAD HORSE!

Coding DEAD HORSE

I coded DEAD HORSE in about 1.5 weeks, using Flask for the server and HTML/CSS/JS for the frontend. I used ChatGPT to generate much of the code, allowing me to quickly get up and running with a framework I’d never used before (Flask). I’d say the final code is about 70% GPT and 30% my own work. The content of the game, save for two NPCs, is all my own work. [0]

I opted not to use any existing game libraries because I had a particular vision for this game and wanted to get right to coding it without having to learn something new first. However, as you might imagine, this meant the code developed haphazardly and wound up quite messy. Next time, I’ll probably try working with an established library/engine to streamline things. I’d like to learn GameMaker and make a graphical game – but that’s for later.

As far as dev tools go, I used vim to write code and tmux to keep a local server running. I’ve been a big fan of vim for a while now and learned some new stuff while making DEAD HORSE, including the c-X c-L command for whole line completion. The vertical selection capability of visual mode (c-V) came in handy several times, too.

[0] Eliza is from the excellent Python implementation of the Eliza chatbot released under MIT license by Wade Brainerd. The Monk’s dialogue is mostly ChatGPT, giving him a slightly-uncanny vibe that I thought was perfect for his character.

NPCs

I wasn’t totally sure what role NPCs would play at first. Somewhere along the way, I remembered having read about the Eliza chat bot, and wondered if there was an open source Python implementation I could use to have interactive conversations with NPCs. Sure enough, I found a great implementation on GitHub and was able to integrate it with the DEAD HORSE codebase. Integrating Eliza was exemplary of my experience with ChatGPT for this project: I pasted the entire 250+ line contents of `eliza.py`in and asked it to show me how I could modify the code to return the bot’s response as a string. It was able to identify the function that I needed to edit, but it wasn’t able to do the correct edit on its own. However, with it able to quickly point me to the exact portion of code that needed to be edited, I was able to drill down and figure out the correct changes myself without having to look at the rest of the codebase.

The chatbots work by looking for keywords in the user input, then matching various patterns based on where those keywords appear. This allows the NPCs to “converse” with the player, using words from the player’s input in their own responses. It’s a little wonky, but I think that’s part of the charm. There’s a certain vibe to the old-school chat bot that’s lost with the hyper-polite, grammatically-correct ChatGPT. Where better to lean into the old-school vibe than a text adventure?

Saving the Game

Figuring out how to save and load the game was the most difficult part of development.

I initially wanted to save the player’s progress in the browser as a cookie. However, I ran into a major bug where the cookie size would keep increasing with playtime until it eventually reached the browser limit of 4093 bytes (positively tiny!). After much frustratingly unsuccessful debugging, I resorted to plan B and stored player progress in a .CSV file under a UUID.

Then two days later I fixed the bug at 2:30am. D’oh!

By that point, I had already edited the entire codebase to save and load using the .CSV file, so I wound up broadly keeping that approach while using cookies in a limited capacity to minimize read/writes.

Hosting DEAD HORSE

DEAD HORSE is hosted on DigitalOcean using their app droplets. I found the experience very pleasant – you can plug in your GitHub repo and it will automatically update and deploy a new version every time you `git push`.

I initially tested hosting DEAD HORSE on AWS free tier, but found their interface to be needlessly complex for my simple task. I spent a while figuring out workers and managing permissions. Funnily enough, the thing that made me give up on AWS was when I couldn’t manage to get SSL working for my subdomain. Didn’t run into this issue on DO – I was up and running with SSL real fast. Unfortunately DO doesn’t have a free tier, but $5/month isn’t too bad for now.

Launching DEAD HORSE

So, yeah. DEAD HORSE is now live. Woohoo!

If you play it, I’d love to hear your thoughts and feedback 🙂 Thanks for reading!