View Single Post
Old February 24, 2010, 18:36   #26
RogerN
Swordsman
 
RogerN's Avatar
 
Join Date: Jul 2008
Posts: 306
RogerN is on a distinguished road
It's been a while since my last update, mostly due to the birth of my daughter. Coding time is scarce indeed, but work has resumed.

First of all, I've made changes to how doors are handled, both in terms of gameplay and dungeon generation. I decided that the lock-picking system and searching system of Vanilla are flawed, as evidenced by recent changes to searching. Why should this even be necessary? I don't think searching and lock-picking should be random. Either you're skilled enough or you're not - there should be no need spam the 's' key or repeatedly try to pick a lock.

Instead, I've decided that locked doors and secret doors will have a random difficulty associated with them. If your skill exceeds the difficulty then you succeed on the first attempt. Otherwise you will never be able to find the door or pick the lock, so you might as well stop trying - at least until your skill improves. I think this change will actually reduce player frustration.

As a consequence of the above, it's now necessary to ensure that an unobstructed path always exists from the level's starting point to the next staircase, as players could otherwise become stuck behind secret doors which are impossible for them to find. Thus we're finally back on topic: over-engineering dungeon generation!

In order to ensure connectivity and playability of each level, the following steps are taken:

- Instead of generating random door types to start with (open, closed, broken, secret, jammed, locked, etc...), all doors are created as normal, closed doors

- After rooms and tunnels have been created, doors are used to divide the dungeon into several walkable zones. The zones are assembled into a graph structure which tracks which zones are adjacent. Internal doors (i.e. doors inside vaults) are ignored for purposes of diving zones.

- A starting zone and a destination zone are randomly chosen, with preference given to locations which are far apart. These zones will eventually hold staircases to the previous/next level.

- Doors are then randomized. Dead-end zones have an increased chance to use secret doors. All potentially impassable doors (locked, secret) must pass a connectivity check, or the door must remain passable (open, broken, closed). The zone graph structure is used to ensure that a path still exists between the starting zone and the destination zone.

There is at least one other issue to consider. Teleportation effects (?Phase, ?Teleport, etc...) must never place the player in a section of the dungeon which is walled off by locked or secret doors.

A color-coded screenshot of how the zones are divided is attached.
Attached Images
 

Last edited by RogerN; February 24, 2010 at 18:48.
RogerN is offline   Reply With Quote