Wednesday, 7 May 2008

Vaults

I'm reasonably happy with my current dungeon creation algorithm - for certain types of dungeon. Its good at mausoleum-type levels, filled with rooms and twisty passages. The typical corridor length, room size, probability of a door being placed at the end of or mid-corridor, and even whether rooms can overlap are all configurable. What the algorithm isn't good at (actually, quite hopeless at), are wilderness and cave-type levels. I will probably rewrite the algorithm to generate those properly at some point in the future.

However, I'd also like to add vaults and other interesting features to the dungeon. The most popular way of generating vaults is to use a predefined map stored in a text file. For example, Dungeon Crawl Stone Soup stores the defintion of its (mini) vaults in /dat/mini.des. The current version of Unangband stores its vaults in lib/edit/vault.txt

Here is a sample Dungeon Crawl vault definition (which also contains a large amount of metadata):

#################################
# Another Ice Statue vault
#
NAME: ice2_lemuel
DEPTH: D:12-27, Lair, Swamp, Coc
TAGS: no_pool_fixup no_monster_gen
SUBST: T = TU
SUBST: W = w:20 W .:5
MONS: ice statue
MONS: ice devil w:5/blue devil w:5/ice dragon/freezing wraith/nothing w:30
MONS: white imp/ice beast w:30/polar bear/nothing w:50
MONS: white imp/ice beast w:30/polar bear/nothing w:50
KFEAT: 2 = >
KFEAT: 4 = >
MAP
T..................T
..WWW..........WWW..
.WWWWW........WWWWW.
WWWWWWwww..wwwWWWWWW
WWW3WwwwwwwwwwwW3WWW
WW343wwwwwwwwww343WW
.WW3WwwwwwwwwwwW3WW.
.WWWWwwwwwwwwwwWWWW.
..WWWwwwwwwWWW..
...WWwww12wwwwW...
..WWWwwwwwwWWW..
.WWWWwwwwwwwwwwWWWW.
.WW3WwwwwwwwwwwW3WW.
WW343wwwwwwwwww343WW
WWW3WwwwwwwwwwwW3WWW
WWWWWWwww..wwwWWWWWW
.WWWWW........WWWWW.
..WWW..........WWW..
T..................T
ENDMAP

Here's one from Unangband:

N:2:Octagon
X:9:5:14:20
D: %%%%%%%%%%%%%%
D: %%.##########.%%
D: %%..#..,,,,..#..%%
D:%%,..#.,####,.#..,%%
D:%....#.,#**#,.#....%
D:%.###+,##&&##,+###.%
D:%.#..,,#*9**#,,..#.%
D:%.#..,,#**9*#,,..#.%
D:%.###+,##&&##,+###.%
D:%....#.,#**#,.#....%
D:%%,..#.,####,.#..,%%
D: %%..#..,,,,..#..%%
D: %%.##########.%%
D: %%%%%%%%%%%%%%

I don 't intend to go into detail on how exactly these files are used. If you want more information, the source code for both roguelikes is suprisingly (for C++) reasonable. What I would like to do is use Vaults in the same way other Roguelikes. But, what I have noticed is that each individual roguelike varies how it stores its vault definition, and how much information is stored in each defintion, obviously as per the demand of the roguelike in question. So shouldn't there be a common storage format for vaults amongst roguelikes? A common Vault API, for want of a better name. After all, a vault (no matter its size, orientation and contents) is just a hardcoded subsection of the dungeon, with/without added metadata (which is particularily visible on the Crawl example above).

Further to this, should Kharne (licenses permitting and assuming the vault authors give permission, of course) be capable of reading in and using vault definitions of other roguelikes? Is this even ethical? If or if not, in any case, what would you like to see in terms of vaults in Kharne anyway? How can I make Kharne's vaults somewhere to be dangerous, alluring and rewarding all at the same time? What are the most common drawbacks of vaults you've encountered and how can I avoid them?

UPDATE: A scheme for common vault definitions was proposed on r.g.r.d back in 2003 but it appears nothing ever came of it.

4 comments:

Enne Walker said...

Common examples of vaults seem to be "showcase this dungeon feature", "taunt the player with treasure and danger", "guard this important treasure", or "surprise!". All of these ideas have some meaning behind them that the vault designer is trying to communicate. I would argue that in order for a vault to meaningfully shared among games, this idea needs to stay intact.

I don't want to rain on your parade here, but I think the disparities among games make this almost impossible. If I create a vault that hinges on transparent walls, acid-spitting stationary monsters, or even Lua code, how does that translate to a game that doesn't have those features? Even differences in LOS algorithms can radically change what a vault means.

Ultimately, I think you're better off cribbing interesting ideas from other games, but then creating your own vaults, tailored to your own needs and features.

Dave said...

*nods*. What I might do for now is to adapt some of the simpler Angband vaults to my own neads and see how that works out. I've got to compose another post soon on impelmenting meta-regions in the dungeon, so that'll probably touch more upon vaults.

On the subject of "cribbing" from other roguelikes, one thing I am definitely going to do is blatantly steal Crawl's idea of starting the player in a vault (for rooms and corridor-style dungeons)

Andrew Doull said...

All the Unangband vaults are inherited from either Angband or Sangband and therefore covered by the Moria license / GPL dual license.

As for a vault API - the big problem with it is that the internal representation of monsters, items and terrain varies so much between roguelikes.

Dave said...

*nods*

I could, currently, with a minimum of effort, use Angband Vault definitions *as is*, to produce something close to them in Kharne.

But I'm wondering how ethical it would be to use vaults designed by other people.