Matthew Odle

Colony Sims for Miles: Round 6 of That Colony Sim I Keep Starting Over On

☰ Table of Contents


This is the 6th iteration of this idea.

I finally realized the term for type of game I’ve been failing to finish over and over is ‘Colony Sim’.

I have loved these games since I was a kid, but didn’t really experience many until the last few years. I spent hours and hours playing SimAnt, but that was about it. Later, I played Age of Empires and Empire Earth, but really only enjoyed them for their colony management features, which are limited because the core of the gameplay was RTS combat, which I was not very keen on.

Somewhere around this time, I discovered A Dark Room, which is an entirely text-based colony management/exploration sim written in javascript, available free to play on the web, and it still has an active contributor community. This one game was what drove me to build my programming skills. I wanted to make something this awesome.

Then I moved away from these games for years, busy with life and work, until I discovered Banished. The first few playthroughs were brutal, and everyone died from cold and hunger. I figured out how to survive the initial bottleneck of food and shelter, and I was hooked.

A few years later, Frostpunk was released. It is dark, brutal, and unforgiving. It makes you feel bad for choices you make between two bad choices. It’s a race against time. And the aesthetic is superb: the planet is locked in an eternal winter caused by a weather controlling experiment gone awry, and you must keep the last vestiges of humanity safe by managing one of the last remaining thermal generators, which you must build your colony around.

ore recently, I finished Autonauts and Planetbase. The former is a chill, gentle gameplay experience where all the robots are happy, and the latter is full of starving and asphyxiation and meteor impacts.

So I’ve been gathering these experiences and periodically trying to make something that possibly, someday, might remotely resemble them.

Some playlists

Iteration 1 - React for some reason, in the browser

I was learning react. I don’t want to deride it too much here. Let’s just say… JS is a frustrating experience.

So, I was learning react. A couple of the key ideas with react are state and polling. These are things games need, so I learned react by making a game. I really liked how CSS elements were stored as objects that could take variables, which gave me the idea to use CSS rectangle fill % as a progress bar.

Resource Quest was born. I modeled many of the game concepts off of Banished: food and firewood to survive, tools and clothing to survive easier, colonists to allocate as optimally as possible to achieve these goals. The UI style is modeled after A Dark Room (superb game). Resource Quest is playable here.

Iteration 2 - Unity with minimal sprites, on Android

React was pretty limiting, and I felt that the first iteration was mostly complete. I was learning Unity and thought it might take the game idea where it needed to go. I had a ton of fun with this, and ended up with something that’s actually pretty playable. It has a lot of problems, such as lack of direction, no mid- or end-game challenge at all (once you have the balance figured out and resources stocked up, it’s nearly impossible to lose), a production overlap problem that limits output after a certain speed and colonist quantity.

Here’s a demo video.

I often got hung up on the complexity of the code needed to position everything correctly, and had problems with devices other than my own changing the experience drastically, since progress was based on the screen width. I decided I didn’t want to mess around with Android, and instead try desktop.

Iteration 3 - Unity with 2D sprites, on Desktop

I wanted to try something with sprites actually constrained in a 2D world, having to travel to gather resources, etc., closer to Banished. I had a reasonable time getting things to work, and pretty quickly built a prototype with some basic gathering quests, resource processing, and building construction. It’s not playable anywhere (I should compile something sometime), but here’s a video.

I wasn’t very satisfied with this, as I spent a ton of time getting the sprites to behave correctly. So obviously, things would be easier in 3D, because meshes and physics… right?

Iteration 4 - Unity with 3D objects, on Desktop

It was not easier. But it was a lot of fun!

I ported nearly all of the code from the 2D version with very minimal changes. I figured out some basic grid highlighting and target discovery logic and things mostly worked. However, at this time I was starting a new role that demanded a lot of my spare brain cycles, so I fell off the wagon.

Here’s a post detailing some of my travails with a 3D colony sim.

Iteration 5 - Unity with minimal sprites on android again, but this time with Unity Canvas and things will be different (worse)

I started re-creating the game from the second iteration, with the idea that Unity canvas would make my life easier. Instead of calculating exact pixel positions for everything on the screen, I would handle it via canvas objects and relative positionining.

Things went fairly smooth at first, but then I went off the rails trying get object input data to load from configuration json files. I also started experimening with multiple scenes and ScriptableObjects and got bogged down in the details of a mess of abstractions of my own making. I got stuck on a positioning bug that made no sense and that I just couldn’t figure out, related to the multiple scenes and offsets of the canvas objects.

I might still go back to it, but it just feels so inaccessible right now, and I didn’t see progress at a reasonable enough rate. It’s not even in a playable state at a POC level.

Iteration 6 - Back to 2D sprites, this time with pygame

So here we are.

This time, I’m trying to avoid getting bogged down by artwork and real sprites. I’m trying to do everything in the abstract.

Python is really nice to work with for a lot of reasons. Partly this is just because I use it everywhere lately and am getting more familiar with it on the daily, and anyone I know that might want to contribute is also familiar with python.

Pygame is also pretty solid. I’ve used HTML5 canvas in the past, and while I was moderately successful with it and made a few games that look fairly decent, and are still playable, like this centipede clone, and this space invaders clone, some of the framework contructs were really lacking. Collisions and movement were pretty clunky, and lag was a big problem. Some of those problems would probably be solved with third party libraries or the use of promises or similar, but I was stubborn and wanted to do it all myself. Not so this time. I’m loving pygame’s included functions like sprite.collide_rect,, etc.. And the refs are all readily available.

It’s also really easy to share builds of the game, since pyinstaller makes smallish files (15MB last build), and the players just need a linux distro to run it, which is good enough for me right now.

We’re a couple weeks in, but since it’s so easily accessible, progress is rapid and tangible.

Here’s a demo video of the current state after about 20 hours of effort showing auto-growth of mushroom and tree resources, colonists auto-detecting and harvesting them when they’re ready, and collection into inventory of the products.

It has a long way to go, but it’s built on the pretty solid foundation of the rotting corpses of the first five iterations.

Here’s the project README.

<< August 2020 Status Update 2020: A Year in Fortunes >>

See Also