PDA

View Full Version : cavern generator



drow
09-10-2010, 01:51 AM
i thought i'd post a first look at what i'm currently working on,
adding caverns to my random dungeon generator.

i'm using the cellular automata algorithm from roguebasin for the rough layout,
and making repeated passes at increasingly finer resolution to achieve the final cavern.

the next step is improving performance. 13 seconds for a small dungeon at screen
resolution is a bit much, and generating a print resolution map is crazy.
after that, parsing the rough layout for rooms.

29085 29086

Marken4
09-10-2010, 02:25 AM
Looks like a seahorse on the second pic... ^^ I think it looks nice, whats the white border around the edges tho? Sometimes the boxpattern(?) disseapears..

drow
09-10-2010, 02:37 AM
whats the white border around the edges tho? Sometimes the boxpattern(?) disseapears..
that's just the difference between the rough layout and the final cavern outline.
at some point, i'll have to update the imaging code.

Redrobes
09-10-2010, 06:09 AM
Looks good. I could wait 13 seconds for it tho - thats no biggie. I think quality is more important than a few seconds wait.

RobA
09-10-2010, 01:52 PM
And another great input to my smp script! (scaled up 3 times)

29100

-Rob A>

drow
09-11-2010, 12:09 AM
found a way to improve performance, and i've updated or created all the style routines.
(although the style routines pretty well wipe out my performance gains)

29114 29115

drow
09-13-2010, 05:41 AM
my algorithm for identifying chambers within the caverns mostly works,
though it's pretty complicated and could probably be improved.

the second map is a desert caverns scaled for print.
about 3.5 minutes to generate, the majority of which is creating and dealing with image masks.

29206 29228

drow
09-14-2010, 05:44 PM
i'm down to about 4 seconds for a standard medium size cavern map,
10 seconds with style, and 2 minutes with style at print scale.

i think i'm done with optimization, unless anyone knows some deep magic
for dealing with cellular automata across 9 million cell arrays.

drow
09-17-2010, 01:08 AM
my brain won't stop working on this.
now down to 2 seconds, 5 seconds, and 1 minute.

a colossal cavern only takes 15 seconds, 26 seconds with style.
at print resolution should take about 8 minutes, but the process
consumes all the memory on my machine and grinds to a halt. :)

mathuwm
09-17-2010, 11:43 PM
I dont know what you are talking about but I like the results ; )

drow
09-18-2010, 10:34 PM
http://donjon.bin.sh/dungeon/?dungeon_layout=Cavernous

Talroth
09-19-2010, 12:44 AM
Have you mapped out your memory usage in your algorithm? What exactly are you doing with your system memory? Do you have anyway to cut a map into chunks for fine detail processing and then automatically stitch it back together after the fact?

drow
09-19-2010, 02:10 PM
Have you mapped out your memory usage in your algorithm?
What exactly are you doing with your system memory?

that's been this morning's work, aside from a quick trip to ikea. :)

the generator is written in perl, so i'm at perl's mercy regarding memory allocation and usage.
and perl is rather notorious for sacrificing ridiculous piles of memory for performance.

i've converted the cell map from an array of arrays of integers (lazy)
to an array of strings, using vec() to manipulate it.


$map->[$r][$c] # uses a lot of memory
vec($map->[$r],$c,1) # a lot less memory, and isn't any slower

much better! a colossal cavern, standard style and print scale, now takes 3.5 minutes to generate,
and the process consumes just over 500 MB of memory, instead of the 3+ GB it was sucking down before.

the parchment style is the most computationally expensive, and pushes that to 7.5 minutes.
the resulting image is an 8051 x 8051 pixel jpeg, 13 MB in size.

Sharpe
10-09-2010, 07:23 AM
Man, you're awesome! Very talented.

I've noticed that there are no entrances to your caverns, though. Will you make it so that there's a cave opening running off the map?

Big Mac
10-17-2010, 04:16 PM
Man, you're awesome! Very talented.

I've noticed that there are no entrances to your caverns, though. Will you make it so that there's a cave opening running off the map?

I was about to say both of those things too. The maps do look great.

If this is going to be automated, could you perhaps give the user a choice to the number of entrances (when you eventually get to that stage)?

One entrance would give people a cave, but two (or a few) would give them the option to pass through the cave system to get somewhere else. That might be useful.

Sharpe
10-18-2010, 09:14 PM
Man, Drow, you really rock.

Ever think about a random forest generator?

Jaxilon
10-18-2010, 10:43 PM
wow, I just saw all the stuff you have on there. What a great resource. I can see using it to help build stuff for my RPG group when I'm in a hurry and so on. Thanks for all your hard work on this stuff.

industrygothica
10-18-2010, 11:43 PM
Indeed, great resource. Thanks a bunch!

MadCatUSA
10-28-2010, 05:02 AM
Awesome! Love it! I'll be using this a lot!

Sharpe
11-20-2010, 02:24 PM
Drow, as a suggestion for your random dungeon generator, would you consider making an option for all plain doors? Thanks!

Vorhees
11-20-2010, 07:44 PM
This is Awesome i Use this Site ALOT , nice to meet ya Drow and keep up the Good Work

drow
11-21-2010, 02:43 AM
I've noticed that there are no entrances to your caverns, though. Will you make it so that there's a cave opening running off the map?

Drow, as a suggestion for your random dungeon generator, would you consider making an option for all plain doors? Thanks!
ack, november already. i'll get back to looking at these. i'd also like to avoid too much option bloat, though. :)

drow
07-10-2011, 05:11 AM
finally got a break...


Drow, as a suggestion for your random dungeon generator, would you consider making an option for all plain doors? Thanks!

Doors: [ Basic ]
this will limit the generator to using archways (no door) and plain doors only.
there are a few other options available, as well.


I've noticed that there are no entrances to your caverns, though. Will you make it so that there's a cave opening running off the map?

Peripheral Egress? [ Yes ]
applies to both hewn dungeons and caverns.
setting this to [ Multiple ] adds 2-4 outside tunnels.

37095 37096

drow
07-21-2011, 11:40 PM
37269 37270 37271 37272 37273

industrygothica
07-22-2011, 11:06 AM
Very nice.

Thomian
10-19-2011, 09:52 AM
Awesome stuff you have going there.

bloodymage
02-25-2012, 12:29 PM
I'm trying to use this as I need some caverns for my game, but when it asks for levels, it only generates the highest level. I input eight and it gave me Level 8. How do I get the other levels?

I see now. It queries which level to draw.

OK, now all I need is to figure out how to print them out. I'm only getting a piece of the map when I try to print it out.

bloodymage
02-25-2012, 01:13 PM
I got it figured out. Great site, by the way.