World Generation

Mercury Fallen takes place underground and I felt it rather important that the maps are proceduraly  generated for various reasons. I’ve spent a bunch of time looking over articles and techniques to get my brain in gear on the process. I’ve messed a bit with map generation in earlier projects, but I always enjoy doing some research to get some fresh ideas.


What’s In A Map?

While Mercury Fallen is a 3D game, the map itself is just a 2D grid/array of cells. Each cell can contain a ground, a floor, a structure or an item. In some cases a cell may contain only 1 of these things such as a dirt or stone structure that takes up the whole cell, but there can be many in the idea of a floor, with a structure such as a lamp or a loose item for a colonist to go collect. On the coding side of things these different types of elements in a cell are thrown in to Cell Layers which is just a means of organizing the objects within the cell.

Some of the first methods for generating a simple map was just adding dirt floor to all the cells. This gave me a nice flat map to use for testing out various other elements. At some point, though, it started to become necessary to have a proper map.

Cellular Automata

Given that I was dealing with cave structures I thought that cellular automata would be a good approach to create some organic looking cave areas.

The first step of the process was to randomly fill the 2d grid/array with dirt. This generates a big mess of dirt tiles that looks pretty ugly.


The next step is to iterate over the grid a few times using the cellular automata process which results in a much more organic look.


While this process generated some decent caves I started questioning how I might add in additional resources such as stone/ore etc.. My first attempt at this was layering in additional cellular passes using the solid dirt as a mask. This worked enough to get started on other things, but I eventually came back to this whole process and revamped it entirely.



After having some additional thoughts on what will be added in the map I realized I needed to go back and work more on the map generation. After doing some more research I realized that using a heightmap may get better results.

Once a heightmap is procedurally generated I can mask different height values to different cell types. The below image shows masking and coloring a heightmap to values for water, dirt floor, dirt filled, stone and ore.



This creates a pretty nice looking map that has a nice organic look to it. The only thing I didn’t like, though, was that certain elements were too consistent such as there always being a dirt floor around water and stone was always encased by solid dirt. I wanted a bit more randomness in there for flavor.

First I layered in some more solid dirt by doing a cellular automata pass, but masking off the result to only effect tiles that were originally only dirt floor. Secondly I created another heightmap at a higher frequency and blending in values for ore and stone to give more variation.

This was the final result


While I’ll probably end up going back and tweaking it further I find this to be a better end result, than what I had previously. This map also gives me lots of little areas to hide secret items in as well. 🙂


Reference Articles

Generate Random Cave Levels Using Cellular Automata

Procedurally Generating Wrapping World Maps


I’ve been working on Mercury Fallen for a little over a month now. I wanted to get a website up and running before this, but was a little strapped for cash to purchase the domain. That, of course, has now been accomplished and I’m ready to start blabbing about the development process.

I have a tendency to focus more on working on a project than talking about a project, which isn’t always a good thing. Naturally work needs to be done, but if no one knows about it than you have to start questioning your goals for the project. In my case I want to complete a game and, ideally, have people enjoy playing my game. In order for that to happen then people need to know about it. Mercury Fallen is the type of game I’ve had rattling around in the back of my brain now for quite a while. I had some other projects on the docket, but they quickly grew out of scope as a single developer and didn’t gain much traction so they’re sitting on the back burner for now.

Development Image - Mercury Fallen

Mercury Fallen is a strategy survival colony building game that is very much inspired by Dungeon Keeper II and Banished. Similar to Banished the game will not have a focus on combat, but rather resource and colony management. Those fond of Dungeon Keeper II will notice the underground expansion aspect of the game very familiar. One big difference from both games is a science fiction setting.



Development Image - Mercury FallenHumans, for the first time, are attempting to colonize a planet outside our solar system, but it doesn’t entirely go to plan. Robot workers and supplies were sent ahead in the vessel Mercury to establish the foundation of an underground colony and research facility. The colonists were sent via stasis ships during multiple launch windows and would be awoken when all colonists had arrived safely. Unfortunately the last stasis ship arrives roughly 100 years later than expected and awakes to find the facility in ruins.

In my current plan you start the game with a single colonist as well as some handy robot workers. Early game is mostly expansion, resource gathering and finding additional stasis pods to acquire additional colonists. The core focus of the game is digging out the underground and creating rooms, furniture, colonists, robots and, above all, keeping your colonists alive.

I’m also focusing on a simple polygon art style for the game that I feel will fit nicely with what I have planned and keeps things more manageable for a single artist.

Now to get back to work and to write more for the devblog.

Archive Content