Sunday, 13 July 2008

Designing a Magic System - Part Six (Initial Damage)

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

Damage is usually modeled as damage per second, or in a turn based game, damage per turn. DPS can be used to gauge the relative power of two different weapons over time, that is, how much damage on average is delivered by each weapon over a ‘long time period’. DPS is the traditional method of balancing attacks, by ensuring that the DPS of similar threats is approximately the same. I strongly recommend you read Craig Perko’s article on landscapes and level design, which discusses how DPS and environment interact to form game behavior. In this article, I’ll be discussing damage as it applies to attack abilities with infinite range, which are 100% accurate and hit immediately: I’ll then discuss to how to modify attack abilities in part seven.

In a hit point based game, maximum damage can be far more significant than DPS, particular as the threshold of 1 hit point is alive, 0 or negative hit points is dead, is such a significant game component (particularly in games featuring permadeath). A weapon with a high immediate damage but low damage per second may be capable of eliminating an enemy instantaneously, without the enemy being able to return any attack at all. So trying to balancing high immediate damage with a long cool down timer or high mana cost (or any other method discussed in part 3) may not necessarily be effective. And the greater the restrictions on use, the less likely the player will be to remember to use the ability, or to remember that a particular enemy has this ability.

It may be better to model damage as a sliding scale, in which what percentage of enemy attacks will eliminate the player from the game. Ideally at 100% of player hit points, no immediate threat should kill the player – any such attack should allow 1 player action to try to avoid a second attack of the sort. As player hit points decrease, there should be an increasingly level of threat to the player, as the percentage chance of elimination rises. Of course, this ideal of requiring two attacks to kill the player is virtually impossible to prevent in practice, as the player may be hit by two attacks simultaneously, or in a turn based game, two attacks before being given the opportunity to act next.

This suggests that in a single player game, the function of damage against the player is more important than damage delivered by the player.



With a fixed amount of damage delivered by an attack, the chance of the player being killed in a single attack is either 0% or 100%. This does not provide an interesting enough a risk curve for the player. When the damage is a random value between 1 and a particular percentage of the player health, the risk curve becomes much more interesting.


Where the maximum possible damage causes 100% or more of the player’s current health, there is a high probability of death, which is to be expected.

But the percentage chance of death for damage from maximum damage that is a low percentage of the player’s total health behaves as follows. On turn x-1, where x is the player’s health divided by the amount of damage (where x > 1), there is 0% chance of the player dying. On turn x, however, there is a 0.01 ^ x chance of the player being killed – that is a small, and unlikely chance, progressively more unlikely the smaller the percentage of player health that the damage is. However, on turn x+1 and higher, the chance of player death grows dramatically more frequent, as the bell curve defining the total potential damage to the player is shifted to the right.

Damage which is distributed in a statistical probability that models the way that the damage adds up over multiple rounds is the best way to train the player to understand this damage accumulation process. By this I mean, the damage from a single blow should approximate the distribution of damage from multiple blows. A bell curve, such as modeled by summing several random values from 1 to n, intuitively teaches the player this long term damage mechanic. Coincidentally, this can be most easily be represented by rolling several n-sided dice and adding the values together, a method which has been adopted from Dungeons & Dragons.

Damage against enemies should be modeled the same way as damage against the player so that the player is given the opportunity to recognize the underlying behavior. This also addresses what Craig Perko identifies as the predictability of enemy encounters: it should be possible, but unlikely, for an enemy to sustain a much greater number of player attacks than anticipated, or to be eliminated by a much smaller number. This has the unfortunate consequence of adding Skinner box like behavior to the game – where a rule set’s underlying behavior leads to a randomized risk-reward strategy.

Using damage per second, along with random damage fitted to a bell curve, the trade off should be a high risk/reward strategy versus a low risk/reward strategy. Damage per second itself is not a risk, so that all attacks should be balanced against the same DPS. A high immediate damage attack with a DPS balanced against other equivalent attacks, will tend to have a greater probability of eliminating an enemy immediately, which is a high reward, and consequently should entail a high risk. This risk can take a number of forms, which are usually based around putting the player at increased risk of counter attack. Examples of this risk include: having a period of time where the player is unable to attack at all, and therefore no threat to the enemy; limiting the range of attacks to require the player place themselves at more risk; or forcing the player to remain motionless or move at a reduced speed while attacking and are featured in a number of games.

Having multiple attack choices complicates the DPS balance. In combat, a player could switch from an initial use of a high immediate damage attack to an alternate attack method, which increases the overall DPS that the player is able to deliver. To avoid this requires a common cool down timer to all possible player attacks, which may not be appropriate for maintaining suspension of disbelief (Such as sprinting and the flashlight using a common battery in Half-Life 2). It may not be a requirement to avoid this, of course, as the intention may be that the player always attacks with the high immediate damage attack, where possible, or that the counter attack risk discussed above is sufficient counter-balance.

A common alternate method is to tier the player attacks, so that only the first tier has the top DPS, and restricting the player to a single first tier attack. A second tier of attacks can be balanced against a lower DPS rate, without significantly imbalancing the game. The quality of second tier attacks should be dependent on the immediate damage caused by the top tier attack – this can be used to calculate a revised DPS based on a single top tier attack, followed by multiple second tier attacks.

In fact, the player can be given multiple tiers of attacks, from a high DPS to a low DPS, which can be used to trade off time against another game resource. This implies a three way trade off for choice below the first tier attacks: high immediate damage, high DPS, and highly efficient resource utilization. Note that the highest immediate attack can also have the highest DPS in this equation, so it is not a strict three-way trade off, but if this is the case, the next tier down should be much weaker, to ensure the effective DPS remains balanced.

(Note that by balanced, I mean balanced against another theoretical set of abilities in the game. This does not necessarily imply that the player can choose different sets of abilities, but using tiering strongly suggests it. More in parts eight or later).

With the complexities that damage per second vs. immediate damage cause in a game, it is surprising that games seek to complicate damage even more. But inevitably they do. In parts seven and eight, I’ll discuss several complications common to many games: elements, attack shapes and damage over time.

3 comments:

  1. Thanks for another part. My understanding was pretty shallow after the first half, which is probably the fact that I don't play many games and that I'm quite tired right now. However, this having "Unangband in the title" I though it worthwhile to mention my level of comprehension. Perhaps you'll be glad --- it may mean your theories are not very Ungband-centric. :)

    ReplyDelete
  2. An interesting read as always Andrew. I had not considered making weapons do a bell-shaped % of target damage, although I must say I'm now giving it some thought.

    My initial off the cuff question would be how you would include a sense of realism with regard to large creatures, if damage is set return a bell shaped random between 1 and x.

    For example, the standard big beastie, a dragon, should probably not receive 80% damage from a pesky little human wielding a great axe.

    You can always model creatures with 'racial' based resistances to damage etc, but I suspect that it would break most of the benefits you get from attempting to model the damage in the first place!

    Interested in your thoughts and the next part in this series.

    ReplyDelete
  3. I should really drop the Unangband from the title of these essays - we'll get there yet.

    Chris: The intention is not that damage be a percentage of the target hit points. I was just taking hit points out of the equation. An axe versus an orc is the same as a ballista vs. a dragon on a percentage scale.

    ReplyDelete