Dungeon Generation

Some dungeon generation code that generates some reasonably ok dungeons as a starting point:

http://www.cokeandcode.com/node/1445

Some discussion and extensions:

http://www.cokeandcode.com/node/1444
http://www.cokeandcode.com/node/1446
http://www.cokeandcode.com/node/1447

http://dl.dropbox.com/u/1668516/concept/better-dungeongeneration3.png

Kev

Oo! Pretty! This Dungeon thingy’s starting to look good! When’s alpha? :wink:

Looks good, but one downside to this approach is you end up with a lot of large voids that may make players assume there is a hidden room somewhere. Also for this reason it won’t work to well for generating building type layouts.

I think a better approach (although more difficult) might be to start with an open space and start adding walls randomly. It also might be worth playing few a few levels of Diablo, I remember the procedural dungeons it generated were always pretty good.

I’ve written maze type generators where you carve out from a bigger area, but in general I like the idea the player doesn’t predict where places are based on knowing the area is fully carved out.

Not saying this is the only way, just example code in case it’s useful anywhere.

Kev

Looking good kev - and surprisingly similar to how I generate dungeons for Albion.

I’m interested in how you’re going to solve the door problem, and how you deal with character’s being ‘behind’ walls. I’m still not entirely sure I’ve take the best approach in Albion, but I’ve redone it three times already and it works well enough for now.

Whats the door problem?

Behind walls - I’m actually expecting to pad all the rooms by one tile round the edge, so probably no concept of behind walls. Bear in mind I’m intending to use warcraft 2 sprites so not quite the same angles as the rpgmaker stuff you’ve got.

Kev

Ah, those sprites are much closer to a top down angle aren’t they? I did do the padding thing at one point but it felt weird as doorways would then become short corridors.

I had a whole heap of other problems with doors - the main one being that they’d be visually lost and hard to see in tall walls that ran vertically (here: http://www.triangularpixels.com/Albion/Images/v0.1/Combat.png is one where I’ve made the walls half height to try and make them visible, but it just looks weird in other ways so I ditched that).

I’m not just there yet, thought door rendering is next on the list (this lunchtime?) :slight_smile:

Any good resources for door sprites though?

Kev

Afraid not - I cobbled mine together by splicing bits of wood plank sprites together. ;D

First hack at rendering it:

http://dl.dropbox.com/u/1668516/screenshots/dungeon1.png

Took your approach, Doors are a rescale mash-up of a window shutter.

Path finding and some lighting next I think.

Kev

Are you deliberately always having double doors for vertical walls? How does it look for single doors?

Actually, those are single doors :slight_smile: Art skills++

Kev

oh nice, must say that it already looking really nice and from what I’ve seen of the new slick lighting stuff + the above screenshot, this is gonna be pretty awesome, can’t wait for playable version :slight_smile:

Oh, you’ve shortened the walls so it’s visible. I found that looked a bit weird for me when I had characters standing next to it, but you might not have that problem.

Shortened them up a bit now and they do look nicer. Have to work out character rendering I guess.

Kev

This is what I did in Sinuosity, which is a maze generator that allows each space to be accessed by only one path. I tweaked the algorithm in certain tests to do some 2-lane corridors and the like, but what usually felt the best was to just open up random spaces in the level. You then have this interestingly laid out dungeon that’s very mazelike but also filled with rooms, and one path to a point turns to many. What’s much more difficult is randomly blocking off areas - because doing so can inadvertently cause something to be totally inaccessible. I toyed around with that part of it for a bit but never got it working well enough.

Seems to be working out ok visually:

http://dl.dropbox.com/u/1668516/concept/warp3.png

Kev