Friday, 23 November 2007

Unangband Dungeon Generation - Part Four (Persistence)

(Edit: Part four just got eaten by a AJAX bug in Minefield - Firefox 3 prerelease. I'm rewriting it again and cursing.

If you haven't been following this series of articles, you'll probably want to start with parts one, two and three).

Angband levels are different to many games in that the levels are randomly generated with virtually no delay, and the once the player leaves a level, it is discarded and forever lost.

Contrast this with the many other roguelikes which feature 'persistent' levels. In many instances, in these the player will leave item stashes around the dungeon, in order to overcome their inventory limits. It is possible to have stashes on the current level in Angband, but the risk is high that they will be stolen or destroyed by monsters or nearby player activity, or wiped with the rest of the level if the player is forced to leave prematurely. Angband is a game focused around inventory management and the fixed number of equipment and inventory slots become a mechanism for determining when it is time to leave a level, sell valuable items in the shops and to refresh needed supplies.

Frequently the current level can become too dangerous for the player, and require that they abandon it to survive. Breeders can fill the level through a process of constant replication, and summoners can crowd with their minions. A player may release a powerful monster from a vault without being prepared enough to deal with it. If the level contains a unique item or monster that the player requires, persistent levels would mean that it would be gone for good. In Angband, the unique is discarded along with the rest of the level, and re-generated at a later point in a new level. It is possible to permanently lose unique items (artifacts) although the conditions for doing so regulated closely (and controlled by a 'preserve item' option). Also there are no ready mechanisms to bypass a particularly dangerous level.

(In fact not all Angband variants have this behaviour of discarding levels. AngbandTK allows you to move between the current dungeon level and the surface freely, only discarding the level should you move to the next one. And Entroband, formerly Hengband, has 'semi-persistent' levels, where the levels are only discarded if you should return to the surface, and it is possible to take two different sets of stairs down from the same level and end up on two different levels, allowing you to bypass a dangerous level. 'Semi-persistent' levels address the problem of stair scumming and is something I'll adopt at some point for Unangband).

So the level mechanic in Angband has functions other than just solving resource constraint issues that existed in the original Moria design. In fact, levels in Angband should be viewed as an inexhaustable resource. The player can continue to generate levels freely, until he finds a desired set of characteristics in which he wishes to play. This may be a poweful item near the stairs. Or a monster that can be killed without risk of retaliation. This is why the stair-scumming behaviour is so powerful and so rewarding.

But at the same time there is little to distinguish one level of Angband from the next except the types of rooms placed. Wandering monsters and the items they carry depend only on the player's current depth. There is no indication provided as to what the contents of a level are except an ill-defined 'feeling' which can easily be misinterpreted. It is possible to have a monster created on the far side of the level and the player have no idea whether it is a powerful new threat or a trifling nuisance. The only game mechanic for seeing what lies around the next corner is the detect monsters spell, which provides 100% information over a limited area. And this all-or-nothing solution handicaps interesting game-play choices.

Sangband attempts to overcome this by having 'interesting' rooms, which contain a particular type of monster and are built from a vault template. This attempts to link the dungeon layout at the types of monsters that you encounter, and so provide the player additional information and additional incentives to pay attention to his surroundings. For instance, early on you'll encounter a room containing felines and a large gold-bearing formation of rock. This is an attempt to link the two in your mind, so that the next time you encounter the room, you'll be prepared for felines.

Except that the information is provided the wrong way around. Felines are both fast, and detect the player at a considerable distance. As a result, you'll end up fighting your way through felines and then encounter the room containing the rock formation, which is otherwise empty. And the Kheldon Jones AI, which would ensure that the monsters stayed together and try to mob you in a room, only applies to group monsters (Turning cats into group monsters for the sake of this seems wrong somehow).

Troll pit on the level? You'll fight your way through a huge number of trolls, and then encounter a big empty space. Undead pit - the 'inner' walls that at least served to partially contain the trolls doesn't work as most undead can pass through walls and attack you, before you are even near the pit. A non-Angband example: a significant part of the design effort in the single player Half-Life mod Minerva was spent putting obstacles in the way of the Combine AI, in order to slow them down sufficiently so that they could be encountered at the correct time. In fact, as AI improves in-game I predict that this will become an increasingly prevalent problem.

A significant part of level design, as discussed in the Unity of Design section in part three, is the delivery of enemies to the player in a meaningful and consistent fashion. And the fact that monster AI allows monsters to move beyond a room is the fundamental failing of the room-based model of monster delivery. How Unangband overcomes this will be the focus of part five.

1 comment:

Anonymous said...

Semi-persistent levels seem to be an interesting solution.