Dungeon Generation

Hi guys,

I know it’s been a little while since I’ve blog posted. That’s largely down to us crunching down on the game. So worry not, we’re making great progress.

Recently I’ve been asked a lot about how dungeon generation works. So I thought I’d give you a very brief run-down.

 

Essentially dungeons are divided into different rooms/corridors. Each room is made of a single image. Each pixel in an image references blocks, objects, spawn points, connection points and so on.

The engine then intelligently connects these rooms together to produce new dungeon layouts. It creates monster spawns and places chests in random locations inside the dungeon.

Here is one such image from the entrance to an Avian tower.

 

 

 

Most of the pixel colours here reference various blocks and objects. But of special note are the grey, pink, blue and black pixels.

The pink pixels tell the engine to accept anything in that location.

The grey pixels tell the engine to fill those locations with the main blocks from whatever biome the dungeon appears in.

The blue pixels tell the engine where to connect this room to another room.

The black pixels tell the engine that there should be sky in this location.

Once the engine has read the image, connected it to other rooms and placed it in the world it looks like this:

 

 

 

 

 

 

There are hundreds and hundreds of these images being used to generate all manner of different dungeons, temples, crypts, etc.

The engine is also capable of randomising what a particular pixel means, so a single room could appear in a multitude of different ways.

LUA scripts can be built directly into dungeons and wiring works too.

 

A video on travel from planet to planet coming soon!