My 7 Day Roguelike Challenge Entry for 2016

game-development procedural-content programming rogue-like independent-game-development

The 7DRL (7 Day Roguelike Challenge) for 2016 has happened, and here is my entry! It was a challenge to create this game in 7 days, but I'm quite proud of it. Of course, I feel I've only scratched the surface of what the game could become with more time, effort and polish.

The premise is you are lost in outer space in an escape pod. You get rescued, and to show your gratitude you offer to upgrade the ship's engines.

Only problem is, you don't know how to do that so everything explodes. You have to get back to your escape pod before getting sucked out a hull breach or burnt alive!

Don't Go Out The Airlock introDon't Go Out The Airlock gameplay

The game is completely free and available for dowload for Windows and MacOS:

Download PC version of Don't Go Out The Airlock

Download Mac version of Don't Go Out The Airlock

Have fun trying not to get blown into outer space!

I would love to hear what you think of the game, feel free to contact me via twitter or email.

Making Procedural Content Look GREAT

game-development procedural-content programming rogue-like independent-game-development

I'm going to talk about how to get from this:

L-system fractal axiom or    L-system fractal axiom

to this:

L-system fractal axiom

using what I call a Decoration Generator. The awesome tileset shown above was created by Oryx Design Lab and is fantastic, I highly recommend checking it out.

Note: I love ASCII games and this article isn't meant to imply that tile-based games are better than ASCII games. Instead this article simply details a method to make tile-based games look great.

Decoration Generator

A Decoration Generator is a generator that takes a level as input, and outputs a good looking version of it. Other procedural content generators do level layout, loot and monster placement, etc. first. After that has been done that output is sent to the Decoration Generator which figures out the cool looking details such as wall corners, alternate tiles, shadows, decorative blood splashes, etc.

Decoration is single stage, multi pass

Decoration is single stage. This means you go through the stages of content generation (determine theme and difficulty, place rooms, place monsters, place items, etc.) before decorating, then do the decoration all at once.

Decoration is generally multi pass. This means the Decoration Generator alters the dungeon in several passes applying a Decoration Algorithm during each pass. Examples of Decoration Algorithms include placing wall corners, replacing tiles with random alternatives, and placing cosmetic effects.

I personally find implementing each pass individually makes for clean code and gives you the flexibility of turning some passes on and off and running others multiple times as desired.

Decoration Algorithms

Random Replacement

This algorithm is very simple. Each tile has several alternative tiles it could be replaced with. Iterate over every tile and for each one that has alternatives, randomly decide if it should be swapped out with an alternative tile and if so which one. The cracks in the floor in the dungeon room shown above were placed with this method.


This algorithm was used on the walls and water to take care of corners and edges. For these tiles you check a tile's neighbers and you select the final tile based on which of the neighbors are of the same tile type. For example:

L-system fractal axiom

Shadow Casting

This algorithm places shadows on tiles. Essentially every tile type has a true/false state for each of the two questions:

  • Can this tile cast a shadow?
  • Can this tile receive a shadow?

For every tile if it can receive a shadow, and the tile above it can cast a shadow, it's time to place a shadow.

Keyhole modifications

These are small algorithms that scan for certain conditions and then do a small modification if those conditions are met. For example replacing ground with bridges, placing spiderwebs in corners, placing blood spatters and bones, etc. would qualify. There are simple algorithms that should be used only when appropriate - for example an algorithm to place spider webs is great in a crypt but terrible in a king's hall (unless the king is undead of course!) A couple examples of keyhole modifications include:


If there is a ground tile with another ground above and beneath, but water to the left and right, make the ground tile a north-south bridge. If there is a ground tile with another ground to the left and right, but water above and below, make the ground tile an east-west bridge.


If there is a ground tile with wall tiles above and to the right, place a top right corner spiderweb. If there is a ground tile with wall tiles above and to the left, place a top left corner spiderweb.

Blood splatters

Pick a random ground cell. Place a random blood splatter on that cell. Place a random number of blood splatters in nerby cells (e.g. up to 1-3 splatter tiles, each 1-2 cells away).


Find any large scary monsters. Place several (e.g. 2-5) bones tiles near the monster (e.g. 1-4 tiles away).

Statues (and other stand-alone walls)

Find a wall that is surrounded by ground on all four sides. Replace the wall with a tile that look cool by itself. Examples of good stand-alone walls would be statues, pillars, wells, coffins, altars, tables, tombstones, braziers, thrones, computer consoles, etc.

Final thoughts

