Friday 19 September 2008

Designing a Magic System - Part Ten (Introduction to Angband)

(You'll probably want to read parts one, two, three, four, five, six, seven, eight and nine before starting this).

Angband and variants are primarily risk management games: and the vast majority of risk minimisation strategies resolve around management of the inventory. The Angband inventory consists of 23 slots, plus 10 equipment slots for items that are worn or otherwise wielded. Each slot can have up to 99 items of a particular type – the equipment only 1. Examples of types include rings of Slow Digestion, amulets of Adornment and potions of Water. (There is a more complex stacking algorithm to allow e.g. amulets of Adornment which have been given different store discounts to stack together, for instance).

This makes no sense from a realism point of view: it is possible to carry 99 potions of water in a slot, but 1 potion and one ring takes up two separate slots. However, from a game balance point of view it makes perfect sense. If you use the analogy of item types being equivalent to functions, or in this instance magical abilities, the Angband player can carry up to 23 different types of abilities to help them in the dungeon. (Actually 22 – the 23rd slot is for handling the inventory overflowing).

There are a number of mandatory abilities: food to prevent the player from starving to death, and light, to allow the player to see in unlit rooms and corridors being the two most essential. Other optional abilities are equally useful: ways to recover hit points (heals), reset status effects (cures), remove enemies from the immediate vicinity (teleport away, banish, destruction) or move the player away from the enemies (teleport, teleport level). These are essential because of the random nature of level design and placement and power of monsters in the dungeon it is easy to end up in a situation where the player can be killed in one turn: even on the first turn entering a new dungeon level.

The slot is the primary unit of magic ability use, and slots are easily interchangeable when new more useful equipment is found, allowing the player to re-spec their character at any point in the game. The exception to this rule is for spell casting characters.

For spell casters, one slot can be used to hold one book. A book contains a number of spells and there are nine different spell books, the first four purchasable in the shops, the remainder found in increasing depth and rarity in the dungeon.

This spellbook design means that a spell caster gets access to far more abilities than a typical Angband character. To restrict this so that the game is as challenging for spell casters, they are limited in a number of ways – they can only choose to learn a limited number of new spells from any spell book they find per level gained (usually one or two per level), they rely on a central pool of mana from which casting spells costs mana, and which only slowly regenerates, and spell books weigh a lot more than most items which grant abilities. (The total weight that any player can carry is also limited).

Angband spell casters have a number of problems that I wanted to address in Unangband. Firstly, and most paradoxically, the damage output for spell casters is too low, which means they end up relying on other attacks than their spell books, and spells primarily to provide heals, teleports, cures and so on. Secondly, the mana stat is too inflexible a restriction, particularly at low levels – once a character runs out of mana, they have to run away and rest (until they find rare and powerful mana granting items deep in the dungeon). And finally, every spell caster can learn all the spells they have available to them – there is no opportunity for specialisation at the cost of available spells.

The answer, it seemed to me, was to add more spells – by adding new spell books, and by adding new spells to existing spell books. I could add various mana recovery spells to spell casters – allowing them to sacrifice time, an important commodity in a game where every action could spell the difference between life and death, in return for flexibility. I could add additional and useful attack spells, particularly at a high level, to increase the overall damage output. And in order to get these spells, the trade off would be which spell books would the player carry – remembering that they had to choose to which spell to learn, so that spells learnt in books they weren’t carrying at the moment were wasted.

In true UnAngband fashion, I designed ‘a few’ additional spell books: 17 for mages, and 6 for priests, and filled them with spells – books of Fire Magic had fire spells, Acid Magic the same spells but with elemental flavours and so on – between 200 and 300 new spells approximately, on top of the 100 or so spells Angband has. I added the additional spells back into the standard 9 books, so it was possible to learn a spell in one book and find a copy of that spell in another. I include spells that had no casting cost and regenerated mana for the caster, perhaps at the cost of some hit points. And I developed new spells and modified existing spells to have higher damage output and utility. (This describes an early iteration of the UnAngband magic system: there are now over 600 spells, 60 mage spell books and a planned 58 priest spell books).

The attack spells that the player can learn at first level, which all have a mana cost of two, are shown below:

First Tier Spells

Spell Name

Damage

Element

Shape

Magic Missile

3d4+(1d4)/5 levels

Mana (unresistable)

Bolt (unlimited range; affects one target; cannot skip over intermediate monsters)

Lightning Spark

3d5+(1d5)/5 levels

Electricity (resisted by skeletons, which are also hard to kill with sharp weapons)

Hands (range 3; affects all targets in a line from caster to max range)

Light Area

1 damage/level

‘Weak’ light (only damages targets hurt by light, status effect of short term blindness)

Area (affects all targets adjacent to caster; radius gets 1 larger every 10 levels without damage dissipating at further ranges)

Torch

2d6+(1d6)/4 levels

Fire (resisted by fire monsters, which are dangerous at range)

Minor bolt (range 6; affects 1 target; cannot skip over intermediate targets)

Acid Splash

4d6+(1d6)/4 levels

Acid (partially resisted by armoured monsters, which are hard to kill with archery)

Minor aura (affects all adjacent monsters only)

Chill

3d5+(1d5)/4 levels

Cold (resisted by cold monsters, which damage useful equipment if you get too close)

Strike (unlimited range; affects one target; can skip over intermediate monsters)

Sting

2d6+(1d6)/4 levels

Poison (commonly resisted, monsters which don’t resist take the same damage again delivered over time)

Touch (affect one adjacent monster)

Mind Thrust

3d5+(1d5)/5 levels

Mental (mindless monsters are immune, which are common starting out but less common deeper in the dungeon)

Aim (unlimited range; affects one target; can skip over intermediate monsters and only requires line of sight, not line of fire)


This is not an exhaustive list of first tier attacks – just a representative selection.

The average damage for each of the above spells for the first 10 levels is shown below using a pseudo average, which assumes the damage increases with each level as opposed to the actual stepwise damage progression to emphasise the relative line slopes. Note that the shape determines the maximum damage output – sting for instance does effectively double damage over time, lightning spark can do up to triple damage as it affects up to 3 targets and acid splash potentially up to eight times the listed damage if the spell caster is completely surrounded. Light Area, which only affects monsters vulnerable to light, has the steepest slope as well as the maximum potential damage output at 50 level, where it has a radius of 6 grids, with 50 damage per grid. (These graphs have damage on the vertical and caster level on the horizontal. Click for a larger view).


Implicit in this idea of progressing tiers of attacks is an exponential damage curve. All attack spells in Angband gain damage as the caster increases by level: usually spell damage is determined as a multiple of player level. But the average slope of this linear relationship should increase from tier to tier, resulting in an approximation of an exponential growth in damage output on a round by round basis as the player gained levels and learns new spells, as shown below:


The cost for each tier is reflected in increased mana cost and chance of failing to cast the spell.

More to come in part eleven.

5 comments:

Mikolaj said...

> This makes no sense from a realism point of view

I don't like this argument. At least during a battle, 99 potions of death in one backpack pocket, 99 potions of Curing in another and a 99 wand of fire balls tied to a strap nearby is much easier to manage than a single pocket with three of each kind in it.

Mikolaj said...

I mean, the slots mimic not only real life holding capacity, but the structure of the warrior's inventory harness needed to find things in the darkness and anguish of a dungeon.

Gareth LovesTha Pye said...

"allowing the player to respect their character at any point in the game"

re-spec. and respect are rather different things. Auto complete / correct can be funny at times.

Antoine said...

Oh God! The anguish

Andrew Doull said...

Gareth: No - its all about respect these days. :)