Sunday 31 August 2008

Designing a Magic System - Part Eight (Fireballs and Magic Missiles)

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

If elemental damage is a problematic cliche for how to deliver damage in a magic system, then it is a couple of other problematic cliches, magic missile and fireball, that point to a smarter way of implementing differing damage types. Magic missile is a Dungeons & Dragons trope: a low level spell which creates an uninterceptable sorcerous arrow of energy that seeks out a target in line of sight and hits it - with only very limited ways of the target preventing the attack. They may as well have called it 'Directly Deduct Hitpoints' - and it appears in the latest 4th edition, the designers have succumbed to allowing mages to do this directly for free on a round by round basis.

Similarly Fireball is problematic because its naive implementation: filling a 30' radius volume with flame for any point within line of sight - creates all sorts of issues when interacting with that other cliche, the 10' x 10' corridor, as the volume expands to fill roughly 110 of those corridor grids with fire. The result is a convenient exfoliation of the average size dungeon level (woe betide the designer who has built their dungeon with more realistic size corridors).

Angband's implementation of these is just as problematic, but for different reasons. The Angband magic missile is classed as a bolt spell, which means it hits the first monster when projected from the caster, with the projection moving either cardinally or diagonally through grids to best trace a path from the caster to the intended target. While this avoids the automatically hit anything issue of the Dungeons & Dragons MM, Angband has replaced this with a ridiculous damage to mana ratio, which is not matched by any other spell, along with the fact that magic missile damage is pure and therefore not susceptible to the same problems as elemental magic. As a consequence, magic missile is a reliable workhorse, up to and including the process of killing Morgoth through a magnified death by a thousand cuts. With the spell macroed to the tab key, it is often a process of merely tabbing through encountered monsters without much thought involved, and blinking away should one make melee distance - leading to Angband's not infrequent death by boredom.

I have no issues with keeping a spell useful throughout its life, but I do have problems with the first spell a mage learns being used to kill the end game boss. Although the irony is palpable, this does limit the effectiveness of the mechanic of learning other spells.

Fireball on the other hand is problematic because it remains effectively a line of sight spell, and therefore becomes a game of pick the target I want to inflict the most damage on on a round by round basis. There is the issue that fireball can destroy items on the ground, but this is often an advantage in the hunt for the artifact subgame, as artifacts will remain undamaged while other less useful items burn. Angband doesn't allow fireball volume to be displaced like it does in D&D, so fireball only affects targets within 30' radius - but the one target it doesn't affect at all would at least make the spell more interesting if it did. That's right: in Angband, the caster is immune - rendering it consequence free to use at any range.

At least fireball uses elemental damage, which makes it a less than automatic choice. (Priests get a pure damage ball spell with the same lack of disadvantages that becomes the magic missile workhorse of the priest world - however it is hampered by a much less effective damage to mana ratio.) But as is often the case with computer programmers doubling up as game designers, the temptation to re-use an existing algorithm is too great, so the until recently, almost all other mage spells were an elemental ball of another flavour, which leads to the problems with elemental magic that I highlighted in part seven. (To reiterate: being able to cycle through the same spell in different elemental flavours makes elemental magic less interesting).

So how can these spells be improved in Angband. What would make magic missile a less than automatic choice for starting the game? How can fire/acid/cold/lightning/orangejuice ball be made more interesting? Luckily, I'm able to point to variants: in particular Sangband and Oangband, where the designers have taken a long hard look at the Angband spell systems and redesigned them.

Firstly, magic missile would not be an automatic choice, if there were other viable starting choices and a less overwhelming damage to mana ratio. At a cost of one mana, it is too hard to design other attack spells: by doubling the cost to two, and boosting the starting mage's mana to compensate, the game designer gets more flexibility to create spells that have a cost of three, four or five mana. As for the viability of other starting choices, adding spells that inflict elemental damage, which has the drawback of not damaging every creature that the mage encounters, at the benefit of causing more damage than magic missile, would give the starting mage a different range of options, with clearly defined benefits and drawbacks.

But by adding flame missile, ice missile and so on, we just end up in the same problematic elemental position as fireball: it becomes simple for the low level mage to pick the right flavour once they know the particular elemental vulnerability for a creature. In fact, the problem is worse, because we've just boosted the overall damage output in order to make these spells attractive compared to magic missile. We need to increase the risk of using these spells at the same time as we provide increased damage: ideally we would like to increase the cost of switching from one elemental type to another.

Sangband has one mechanic that does this, which is a weather system for Druidic magic. Within the weather system, there are three different sliders (still air to windy, hot to cold, wet to dry), which vary randomly and can be controlled by a number of weather spells. Each slider increases the effectiveness of one elemental attack while reducing another: in hot weather, fire becomes more effective while cold is not. This makes a druid have to decide whether or not the weather is right to fight a particular monster, and a combination of monsters and weather factors make make a particular scenario especially difficult: there is no ideal time to use cold and fire attacks together. (It would be even more interesting to make the spells themselves affect the weather - so repeatedly using fire would heat the room up, making it harder to fight monsters with cold at the same time).

But the weather is an independent variable which is not necessarily intuitive (can you guess what weather condition boosts acid spells, for instance?). And there is a much more direct and easily understood parameter that we have not considered for damage spells so far. The spell's shape. I've discussed two spells with very different shapes: magic missiles - used against one target, a project which hits the first monster in a direction; and fireballs - affects all targets in a set radius, point and shoot.

