Dungeon/maze generator

This forum is currently in read-only mode.
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Early last year for a game called

    Subscribe to Construct videos now

    I made a plugin for generating random levels (called "Dungeons" for RPG traditions). Not to take credit for other people's work, it was based on Jamis Buck's somewhat famous D&D dungeon generator. I didn't release the plugin as it was messy and also had many other functions for our game.

    Let's fix that mistake, fresh start!

    Download Plugin, .cap, and demo exe all in one happy package.

    Source code

    It can do this:

    <img src="http://paahdin.com/projects/dungeongen/img/sshot.PNG">

    And many variations of course, preferably with a better tileset. Unlike the last version, this one can create the tile objects on the layout automatically (after you tell it what object is what). I haven't added the traditional "for each tile... get tile at pos" actions/expressions yet.

    The action workflow is.

    • Set object mapping (currently only 0 = empty space, 1 = wall)
    • Set parameters
    • Generate
    • Build to layer

    Parameters:

    Tile size: Width/height of one tile in pixels

    Seed: Number to base the randomization on. Same number = always same result.

    Randomness: 0 - very straight corridors, 100 - lots of twists

    Sparseness: 0 - very tight density, 100 - very sparse density

    Dead end removal: percentage of dead ends the generator does its best to remove.

    Room count: max/min.

    Room dimensions: max/min height/width in tiles.

    Size: dungeon width/height in tiles.

    Expressions available for all of the above. For mazes (and other purposes too) you can also set a starting point and a ending point.

    Jamis' generator is public domain, my license is also "do what you want".

    Not complete! This was just today's work. Updates to follow.

  • That's a great idea! Defiantly will get some use.

  • Some progress with walls and doors...

    <img src="http://paahdin.com/projects/dungeongen/img/wallsdoors.png">

  • Wow nice, a plugin

    If only it could have combined perimeters from Silent Cacophony's generator, this one here that you have made, and something along the lines of a typical cellular automata generator for cave-like structures... it would be the ultimate!

    I would also like to see something that could make realistically laid-out building interiors as well.

    Still, freaking awesome for a plugin

    ~Sol

  • I wish I had a better algorithm. JBDungeon is a classic but it hasn't really changed since 2003. It has problems like one-dimensional (or zero thickness) walls that look good on paper but are tricky to get right for games. This web-based one is nice but it is not publicly available.

    Anyway, this is not going to be a gigantic project but the goal is simplicity... it fits Construct.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That's cool. A plugin will be very nice to have.

    I remember running across Jamis Buck's generator a few years ago when I first became interested in writing a roguelike game, but I never got around to doing it... It's probably this that gave me the idea that I used on room placement in the example that I posted recently, though I think this one was a bit different in it's implementation. I'll have to take a look at this one again.

    I've just looked back at an incomplete dungeon generator that I wrote in python a couple of months ago, and it looks extremely similar to this. I didn't implement 'smart' room placement on that, and didn't create any doors or content within it, yet.

    Good job with this, as I'm sure quite a few will find it to be useful.

  • Updated download. I added things like "get tile at" and "get wall between two points" so now you don't have to use the "auto-build to layout" feature.

    Here is the plugin in use with the example platform "game". Guide the little guy from start to finish.

    <img src="http://paahdin.com/projects/dungeongen/img/grassfloors.png">

    Silent Cacophony, if you (or anyone else) would like to modify the generator to be more varied, that would be welcome

  • Since the "thin walls" were sort of tricky, I added a "build to layout (expanded)" action that enlarges your maze so that all walls are at least 1 tile width. It makes door placement better too. As before, the "build" actions are not mandatory but you can loop + build the blocks with events, or Python.

    <img src="http://paahdin.com/projects/dungeongen/img/fatwalls.PNG">

    Almost done with this I would say.

  • Looking good!

    Only thing I would suggest is a conditional "Compare Tile at x,y".

  • This thing you're doing, taking existing game-making methods and converting them to construct plugins; it is incredibly usefull so keep on doing it!

  • Experimenting with this a little bit, and I was wondering.....

    Is there a way to tell what values are generated in the array?

    Basically I need to know what constitutes a room, a wall, etc.

  • Bump

    Still wondering what values are used to do a comparison.

    Also what does "set object mapping" do?

    Edit:

    Ok, sorry didn't realize it meant use as rock, etc.

    Also

    <img src="http://dl.dropbox.com/u/666516/maze.png">

    Still experimenting, theres just sooo much you can do with this.

    Edit2:

    Ok, figured out some of the references, 1 is rock, 2 is tunnel, 3 is dunno, 4 is room...

    Either there's a bug, or your using something else to reference wall, and door.

    Was hoping to do some bitwise tilemappping. Its not real important for wall and door, but it would be nice for more detail.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)