Data details

There are many ways of represented decorated cells as data. Two of my favorites are:

  1. Lots of tiles method: You have a wall tile, a wall2 tile, a wall_northwest tile, a wall2_eastwest_damaged tile, etc. This is a fine approach. In this case the majority of your tiles will never be generated by you level creation code, instead level layout places only wall tiles and the decorator then replaces them with wall2, wall_northwest, etc. tiles.

  2. Tile type and tile image method: Cells in your world have both a tile type and a tile image, but the mapping from types to images is one to many. Thus the type is wall but the image could be wall_grey_alt2_northwest.png or wall_grey_damaged_south.png. In this case your world generation places walls but leaves the images alone, and it is the responsibility of the Decoration Generator to assign out all the images.


One fun thing to do with Decoration Generators is to create Decoration Themes. A Decoration Theme is essentially a set of Decoraton Algorithms and tiles that look good when used together.

For example a crypt theme would specify which walls are appropreate for a crypt, it would place coffins instead of statues and it would place lots of broken ground tiles, bones and spiderwebs.

There are lots of things you can do here, but my one main piece of advice is to keep the decoration code as separate as possible from the layout / generation code. This keeps the entire procedural content code base cleaner and easier to work with.

Have fun!

L-System Fractal Generation with Unity

procedural-content programming fractals

L-system fractals

A was hanging out with my awesome friend Anatomecha in one of Seattle's new super awesome, super hip, super gentrified edison-bulb-and-a-million-beers-on-tap bars. He showed me a system he had been working on to create l-system fractals with Unity using very simple properties of how Maya and Unity represent 3D models in 3D space.

Best. Night. Ever!

I like beer and fractals because they are both awesome, what can I say?

For the uninitiated an l-system fractal is basically where you take a shape, lets call it an "axiom", then you replace the axiom with another shape, let's call that a "generator" which just so happens to be made up of a bunch of axioms. Rinse and repeat until you have created a self-referential fractal of pure awesomeness. Each rinse and repeat is called an "iteration."

Would you like to know more?

So axiom: L-system fractal axiom and generator: L-system fractal generator

which, in the cases of these pyramids creates what's called a Sierpinski Pyramid.

For those of you FRACTAL EXPERTS out there there is nothing new yet.


Here is the awesomesauce.

Maya will let you create a model which contains named compenents in a hierarchy. Unity can import the model and preserve the hierarchy and the components. If you create a hierarchical model in Maya which is meant to be a generator, and you pick some of the components in that model's hierarchy to be axioms, then when you load it into Unity all you have to do to make an l-system fractal iteration on it is to find the leaf nodes and replace them with freshly instantiated generators.

Piece of cake right?

Essentially, yes. Note there are always details. The position, scale, and rotation of the models needs to be preserved. Notice how the Sierpinsky Pyramid replaces a large pyramid with four smaller ones at various offsets? Yes, these offsets and scale factors (and rotation as well) can be encoded in the Maya model trivially which will be explained now.

Maya representation of a generator

So we are going to create this: L-system fractal tree By creating the following two generators:

End branch: L-system fractal end branch generatorMiddle branch: L-system fractal middle branch generator

We then load them up in Unity and create a script that iterates n times over a GameObject looking for leaf nodes with a name that corresponds to the name of a generator. Then when you find one, you Destroy it and replace it with a newly Instantiated instance of the generator of that name.

So have a look at what this looks like in Unity, with an attached script:

L-system fractal tree setup in Unity

Notice the Transform in the Inspector. It contains the relative position, rotation and scale of an axiom. This means when you replace that axiom with a newly instantiated generator you will need to set the generator's Local Scale, Local Rotation and Local Position to these values so it will be in the right spot.

Note the script has two generators listed, the end_branch_generator and middle_branch_generator. These are references to the models in the project, so during an iteration when a node is found with a name like end_branch__0 the LSystem.cs script knows to replace it with a end_branch instance.

You may notice the leaf nodes have names like end_branch__0 with a double underscore - this is because Maya requires unique names for it's scene nodes so the script simply discards the __ and everything after it during the iteration process.


So there is a lot you can do with this. Essentially you can build a model in Maya, name nodes, and then replace those nodes with other models that have the same name (or, if you prefer, by any more sophisticated replacement algorithm you choose) to recursively create and define a more interesting creation. Use your imagination and think on that for a minute, it's pretty huge.

L-system fractal tree iteration 0L-system fractal tree iteration 1L-system fractal tree iteration 2

Have fun!

