Page 1 of 1
Dungeon generator
Posted: Wed Jul 10, 2013 9:52 pm
by Torniquet
Has anyone else attempted to make one?
I have tried many times and read a shed load of forum posts. But never got anywhere...
..until now!
I found a nice simple method which seemed the easiest to pull off.
So after 3 evenings of banging my head against the wall, I got all the maths sorted and now have a JS concept ready to use in unity ^^
The hardest part by far was linking all of the rooms up and spent hours thinking of the most suitable way of getting the job done.
Here is the final product.
http://playpen.project-blackwidow.com/gen.htm
Its not really in any condition to be used more than a concept and practice. Feel free to look at the source of the page and see how its done if you can understand the mess lol. Its not commented very well... well at all really, but it should be self explanatory if you understand the process.
Here is the article
http://roguebasin.roguelikedevelopment. ... generation
Enjoy

Re: Dungeon generator
Posted: Wed Jul 10, 2013 10:59 pm
by Jackolantern
Very nice! I really like it. In case they could be of more use, or if you wanted to make a solid, maze-like dungeon structure, there are algorithms used in CS that could be of some help:
Labyrinth Algorithms. Good ones to check out would be Kruskel's, Prim's, Hunt and Kill, and Eller's.
Re: Dungeon generator
Posted: Thu Jul 11, 2013 10:19 pm
by hallsofvallhalla
you could attach some webGL to this and make it 3d.
Its very awesome though. I found one map I will save for my next D&D campaign.
Re: Dungeon generator
Posted: Tue Jul 16, 2013 8:25 pm
by Torniquet
And here we have stage 1 in unity. The floors are being generated nicely, needs a tweak or two to keep rooms generating so close to each other.
unity-map.png
Moving it from web JS to unity JS was trickier than i expected it to be, but im getting there

Re: Dungeon generator
Posted: Wed Jul 17, 2013 3:25 am
by Jackolantern
Looking good

Re: Dungeon generator
Posted: Wed Jul 17, 2013 10:38 pm
by Torniquet
End of evening 3 and the next step of this beauty is done
unity-map2.png
Now I just need to get the walls up with the doors in the right places :s lol.
When I have a proper dungeon being generated, I will upload a copy to the interwebs for people to see ^^
Re: Dungeon generator
Posted: Thu Jul 18, 2013 3:00 am
by Jackolantern
Are the connectors actually hallways, or teleporters (like where you walk from one room directly into the next)?
Re: Dungeon generator
Posted: Thu Jul 18, 2013 6:46 am
by Callan S.
That looks nifty. So your able to make the connecting tunnels break through the walls of each room?
Re: Dungeon generator
Posted: Thu Jul 18, 2013 8:48 am
by Torniquet
@Jack
They are actual hallways which you will walk down to get to the next room. The same logic can be used to link rooms via teleporter as well in theory, rather than generating a mesh you can assign a point to teleport to and from. Which is actually a good idea
@ Callan
What you see there is only the floors. My intention is to record all of the points where the doors are and basically skip that point of mesh generation when I build the walls up.
Currently each room and each portion of the corridor is a separate game object (as you can see in the screenshots) I think it might be better to get it all into a single object eventually, but as I am only starting out and have only just started using unity properly, I am not overly worried about that just yet lol.
Re: Dungeon generator
Posted: Thu Jul 18, 2013 9:38 am
by Jackolantern
If you did have the hallways walkable, you probably would want to add to the algorithm to consider the space a hallway has and blow it up into a more content-fillable hallway, or else the dungeon will feel too much like "big room, walk down a tiny empty hallway, big room, walk down a tiny empty hallway".
