Friday, 22 August 2008

Designing a Magic System - Part Seven (Elements)

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

Elements are an RPG design trope: but appear initially to be a useful one. There are well designed games which have a huge, nay, exhaustive list of different element types: fire, cold, metal, grass, wood amidst the 17 different types that the Pokemon series has featured over the years. Angband has ‘about’ 15 different elements, from the obvious, to mysterious – Nether, Nexus and Chaos being the amongst the more esoteric element types.

The elemental system comes from the pre-Socratic theory by way of Plato which divides the world up into four different characteristics: fire, water, earth and air, which has inspired countless theorizing by later philosophers and alchemists, who have derived the medieval system of humours (with its temperaments of Sanguine, Choleric, Melancholic and Phlegmatic), the aether through which all planets moved, and the Iron Crown Enterprises' Rolemaster RPG supplements filled with pages of spell tables and colourful criticals. The flaw with the elemental system is that it has never had any basis in fact: it was the earlier Indian philosophers and Greeks such as Democritus who was much closer to the modern understanding of matter with the concept of indivisible atoms making up the natural world.

The elements that feature in computer RPGs are derived in part from Dungeons and Dragons and the Rolemaster system, in part from Michael Moorcock’s conception of Law and Chaos in the Eternal Champion saga, in a kind of Chinese menu cocktail of different inspirations and derivations. Elements are used to divide damage up into different types: they may have related status effects, such as freezing, poisoning or burning, and unique to roguelikes, they may damage or destroy different classes of equipment that the character is carrying or wearing. This last function is a lesson in necessity: roguelike players learn quickly never to rely on a single line of defense which may be exhausted, stolen or destroyed.

It is the interaction of elements and damage that proves the most interesting – at least with initial inspection. Different elements of the same ‘damage level’ are in most RPGs less or more effective against different creature types. This is because hand in hand with elements is the concept of damage resistance – that is, certain creatures are harmed less or not harmed at all by certain attack types. Again, there are numerous RPG tropes in this area: skeletons are notoriously hard to damage with edged weapons in many games, ghosts resistant to physical damage of all kinds, vampires hard to kill except with fire or water.

What ends up forming is a matrix of element against resistance: either directly – in that each element is given an explicit resistance value which reduces the over all damage; or indirectly, in that certain elemental attacks are more effective against creatures of other elemental classes: fire more effective against wood or paper and so on.

Resistance is not the only factor that can be brought into play: creatures can also be vulnerable to particular elements, taking more damage explicitly, or healed by them instead of being damaged by them. With regards to healing, it is assumed that once a player learns of this fact, they will no longer use the attack against the creature so healed. With regards to vulnerability: this is exactly equivalent to the creature affected having less overall hit points, but implicit resistance to every attack except the one that they are vulnerable to.

Having both resistances and vulnerabilities makes it harder to balance creatures overall. As soon as a player discovers a vulnerability, they’ll attempt to exploit it – making the overall creature power reduced by the amount the vulnerability increases the damage that creature sustains. In order to make the job of balancing easier, eliminate vulnerabilities from the game – or at least balance creatures as if the player was always attacking them at their most vulnerable point. Otherwise, a creature with a vulnerability is only a puzzle to be solved one time – any further instance of that creature will be summarily dealt with (at least in isolation).

It is this puzzle solving component of discovering resistances (and implicit vulnerabilities) that should be the focus of elemental damage design. The number of elements that the game has is at the heart another user interface problem: similar to the status effects described earlier. The player needs to be able to establish and track whether a creature is being damaged by a particular element that they are employing in order to determine whether to continue the attack type or switch to an alternate attack. At the same time, the player also needs to be able to remember which attacks they have already employed, and whether the creature was resistant to those previously tested. The challenge is to expose this information effectively in the user interface. Again, this will depend significantly on whether combat is turn based or real time – as the player in a turn based game will have significantly more opportunity to examine the interface to make an optimal decision.

The simplest elemental damage system is two damage types with binary resistance levels: either the attack is completely resisted or completely effective. As Ikaruga demonstrates this can be effectively portrayed in time intensive fashion – the game features light and dark attacks and the player ship has two modes which either ignores or destroyed by the attack depending on which mode it is in. Making the attacks more complex trades off the player cost of recognising the attack against their attention span and the overhead of memory recall. At the other extreme, Final Fantasy allows the action to be paused, and a table of elemental resistances for a particular monster type to be displayed which feature a percentile based resistance system. This removes the player from the action completely and requires rote learning or continuous look ups of the table depending on how frequently the creature type is encountered.

