Skip to main content

Random Level Generation

The level generation system in This Is Dungeon uses a few different ideas to produce the final levels but I'm just going to go over the first right now.  Levels are generated using the Dungeon-Building Algorithm by Mike Anderson.  This algorithm is very simple to implement and gives really good results.  The levels generate very quickly and the player is guaranteed to be able to reach every room of the level.


random dungeon generation
random dungeon no choke point.


After playing around with the generated levels in game I started wanting to be able to break the map up into multiple sections.  Since the features are built one at a time from a previously built room I realized I could just tell the generator how many sections I wanted to break the map up into and divide that by the number of rooms it was trying to generate.  The result being the number of rooms that should go into each section.  With that info you just keep track of the rooms already built and when that number equals the number of rooms per section pick a wall tile that can build a room and then lock off all previously built rooms and start a new section.  Locking the previously built rooms meant that new features would only build out from the new section.  Toss in some organization code for storing rooms under section nodes and create new section nodes when its time and there it was I had the generator breaking the map up into multiple sections and grouping them accordingly.


random dungeon generation choke point
random dungeon broken into two locations connected via a choke point.


The major plus to this was that levels got a bit more of a flow to them and since everything is organized nicely into sections it is very easy to place lock and keys in the proper locations.  The player always spawns in the first section, the level exit always spawns in the last section and any puzzle blockers can look at the sections and know that if the door to section 3 is blocked then the key to that door should be found in either section 1 or 2.


random dungeon generation with automatic lock and key design
random dungeon with a choke point showing possible lock and key locations.


Comments

Popular posts from this blog

Level Buddy | Blender Addon

An old-school CSG inspired level editor add-on for Blender 3D. The add-on is still very much a work in progress but fairly solid for blocking spaces super quickly.  Just because graphic fidelity has gotten insanely good and hyper detailed doesn't mean we shouldn't look back how older games were put together, at least that is my opinion.  One thing I always come back to is how quickly the tools in the first 2 versions of Unreal Ed 2 and Doom level editors allowed anyone to block out a level, iterate on feedback or try an idea out.  So I just took some time to put together a similar pipeline right in my 3d package of choice.  I wanted to keep it simple and quick to try out level design ideas.  You can use it for simple white boxing of your level, break it up into multiple static meshes and import them into your game engine of choice or  you can use that as your starting point to start more detailed modeling .  When you build the map you get a single static mesh th

Mega Cow | Video Game Mockup

We All Have Crazy Game Ideas...This Is Just One Of My Own Yup its a giant mutant cow... Using Inkscape I made this game mockup after watching some MST3K late one night.  I thought it would be fun to play a game where you were the giant creature causing all of the destruction.  That is the reason the giant cow is on the right of the screen instead of the left. The player would move through the level from the right to the left, the opposite of pretty much every scrolling game... looks good in my head but might not work in actual game play.  Below are some images showing the progression from rough sketch to final mock-up.