Designing Strata: A 2D Level Generator for Non-Programmers

By Matt Schell (Twitter,Website)



In this piece I'd like to give some context on my thought process in creating Strata, my 2D level generation asset for Unity. I was first exposed to the concept of procedural generation through the action-roguelike wave of games spawned by Derek Yu's Spelunky. I am a big fan of Jorge Luis Borges and his fantasies about infinite libraries, and procedural games struck me as an incredible way to play with the concepts of infinity that he imagined. Being new to game development (this was about 4 years ago), I immediately plunged into creating a 3D, flying procedural action game called Monarch Black. I had no idea what I was getting into and it's still not done. ¯\_(ツ)_/¯

This summer I wanted a focused, finishable small project that I could actually ship that wasn't the albatross that Monarch Black has become in my mind. Hello side project!

My goals were that I wanted it to work with Unity's Tilemap tools, to be reasonably user friendly to non-programmers and to be able to create varied output without having to re-write the C# source code itself.

The use of Unity’s Tilemap was inspired by reading about how Yu designed maps in Spelunky, with hand written blocks of ASCII characters representing level pieces that are then shuffled to create random levels.The mix of hand-made and procedural content is a nice way to address the often alluded to ‘Thousand Bowls of Oatmeal’ problem in PCG. Dropping some nuts and berries of authored content into the oatmeal can give it nice pops of flavor and texture!.


Instead of using ASCII in Strata you can draw your level pieces using Unity's Tilemap tools. My hope is that this makes it more artist and level designer friendly. Under the hood Strata actually uses ASCII characters to build the initial version of the grid, before they’re turned into tiles to be displayed. Drawing tiles, then shuffling them to generate ASCII, then redrawing tiles opened up some options. I realized that since I have the tiles in this intermediate form, I could post-process and mess with them before turning them back into graphics. This led me to the current modular structure of Strata where you arrange what I call Generators into a series of generation operations on the same grid of data, overwriting and changing it as each one runs. By creating these Generators as custom ScriptableObject assets in Unity it becomes possible to choose, sequence and mix Generators via drag and drop in the Unity inspector.

This also allows people to choose between completely procedural levels, hand-authored levels or something in between. This is based on a software development pattern called Delegation. This means that non-programmers are able to control the generation process in an intuitive way. It also gives programmers who want to extend the system a clean point to begin doing so.

The more I started to work with Strata the more I realized that as much as it’s a level generation tool, it’s also a kind of drawing tool. I went to a high school for dropouts called City As School (which was amazing!) and I remember for our, very remedial, single required math class we were allowed to do a computer class. The class had very antiquated computer hardware and they had a ‘turtle draw’ style application which we were assigned to do things like ‘input some commands to draw a square’. I remember figuring out that you could put in high numbers, randomize the colors and because it was so slow to draw you could generate long screen-saver-ish spirograph effects. Super fun!


Playing with Strata using the ‘WanderTunneler’ Generator (basically a random line/tunnel drawer) and the symmetry generators, I was having tons of fun making weird temple spaceship drawings. At some point I’d like to explore it more as a pure drawing tool, separate from game design. I’ve included a few pictures.

Because of the modular setup I intend to add a bunch of more sophisticated algorithms over time. I want to see what the initial response and level of interest is, and to get feedback from the community first, but I have a lot of ideas for other generation techniques to add.

It's worth noting that Strata is a paid tool, available via Itch.io and the Unity Asset Store.

If you’d like to learn more about Strata there is a page for it here!

Feel free to message me on Twitter via @mattmirrorfish or to email me at matt -at- mirrorfishmedia.com if you want to chat!