Micro Procedural Content Generation Queue

game-development procedural-content programming rogue-like independent-game-development

What is this?

This technique breaks down procedural content generation into a series of small replaceable micro-generators chained together in sequence.

What is this for?

Consider the task of generating a dungeon which has multiple floors and rooms. Writing a single generator to generate the entire dungeon will quickly result in a generator that is very complex. A single generator like this would have to determine the size, shape, and contents of the rooms as well as how many rooms there are, how they are laid out, how many floors there will be, and many other things. Clearly this generator will become a complicated unwieldy mess quickly!

This method breaks down the generation task into a series of small micro-generators which are each responsible for generating one piece of the dungeon. This results in less complicated generators and the ability to swap out generators for different generation results.

How does it work?

Imagine having several micro-generators, each of which does one small task. You could have the following independent generators:

  • Theme generators
  • Size generators
  • Floor layout generators
  • Room floorplan generators

Each generator would take a dungeon as input and modify it. The process of dungeon generation would involve creating an empty dungeon and passing through the generators one-by-one until a finished dungeon comes out the end.

Generators in more detail

Let's look at the process of creating a dungeon with these example generators in more detail.

Theme generator

Determines the overall theme of the dungeon such as whether it is a natural cave, mine, crypt, or dwarven home.

Size generator

Determines how many floors the dungeon has and the size and shape of the floors.

Floor layout generator

Determines how many rooms, corridors, and other open areas exist on a floor and how they are connected to each other

Room floorplan generator

Lays out the floorplan of a single room. Places walls, traps, obstacles, treasures, monsters and other things inside a room.

All together in action

Each of these micro-generators should be very simple to implement. When a dungeon needs to be generated the first generator in the queue is run to determine the theme of the dungeon. Imagine it decides the dungeon is a crypt. It takes an empty dungeon object as input and adds metadata to it such as "setting:crypt" and "difficulty:moderate".

This dungeon is then passed to the next generator which determines its size. The size is determined to be 2 floors deep, 50 units wide and 25 units tall. This information is added to the dungeon itself, possibly in the form of allocating space to hold the information

Once the size is complete the floor would be laid out using one of many floor layout generators. For example a drunken walk could be used to place the floors. This phase would also determine where the entrance to the dungeon is and the exits that move between levels. If the rooms are not all the same size this phase would be used to determine the size and shape of the rooms.

Finally the room floorplan generator would be used on each room to determine the layout of the individual room. This includes placing treasure, traps, monsters, and other fun things. This is a case where it would make sense to have a large number of different generators. Each room has an appropriate generator chosen for it at random resulting in a lot of room variety without making any single generator too complicated.

Things worth mentioning

This method has a lot of advantages. Generation phases can be delayed until absolutely needed, for example a floor of a dungeon would not necessarily need to be generated until a player entered that floor. This would result in shorter load times and smaller file sizes.

Individual micro-generators could also be selected based on metadata information set in the dungeon during earlier phases. For example some room floorplan generators could be marked as requiring the dungeon be man-made or naturally occurring, and this metadata could be placed in the dungeon by the theme generator.

All in all this method offers a lot of generation power while simultaneously being very simple, elegant, and extensible.

Procedural Generation: Drunken Walk

game-development procedural-content programming rogue-like independent-game-development

This is a generation technique that places open spaces on a grid. Start with a solid grid, such as a 2D array of walls. Pick a starting point and mark that as open/empty. Move in a random direction if and only if the next cell in that direction is solid. Mark that as empty. Repeat until you are no longer able to move, or you have a large enough area that has been marked as empty that you are satisfied with the walk.

Drunken walkOne drunken walk

You can use multiple walks to generate a more interesting area. The additional walks can start from an open cell, or they can start from a closed cell and be allowed to "merge" into an existing cell if they would intersect with the cell.

Drunken walks with 10 stepsDrunken walks with 10 steps

Note that this technique works well for generating areas that have open cells and wall cells as shown above, but it also works for generating an area with areas with clear adjoining exits (e.g.: rooms). Simply place an area in each visited cell and a connection leading from this cell the the previous one.

Drunken walks with adjoining areas

Multiple drunken walks with adjoining areas requires an extra step for each subsequent walk to join the walks together. One option is to start walks after the first in one of the previously visited rooms (shown below).

Drunken walks with adjoining areasDrunken walks with 15 steps

That is the drunken walk. There are many ways to tweak it worth experimenting with. For example when determining the random direction you can give a bias towards choosing the direction of forward making the generated area have more long corridors. Another tweak is to randomly determine how many steps each walk will take, or to have the likelihood that a walk should end be determined by the distance from the starting point.