Angband falls somewhere in between, in that it features a large number of elements, but creatures which either do or don’t have a particular resistance type. In reality, elements are divided into common and less common types: the five most common are also resisted across large numbers of creature types. Unangband makes the resistance system less predictable for any creature type, but trades this against ensuring that only a limited number of creature types are encountered on any level. For instance, in Angband, no undead resist fire – in Unangband, a limited number do: just enough to keep the player on their toes. Similarly, the rarer element types are only infrequently resisted.

The behaviour using more complex resistance systems is that of the player failing to recognise a resistance, and as a result, using a sub-optimal attack or wasting a valued resource against a particular creature type. This effectively makes the creature more dangerous a threat than otherwise anticipated by both the player and designer. In Angband and variants, this is guaranteed to an extent by requiring that the player learn the elemental resistance by attempting an attack against the creature type: this is then retained in the monster memory for later recall through a text based interface.

At the worst, the player will ignore the feedback telling them that they are not using an optimal attack for multiple turns – effectively multiplying the creature threat by the inverse of the amount they resist the damage by. This implies that the more a creature resists an attack, the greater the feedback they should receive that their attack isn’t working. Leon Marrick in Sangband adopted a feedback system for some resistances where a certain percentage of attacks fail, with a warning, instead of a certain percentage of damge being resisted with each attack. This makes the feedback directly proportional to the individual attack success, while encouraging the player to ‘gamble’ on getting a lucky full strength strike.

The more usual behaviour though will be for the player to cycle through a set number of attacks, trying each in turn until the correct element is found – or for them to guess or find through user interface feedback or a spoiler which the correct element is first time. And if the element damages are equally available and equivalent: that is a fire bolt has a same effect as a water bolt, as a lightning bolt – then there is no benefit in having an elemental damage system at all. And if they are not equivalent: that is fire is always stronger than water, then monsters which resist fire are simply scaled up in effectiveness.

That is the weakness of an elemental damage system in itself: the choices while initially appearing interesting, often devolve to an only one right answer. Elemental damage when poorly designed ends up becoming a game of looking up tables and exploiting status effects. It is possible to manipulate the availability of different elements to make this more interesting, but this is a difficult balance to get right. In designing a magic system, it is necessary to look beyond elemental damage to games which don’t rely on this technique: it appears that Team Fortress 2 is the shape of things to come.

More to come in part eight.


Hillwaaa said...

Great read as always - looking forward to seeing where you take this in part 8. I'm also wondering if there is a case for implementing a system whereby the player's avatar is the one responsible for 'learning' the resistances, not the player.

Possibly this will lead to frustration on behalf of the player when they know a special attack is required (from when they played a previous avatar), but possibly it will lead to more interesting game play, with intelligence of the avatar controlling what can and cannot be learned about creatures, hence limiting the stronger, dumber characters to less sophisticated attacks?

Andrew Doull said...

This is somewhat the case in Angband and variants: there is a monster memory that tracks what the avatar / character (there really needs to be a convention for this term) learns about monsters. This memory persists between lives - it is the only thing that does so in Angband, which shows how important it is (And to prevent the player frustration you highlight).

On an unrelated note: I think I've got at least 3 or 4 more parts to this article series, which makes it officially the longest I've written. I've also rebadged it as Designing a Magic System - as it is not very Unangband specific at all.

Andrew Doull said...

Also: Feel free to expand on Final Fantasy's elemental system here in the comments thread. I've not played it myself, but watching my flatmate of a couple of years ago cast spells with various misspellings of 'Fire', 'Air' etc. gave me enough information to go on here (I'm also not sure which version he played - I think it was the one with gender ambiguous teenagers travelling the world in an airship ;)

Nick said...

For the nitpicky record, wood is not a type in Pokemon :)

Nice sum up of the vulnerability issue in Angband - I knew there was a reason I wasn't putting monster vulnerabilities in.

wtanksley said...

There's more you can do with elements; consider Crawl, in which the elemental spells tend to behave very differently.

Programmers like to have clean, binary classifications; if you can program a 'sticky flame' of course you can program a 'sticky ice'. But there's atmosphere to be considered too.