And that's the second, obvious recommendation: fireball needs a clearly understood drawback. Which is why in Unangband, I implemented friendly fire - or more specifically self-harming fire. I've hinted earlier that is what it may need: I'll stress it here. If you use a fireball, or for that matter any area of effect spell, too close, you should get damaged as well. The convention comes from grenades in first person shooters, which are the most easily understood, but it is one that can readily be applied to magic attacks. And it is the clearest way to encourage fireball to only be used at a distance - not up close.

I'll suggest an exception, which is spells with a radius which is always centred on yourself. And you may immediately intuit that there's another shape available: combine magic missile and fireball to have radius affecting spells, which apply to the first target they hit. Call them minor fireballs, which is the convention I adopted in Unangband.

And I'm sure you can come up with a library of other shapes. That's what we'll be looking at in part nine: how to design different spell shapes, what is interesting, what is effective, and how to balance different shapes against each other.

And that is part of the secret of designing a magic system: not only must you vary the element the spell attacks with, you must vary the shape. That way, to swap from cold to fire to lightning, you must also swap from any range to far away to close up. And the strength of roguelikes is that this positional system is a fundamental part of the game, something more complex than the Final Fantasies and Bard's Tales of the world - even, when you include tunnelling and other terrain deformation, more complex that Baldur's Gate and Planescape: Torment, the great RPGs of yore, and the major brand FPSes of today.

More to come in part nine. And I'll be confessing the other secret, to my shame, of designing a great magic system in parts ten and eleven.

7 comments:

James McNeill said...

Positional gameplay is, indeed, one of the main strengths of the Roguelike genre. I think you're completely on the right track with designing each spell to interact with the shape of the environment in a distinct way.

Hillwaaa said...

The only redeeming feature for elemental damage that I would note is that it would be useful, IMHO if the following two features are also enforced:

1) The spellcaster is able to choose when they memorize the spell, the elemental damage type.

2) Gameplay does NOT support resting whenever you feel like it just so that you get your full spell set back.

That way, if you were heading up into the mountains to clear out a cave full of frost giants (or whatever) you may memorize a bunch of fire based spells, so use the magic missile as fire-missile etc. However, if the frost giants have pulled a quick one on you, and convinced a few of their volcano-dwelling fire giant cousins to join with them, you may be in a little trouble, as all your fire spells will be less effective.

This is where point (2) is a big requirement. If you could then walk back outside the cave, and 5 metres from the entrance setup camp and re-memorize your spells to a different elemental type, like you can in so many of the D&D based games out there, the gameplay falls to pieces and your choice of spells has no impact, as you can change them at will.

If you were however, constantly harried by the giants who threw boulders at you, forcing you to retreat to a safe distance (or potentially back to town if you had killed some before fleeing) then that would be a much more 'realistic' experience. Once back to town you can re-fit, and try again.

Not sure where I'm going with all of that, really, just thought it would be an interesting way of implementing elemental damage for those that like it.

Nick said...

This is an excellent summary of the issue, and my personal favourite of the series so far. It's going to be very helpful for me when I update the mage spells for the next version of FAangband.

Soyweiser said...

A thing which always bothers me about fireballs (apart from the sometimes lack of friendly fire, some games do have this) is that the ball never really fills all the space, it does not react like a real explosion.

Say you have a 3x3 fireball in a simple corridor. Then in most games you only affect 3 squares, and the other 6 are wasted. I would like fireballs to bounce of the walls and fill up the corridor with fire. Perhaps even letting the blocked fire bounce back (so the central square is hit 3 times instead of once).

This would make the fire act more like a realistic explosion, and would make it much much more dangerous in closed spaces. (So it should be powered down a bit for this occasion). Which means you would be more likely to use it in closed spaces against powerful monsters. This makes the use of such spells more tactical.

(Of course, dnd has done away with the fireball=explosion mechanic. In dnd it is just a sudden occurance of flames, not an explosion. But I always thought they did this because otherwise the spell would become even more powerful).

KingMob said...

4th ed. D&D magic missile is an attack which targets one target's reflex defense. It does not work automatically; you have to succeed on an attack roll.

Jotaf said...

Soyweiser is right, but if an explosion simply fills up volumes it wouldn't be that effective against tough enemies in closed spaces; it would simply spread more.

Maybe the best way would be a combination of two effects: the explosion spreads out, but when one of those tiles has walls all around then the damage is greater.

To stop this from becoming an insta-kill on corridors, some of the volume of the explosion should be lost at that point, and of course the damage bonus must be a sensible quantity.

Actually this would be more properly implemented with a simulation of pressure and damage depending on that, but that would be overkill :)

Soyweiser said...

The old pnprpg shadowrun (raise hands if you know it) had some interesting explosion mechanics (iirc), an explosion gave shockwaves and bounced these shockwaves of walls (each bounce reduced the power of the attack). So if you where in a corridor the explosion would hit the sides again and again, and each time the shockwave crossed the central explosion square it would also do more damage there. So if you where in a close space you would get hit by a much stronger force.

for example, you are only standing against a wall, a str 10 grenade explodes under you, you get hit by the initial str 10 blast. The blast bounces against the wall (becomes str 9) comes back to your square (becomes str 8) and you are hit for another str 8 attack. If you add explosions together you would be hit by a str 18 attack. (In a hallway of size one, it would be str 50).

This was horribly effective. Grenades in close spaces killed almost everything. (Or blew out the walls).

I'm thinking of implementing such a system in my rl. each square traveled or each bounce reduces the strength of the shockwave, but adds to the damage done to the square.

Of course the size of the explosion, and the type of damage it will do are all to be determined. (I think the explosion should have a strength and a damage dice, for each point of str a square was hit, it has the potential to do one damage dice damage).