Have fun with it!


game-development programming projects professional

Download from the Apple App Store here!

Popular creative block-based building gamePopular creative block-based building game

I work as a full-stack iOS + backeng engineer on Bocksworld, creative block-based building game for kids by Linden Lab. This was is created with C# in Unity3D, Objective-C, Ruby and MySQL. I have contributed to all technical aspects of it's development.

Blocksworld has been enjoyed by over three million users who have created and shared over two million creations! Blocksworld is available on the Apple app store.

Blocksworld is a free app with in-app purchases.

Popular creative block-based building gamePopular creative block-based building game


game-development programming projects professional

Click here to play Patterns now with Steam Early Access!

Creative sandbox buildingCreative sandbox building

I was an engineer on Patterns, a multi-player open sandbox building game game made by Free Range Games and Linden Lab. This was a project created with Unity3D for Mac and Windows PCs.

Patterns is a large and ambitious project where users could build complex creations with dozens of different types of shapes. Players could add Lua scripts to their creations to create gamification mechanics and achieve high levels of customization. Patterns is available on Steam.

Creative sandbox buildingCreative sandbox building


game-development programming projects professional

Download from the Google Play Store here! Download from the Apple App Store here!

Popular creative block-based building gamePopular creative block-based building game

I was the mobile lead engineer on Roblox. I lead a five person which created the mobile version of Roblox, an extremely popular game that has spent time in the top-100 grossing apps on the iOS app store. Roblox mobile was created with Objective-C and C++.

Roblox has been enjoyed by millions of kids and has over 4.5 million monthly active users! Roblox is available on the Apple app store and Google Play store.

Roblox is free with in-app purchases and premium subscriptions.

Popular creative block-based building gamePopular creative block-based building game

Mindless Dungeon Crawl

game-development programming projects rogue-like independent-game-development

Mindless Dungeon Crawl: mindless adventure awaits!Mindless Dungeon Crawl: endless mindless exploration!

Download from the Apple App Store here!

I have a tradition of teaching myself a new programming language or technology by writing yet-another-version of “Mindless Dungeon Crawl (MDC).” This tradition started when I was procrastinating my grad school compilers homework. I have written MDC in Python, JavaScript, C++, C# with WinForms, Objective-C with iOS, C++ & Objective-C on iOS with Cocos2D, C# with MonoTouch and finally Unity3D which is the version you see here. Each time it’s a different game with graphics (sometimes it’s a text game) and different mechanics but it never takes itself seriously.

This game was downloaded 800 times on its first day, was favorably reviewed by Touch Arcade and gets a modest number of downloads daily.

Creature artwork was licensed from Joe Calkins of Cerberus Art. Send him all your money, he earned it. UI, backgrounds and fonts were me.

Mindless Dungeon Crawl: LOOOOOOOT!Mindless Dungeon Crawl: hilarious opponents galore!Mindless Dungeon Crawl: gain power!

Hack & Quest

game-development programming projects rogue-like independent-game-development

Hack & Quest "You got loot!"Hack & Quest Player stats

Download from the Apple App Store here!

Ambitious iPad rogue-like inspired by the Game Monetization Challenge.

I created combinatorial loot using a scheme inspired by Might and Magic 3: Isles of Terra. More powerful and flexible where it can select which type of leather your leather armor is made from, or what type of steel is in your chain mail, plus add adjectives and modifiers all of which change the stats and gold value of the items.

Art was commissioned from Team LePixelists. They were awesome, did great work very quickly. Treat them professionally and pay them well, you won’t regret it.

Highlights include:

  • Massive world with over 4 billion regions (same world, different starting locations each game)
  • Climate and temperature with appropriate tilesets (snow, light snow, lighter snow, desert, etc)
  • Hundreds of dungeons with increasing difficulty as you descend
  • Several overland and dungeon generators (placing monsters in climate-appropriate areas)
  • Procedurally generated loot (adjective, noun, construction material, etc). Similar to Might & Magic 3 but more depth. So you can have an expertly-crafted flaming steel longsword or just an iron longsword.
  • Procedurally generated monsters (which also level up as necessary for deeper dungeon levels)
  • RPG stats, chests, leveling system, combat mechanics
  • Stack-based UI menu system

Hack & Quest "Mad loot!"Hack & Quest desert landscapeHack & Quest tundra landscapeHack & Quest "Death sucks!"