Andrew Doull said...

Mr Tanksley: Don't pre-empt me... I'll be getting to that.

kaypy said...

One thing you seem to be glossing over here is that different elements can require strategic choices 'which elements do I have available' as well as tactical 'which do I use right now'.

The former tends to be more interesting as there is more likely to be a price tag associated with the elemental damage. Is the weapon that has the fire bonus better than the one with the higher base damage? Or should I carry both, just in case? How much is that going to affect my movement rate?

On the flip side, how much of playing *band is trying to find a combination of items to resist, if not everything, then at least the subset that Morgoth is going to hit you with?

Andrew Doull said...

Kris: You're right - I am glossing. Availability is important. However, availability is usually of secondary consideration in most magic systems - it only usually applies to item based magic. For a spellcaster, the majority of time availability is not the critical concern.

Snut said...

There's also the very important consideration that the player may only rarely have the luxury of dispensing with threats individually.

For example, one of the few fun bits I recall from DDO was a section in the catacombs where you're forced to face hordes of zombies and oozes simultaneously. Although the resistances aren't magical, the former are highly resistant to anything but slashing attacks, and the latter divide promiscuously when attacked with anything other than bludgeoning. Individually, neither group of creatures would be more than a nuisance, but together they represent an interesting challenge.

I'm sure there are mixed-element examples somewhere, but because of thematic concerns they're probably more limited. Anyway, I think much of the interest to be had from resistances in general is always when facing a mixture of creature types, turning a simple optimisation problem into a much less trivial one.

Brog said...

The point I see in elemental damage types is that it occasionally mixes things up by denying the players their favourite weapons and tactics. If it's a constant factor, having to pick the right element for every single enemy, that's not interesting. If all elements are equivalent in power, that's also not interesting.

For example, if a mage who loves to blast anything he sees with fireballs comes up against a group of fire-resistant enemies, he'll suddenly have to change his approach. This doesn't just increase the difficulty of the battle, it alters the tactics - he can no longer hurt everything at once so it's better to maneuver into smaller spaces where he can pick the enemies off one at a time. If he can just switch over to using "Ice Ball" or "Acid Ball" or "Plutonium Ball" then it is a waste of time having the resistance in the first place.

Of course, most people use elements as a substitute for creativity when coming up with spells. There is no excuse for this.

My current game has a very limited "elemental damage" system. There are three types of damage: direct, explosive, magic.
There is one spell that constructs a fixed shield that protects anything underneath it - the shield has lots of hit points and takes half damage from explosive attacks and 1 damage from magic attacks. This makes the shield last longer by weakening the attacks that do the most damage, and makes it more effective to get up close and attack it directly.
There is one spell that summons a unit with a shield that completely blocks direct attacks in the direction that it is facing. This forces you to attack it from multiple sides at once or to use spells.
This is the full extent of the elemental damage system, and it is quite plenty.

wtanksley said...

"Don't pre-empt me... I'll be getting to that."

I think it's impossible for the maintainer of Omega to ever preempt a developer of any other Roguelike. The next version of Omega might possibly be out before Duke Nukem Forever, maybe.

So... No worries.

VRBones said...

While I was reading this I kept thinking back to an article about game balancing in Kongai by Sirlin.

One of the discoveries is that the choice of elements and resistances doesn't matter much past 3 or 4 before getting too complex to easily work out, but if you provide many different types of attributes that also have 3 or 4 options that also work together, they can create a large area of complexity. Kongai only has 3 damage types (physical, dark or light), but also has range (short, long, or both) and single or multiple hits per round that can be more easily mitigated by high resistance (resistance simply takes off a certain amount per hit), etc.

Christer Nyfält said...

What's your opinion on the optimal number of elements to use? 4-5 as in in Diablo II and MtG? 15-17 as in Pokemon and Angband? Or a middle road of 8-12?

I'm in favor of the medium number approach, since a low number has a potential of becoming boring, while a lot of elements makes gives an impression of a lack of overall vision in the design.

Andrew Doull said...

If I was going to pick a number, it'd be 7 or less.

Angband cheats when it comes to elements: there are the basic five, and the remainder have less complexity. That is, they don't have the full range of immunity, temporary and permanent resist, and are a lot less commonly resisted so effectively can be treated as pure damage + a status effect of some kind.