
random depth (a range from 0-5) from the main corridor. Personally, I am more a fan of a Bottom-Up approach, where I keep adding and connecting rooms one by one, with random amount of smaller leafs - e.g. This is an interesting Top-Down approach. We really need your help with pledges or the game will not be made! TinyKeep is a 3D Multiplayer Dungeon Crawler with focus on intelligent monster AI, currently being funded on Kickstarter. Because of the variety in cell sizes, the walls of the corridors will be twisty and uneven, perfect for a dungeon.Īnd here's an example of the finished result! Any cells which intersect with the L shapes become corridor tiles. This is where the cells we have not yet used (those cells in the grid which are not rooms) become useful.
#Tinykeep level 2 series
To convert the graph to corridors, for each edge we construct a series of straight lines (or L shapes) going from each room of the graph to its neighbour. The final layout will therefore be a graph of all rooms, each guaranteed to be reachable and containing some loops for variety.ĩ. So now we re-incorporate a small number of edges from the triangulated graph (say 15% of the remaining edges after the minimal spanning tree has been created). The minimal spanning tree looks nice, but again is a boring dungeon layout because it contains no loops, it is the other extreme to the Delaunay Triangulation. This creates a graph that guarantees all rooms are connected (and therefore reachable in the game).Ĩ. Because we don't want every single room to be linked to every other with a corridor (that would make for a very confusing layout), we then construct a Minimal Spanning Tree using the previous graph. So now all rooms are connected to each other without intersecting lines.ħ. To begin we construct a graph of all of the rooms' center points using Delaunay Triangulation. For the next stage we want to link each room together. The remaining cells are still useful however. Because of the Park-Miller Normal Distribution described earlier, there will only be a small amount of rooms in comparison to the number of cells, with lots of space between. We determine which of the cells in the grid are rooms - any cell with a width and height above a certain threshold is made into a room. The result is that we end up with a square grid of differently sized cells, all perfectly packed together.ĥ. We fill in any gaps with 1x1 sized cells. This technique ensures that the cells are not overlapping, yet in general remain as tightly packed together as possible.Ĥ. Next we use simple separation steering behaviour to separate out all of the rectangles so that none are overlapping. At this point we have 150 random cells in a small area, most are overlapping. In addition to this I ensure that the ratio between the width and length of each cell is not too large, we don't want perfectly square rooms but neither do we want really skinny ones, but somewhere in between.ģ. The reason for this will be explained later! This skews the size of the cells so that they are more likely to be of a small size (more smaller cells, less larger cells).
#Tinykeep level 2 generator
Instead of using uniformly distributed random numbers (the default Math.random generator in most languages), I'm using Park-Miller Normal Distribution. Again the radius doesn't matter too much, but it should probably be proportionate to the number of cells. For each "cell" I spawn a Rectangle of random width and length within some radius. This is an arbitrary amount really, but the higher the number the larger the dungeon and in general more complexity.Ģ. First I set the number of cells I want to generate, say 150. It's pretty over-engineered, but hopefully will give anyone who is interested some ideas on generating dungeon layouts for their own games.ġ. Today I'm going to talk about one technical aspect of the game, that is random procedural dungeon generation.

Hopefully this will somewhat pay for the sin I am about to commit at the end of the post. That GIF trended on Reddit, and is now used in virtually *every* PowerPoint presentation that talks about procedural level generation.ĭuring the interview, Phi talks about how it works, and how it got extended to work in three dimensions in a game called "Sublevel Zero".I was originally going to advertise my Kickstarter project TinyKeep here, but as everyone knows spamming a message board is not good etiquette so I thought I'd share some knowledge with the community as well. Or at least, they know about its procedural generation.ĭuring its development, Phi posted a GIF showing how levels in TinyKeep were made.

Not many have played it, but a lot more knows about it. Towards the end of the interview, I asked Phi about one of his first games: TinyKeep. This week I had the pleasure of interviewing Phi Dinh, founder of PhiGames and developer of the anticipated Recompile (PC, PS5, Xbox Series X).
