Dungeon/maze generator

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sat Aug 21, 2010 8:46 pm

Early last year for a game called Kolumbo 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:



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.
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Sat Aug 21, 2010 10:46 pm

That's a great idea! Defiantly will get some use.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Sun Aug 22, 2010 11:28 am

Some progress with walls and doors...

B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Sun Aug 22, 2010 1:35 pm

Wow nice, a plugin :D

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 :D

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Sun Aug 22, 2010 4:05 pm

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.
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Sun Aug 22, 2010 5:14 pm

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.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Mon Aug 23, 2010 6:46 pm

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.


Silent Cacophony, if you (or anyone else) would like to modify the generator to be more varied, that would be welcome :wink:
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Thu Aug 26, 2010 8:28 pm

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.



Almost done with this I would say.
B
2
S
1
G
3
Posts: 71
Reputation: 1,142

Post » Tue Sep 28, 2010 12:55 pm

Looking good!

Only thing I would suggest is a conditional "Compare Tile at x,y".
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Sun Oct 17, 2010 3:30 pm

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!
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Next

Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests