Rhea is Coming Along Nicely

June 5, 2021

A while back, I introduced the ideas behind the game I’ve been developing called “Rhea.” That was way back in November of 2019 and I can hardly believe it’s been so long. During this time, I’ve been learning tons of new skills required to bring something like this to life. I never intended this to be a quick process as it’s a masochistically large project for a single developer to take on, but that’s exactly how I like it. I genuinely enjoy squaring up with a goal that seems insurmountable. I’ve touched on my motivations in past posts which are linked above, so I’ll not wax on about them again in this post. Let’s get to how things are coming along.

For the last nine months or so, I’ve been really busy with work, but I’ve had the time to put a few new things together after a recent architectural pivot. Being that I’ve never built anything close to Rhea in scope, I’m being very careful as to not build my house on sand, so to speak.

Initially when I started building Rhea’s backend, I decided to do so in a pure Elixir implementation as it was what I was most comfortable working and the scope of the game was much smaller, so at the time I felt that would be a sufficient foundation. At that time, I was planning on the product being a browser-based game in which the global game state updates every 10 or 20 minutes, much like games such as Planetarion. With this as my goal, I put together a prototype backend in which the world was alive and breathing. The system was spawning NPC pirate fleets that would automatically move around the game world and look for any player-owned fleets to attack. This was the first time the game world actually took shape, and I think it took me around 6 weeks to build. I was so excited with what I built, I thought “Let’s go bigger” and expanded the scope to turn this idea into a realtime game, abandoning the idea of 10 or 20 minute server ticks.

Setting out down the road of a realtime iteration of Rhea, I decided the architecture needed a rework as the backend would take on a form more akin to an actual MMO backend, which I’ve obviously never built. My plan was to write all of the networking code in Elixir and the majority of the game rules and logic in Rust and have them communicate via RabbitMQ. This was a silly idea, but I kept moving forward with it. I built a multiplexing TCP server in Elixir and designed a custom protocol to be spoken between the server and the game client. Ah yes. The game client. No longer would this be a browser-based game. I’d decided to build an actual game client in the Unity engine, which means yet another programming language would enter the arena.

I spent a good 5 or 6 months learning Rust which I fell in love with, re-familiarizing myself with C#, learning more about the Unity engine, etc until I realized I’d entered a quagmire in which my architecture was too complex and I’d never get out of the learning phase. I realized I had to slim down my architectural goals such that they were actually feasible for one person to accomplish.

About 2 months ago, I woke up on a Saturday on a weekend in which nothing but freezing rain was forecast, and set a goal for myself. In two days, I wanted to have multiple player fleets rendered onto a prototype game client and their movements be reflected on all connected clients– something of my own personal game jam. I went back to the trusty Elixir-only implementation of the backend and started hacking on the idea. I used Phaser to put together a really simple game client, and built the backend yet again in Elixir, this time designing it from the ground up to run in a clustered setting, using Mnesia tables as a distributed hot cache for game state, with a recurring process every two seconds to take a snapshot of the hot cache’s game state and persist it away into PostgreSQL as a “frame.” I was really stoked on this idea of “frames,” each of which is a snapshot of the game state at any given time. This would ultimately allow me to replay the game’s history as it happened in realtime. This and a number of other design decisions I landed on for this iteration felt like a really good starting point for a real, sustainable, and achievable design for Rhea, so I ran with it.

The prototype code I wrote for my 48-hour one-man hackathon is now the working base for developing the game. My Phaser based mini-client was and is great for prototyping, and I’m continuing to work on the server code. Once I finish working toward my current development milestone, it’ll be time to take on the initial design of the real game client in Unity.

This project basically has a life of its own, and I’d really like to start introducing the idea to people in relevant communities like the 4x gaming subreddit and see if this concept is something people would actually like to engage with. I think having a community of people contributing ideas to the project would help speed things along nicely.

That’s it for now. I’ll report back when there’s something to show that’ll make for really nice screenshots and videos. :)