Murder by Numbers
Feb. 27, 2013
Last week was focused on interviews—and lots of them! We had several candidates in the offices seeking positions on our engineering team, and we've sent out several offer letters as a result. If all goes as planned, we'll have some new faces to introduce next week!
We have essentially completed this phase of our hiring plan: all of our current positions are filled (or we've at least made offers to people to fill them). This is really a testament to how much draw this project has. Seattle is in the middle of a hiring boom with local tech giants expanding at a rapid clip. We were a little worried about our ability to attract talent at a rate compatible with our budgets, and so far we've been pleasantly surprised at the enthusiasm of the folks we've talked to. I attribute that in large measure to the fact that this is a really unique and special project and Pathfinder is a property that motivates people.
This week's blog marks a return to the discussion of the combat system. This is, without question, the biggest short-term design challenge the team faces. Of all the systems we hashed out in the pre-production phases, combat had the least amount of attention, because we knew that it would take a team of folks to really nail down what we can do and how we can do it. With Lee and Stephen working overtime on the various interlocking game systems in the combat engine, we're able to start giving the community more visibility into that design.
Core Combat Math
This week we talk about the core resolution system we're doing with combat (as a warning, some of it gets pretty math-heavy). Before we get into all that we wanted to lay out some of the reasons we have veered from directly implementing the Pathfinder RPG tabletop rules.
- We can do a lot more math. We can make systems that involve a lot more math than you would want to require people to do at the table. In the MMO, we can make much more complex and reactive models by making use of our ready ability to run numerous and complicated calculations.
- We need the math to be more granular. We need to keep advancement meaningful over a long span of time, so we need a wider range of numbers to work with. If MMO players leveled up using the advancement system from the Pathfinder RPG, some players would go from 1st level to 20th in a matter of days; we need that to take years. Additionally, computer math using pure integers is faster and less prone to rounding sensitivity. That means we can work with really large integers—something the tabletop game tries to avoid in order to minimize human math errors.
- We need more levers we can use to balance equipment. By this I mean that to make a wide variety of mechanically balanced weapons, we need more stats for them than just damage, crit range/multiplier, etc. Extra variance in the weapons and armor systems promotes a diverse economy and allows for a lot of character ability development without relying on overly specialized systems (and their attached animations, sounds, graphic assets, etc.)
- Our combat will be happening much faster. In the Pathfinder RPG, a combat round (six seconds of game time) can take several minutes per combatant. For us, it happens in six seconds. And since you don't have your other friends to talk to and strategize with while it is not your turn, we need to keep your attention and excitement up the whole time.
- We have to have a system that is fun for both PvP and PvE. While the Pathfinder RPG can do both, some of its systems (such as critical hits multiplying damage) are not ideal for PvP combat. A critical damage multiplier system can make PvP incredibly one-sided, which is not fun for the person who gets killed in one hit without being to do anything about it. Similarly, it's fine to miss a lot due to bad dice luck at a table with friends who can laugh about it, but that's not fun at all against another player who's giving you a fair fight. We've done a lot of things to make the results of combat less "swingy" both for and against you.
- We're not using the OGL. The Pathfinder RPG is derived from Wizards of the Coast's d20 System Reference Document, licensed with the Open Gaming License. Though the OGL technically doesn't have restrictions on media types, it's nevertheless generally incompatible with software development because it restricts a publisher's ability to require additional licensing terms for the end user. Because many software tools and methods of distribution include their own mandatory license terms for end users, they are incompatible with the OGL. Therefore, we have to create game systems that are evocative of, but not clones of, the tabletop rules. Even if we wanted to try and do a game that was virtually identical to the Pathfinder RPG, this licensing conflict would make that impossible.
A Refresher on Attacks
We've mentioned most of this in other places, but it's worth repeating. Some of the core assumptions are:
- Most of a player's actions in combat come from attack feats assigned to a weapon set. A player can have up to six feats on each weapon set (used by the number keys 1-6) and can swap between up to three weapon sets in combat. There is no auto-attack: timing and opportunity cost is a big factor of the system, so you have precise control over when you attack.
- Pressing an attack button begins an animation and consumes stamina; the time and cost are based on the weapon type and the specific attack. The attack may also require a specific range and consume ammunition.
- In addition to having varying amounts of damage, activation time, and cost, attacks differ based on what kinds of secondary effects they have. A power attack leaves the attacker briefly unguarded in exchange for more damage, while a wrathful swing leaves the target unguarded, but deals less damage than a similar attack with no effects.
- Attack feats do not have cooldowns. You can use them as often as you have the time, stamina, and other requirements (and this is another reason there is no auto attack). Some attacks intended to be used less often may be fatiguing—temporarily reducing your maximum stamina—or may apply other very detrimental effects on the attacker that you'll only want to risk if the situation is optimal. Most stuns, immobilizes, and other crowd control effects additionally give the target a temporary resistance to repeated applications.
- Stamina regenerates to full every six seconds, and it generally takes only four to five seconds of attacks to use up 100% of your stamina. Thus, a lot of the tactics of combat involves making optimal use of your available stamina, positioning, and attention to the changing situation.
All of these attacks use the same system to calculate hit and damage, as described below.
Each character has several combat stats, which may be modified by the individual attack or ongoing buffs:
- Hit Points: All characters have HP, and enter the dying state when these reach 0. A starting player character has around 400 HP as a minimum, and a fully buffed veteran is unlikely to have more than 2000 HP. In general, HP will roughly triple during a career.
- Attack Bonus: Player characters can purchase Base Attack that applies to all weapons, and individual bonuses for specific weapon groups (Light Melee, Ranged, etc.). A player character can have up to +150 attack before buffs (+50 from Base Attack and +100 from the specific group).
- Saves/Defense: Player characters can purchase Fortitude, Reflex, and Will up to +150 before buffs (and gain Base Defense from armor, see below). Saves are targeted by attacks, rather than rolled, and most physical attacks target Reflex (since armor provides resistance, there's no need for a different score to represent touch armor class as in tabletop).
- Base Damage: Each weapon provides a damage total in a particular damage type. This can be physical (by far the most common), fire, cold, electric, sonic, acid, negative, holy, or force. The damage rating starts at around 40 (less for simple weapons and more for exotic weapons) and improves based on keywords (see below) and buffs.
- Damage Resistance: Each set of armor provides resistance to damage in the same types as weapon damage types. In general, armor provides mostly physical resistance, but can be enchanted to provide energy resistances. Lighter armors can hold stronger energy resistance enchantments (so an arcane caster may be weak against physical damage, but stronger than a heavy armor wearer against energy damage). For physical resistance, clothing provides 0, light armor starts at 9, medium armor starts at 18, and heavy armor starts at 27. These numbers are increased by keywords and buffs.
- Damage Factor: Every attack has a damage factor based on its weapon and other effects. This is a multiplier for the damage that gets past armor (see below). Any two weapons of comparable tier and quality will have similar Base Damage, but are differentiated by their damage factors. A short sword does less damage than a greatsword not due to Base Damage, but due to a lower damage factor.
- Tier: Most gear in the game, particularly weapons and armor, is broken down into three Tiers. Tier 1 gear is introductory. Tier 2 gear is more powerful, and intended to start replacing Tier 1 gear around 8th level in a combat role. Tier 3 is very powerful, and is only common among characters near the maximum combat level (who may still choose to use mostly Tier 2 gear, which is easier to bind and to replace).
Armor and Weapon Keywords
To a starting character, maximum-quality, top-Tier weapon and armor performs almost exactly the same as his starting gear. This is because the major difference between items comes in the form of keywords, not directly increased numbers. A starter longsword is a 40 Base Damage weapon with the "Slashing" keyword. A fairly potent mid-level longsword still does 40 Base Damage, but has the keywords "Slashing," "Sharp," "Razored," "Silver," and "Masterwork." A starter set of heavy armor has 27 Physical damage resistance and the "Heavy" Keyword. A mid-level set still has the same resistance, but has the "Heavy," "Dense," "Distributed," "Military," and "Masterwork" keywords.*
For weapons, these keywords are activated by individual attacks. The player's first slash attack for the longsword may only look for the "Slashing" keyword, but as it is upgraded, it gains further keywords common to longswords. For each keyword shared by the attack and the wielded weapon, the attack treats the weapon's Base Damage as higher (+5 for most keywords, +20 for "Masterwork" and for other high-Tier keywords).
For armor, the keywords are activated by the player's Armor Passive feat. This is an additional feat the player purchases and slots, and which grants specialized role-related bonuses as well as improving armor. For example, a fighter might choose between armor feats including Archer (bonus to ranged attacks and takes keyword bonuses from light or medium armor) and Unbreakable (bonus to shield defenses and takes keyword bonuses from heavy or medium armor). Higher levels of the feat target more keywords common to the armor type, and increase base resistance accordingly. Heavy armor gains +3 Physical resistance per keyword, +12 for "Masterwork" and other high-Tier keywords. Medium armor gains +2/+8, and light armor gains +1/+4.
Weapon damage scales up faster than armor resistance at a rate similar to increasing HP such that combats between two evenly matched foes just standing still and wailing on one another should take about the same time to drop someone to 0 HP for starting characters as it takes for veterans (though the veterans obviously have way more options than to just stand around and beat on one another).
The Attack Resolution Sequence
So you've pressed an attack button, the target was valid, all costs have been consumed, the animation has completed, and you want to know what actually happens. That's where we get into the actual attack resolution. Note: the information below is throwing out a lot of math, partially simplified for readability.
- The system rolls 3d200 (three random numbers ranging from 1-200) for the attacker. Using d200 instead of d20 gives us more granularity on results. This is one of the only random elements of attacks (other than critical chance): damage isn't independently randomized.
- Depending on the Tier of the weapon, the player takes the lowest, middle, or highest result of the three rolls. This means that a Tier 1 weapon will average about 50, a Tier 2 averages about 100, and a Tier 3 averages about 150. If a player doesn't have upgraded weapon proficiency, a higher-Tier weapon will be treated as a lower-Tier one for this purpose.
- The attacker's total attack bonus is added to the result of the roll.
- This result is compared to the target's total defense. The total defense is equal to the effective save, buffs, and 50 base defense per Tier of the armor (to match the average result of the Tier-based d200 roll). As with weapons, a player without improved proficiency uses higher-Tier armor with the lower bonus, negating most of the bonus of the better armor.
- If the result of the roll plus the attack bonus equaled or exceeded the target's defense, the attack does full damage and has a chance to be a critical hit. This is a separate randomized calculation that compares the attack's crit rating to the target's crit resistance. A critical hit doesn't do more damage, but instead applies an injury that debilitates the target for some time. NPCs (who wouldn't care about long-term drawbacks) immediately expend injuries for additional damage.
- If the result of the roll plus the attack bonus was less than the target's defense, the difference translates into a percentage reduction in the total damage dealt. This reduction is equal to the square root of the miss amount times 5%. Thus, a near miss will do at least 5% less damage, but the attack would have to miss by 400 or more (not possible except in the most extreme cases) to do 100% less damage. This percentage is applied later, with the damage factor.
- The target's appropriate resistance is subtracted from the attacker's Base Damage. If there are multiple damage types on the attack, the resistances are subtracted separately and then the remaining damage is added together. For example, a 60 Physical, 10 Fire attack from a flaming longsword against a target with 39 Physical, 5 Fire resistance does a total of 26 modified damage.
- The modified damage is multiplied by the attack's Damage Factor, and then by any damage reduction from an incomplete hit. For example, a basic longsword attack typically has a Damage Factor of 1.4, so 26 modified damage translates to 36 total damage.
- Some creatures may have an additional, final damage multiplier that applies unless the attacking weapon has a specific keyword (Silver for lycanthropes, Adamantine for golems, Bludgeoning for skeletons, etc.), reducing the final damage. This is the one time a better weapon is useful to players without sufficient attacks to use all the keywords: a Silver sword is still useful to a new player fighting werewolves. Players very rarely benefit from such vulnerability-based defenses.
- The final damage number is deducted from the target's Hit Points.
Additionally, the system protects against players using attacks that have low damage but useful secondary effects to overwhelm more powerful targets that are otherwise hard to hurt. That is, if the target outclasses you enough that you're doing only a fraction of your damage, we don't want you to inflict the full effects of bleeds, stuns, or similar secondary effects.
- All secondary attack effects are reduced in some factor (usually duration) by an equal amount to the amount the attack missed the target's defense. For example, if an attack rolled a 101 vs. a defense of 150, its damage would be reduced by 35% as well as the duration of any debuffs it applies (a one-round debuff would actually last just under four seconds).
- Damaging secondary effects (Bleeding, Burning, etc.) treat the target's appropriate resistance as additional defense that applies only against the secondary effect. For example, an attack with a Bleeding effect that missed by 9 against a target with 40 Physical resistance would have its base damage reduced by 15% and its Bleeding effect reduced by 35%.
- As mentioned, crowd control effects give the target a temporary defense against additional such effects (to make it harder to "stun lock" a target). These stacking resistances are Freedom (for crowd control that prevents movement) and Mind Blank (for crowd control that prevents using actions), and more powerful controls apply more stacks of the resistance. The stack serves as additional defense against the control portion of an attack (e.g., an attack with an Immobilize against a target with 40 stacks of Freedom treats the target's defense as +40 against the Immobilize). These stacks slowly atrophy over time.
Practical Effects of the System
The damage system outlined above does several things:
- Attack and defense are on the same scale, and it's one that keeps even small numbers meaningful throughout your career. An attacker with a +10 bonus and Tier 1 weapon against a target with a +20 save and Tier 1 armor has very similar hit statistics to an attacker with a +80 bonus and a Tier 2 weapon against a target with a +90 save and Tier 2 armor. Being able to give players even a small bonus to attack or defense is going to be useful, particularly when they're fighting evenly matched opponents.
- Damage is split between a number compared to armor (which is consistent across all weapons of the same power level) and a multiplier that differentiates faster, smaller weapons from slower, bigger ones. This split allows us to display resistance in a familiar way (your resistance is just a flat value subtracted from your attacker's damage) while keeping daggers from being completely ineffectual compared to greatswords.
- Damage scales faster than resistance. This allows us to keep lower-level weapons relevant longer against veterans and also compensates for increasing Hit Points. A starter longsword against starter heavy armor deals 18 damage with a full, basic hit. A maxed-out longsword against maxed-out heavy armor deals 51 damage with a full, basic hit. This is nearly three times as much damage, and, not coincidentally, it will be pretty common for a player to triple her starting HP by the time she's wearing that armor.
- By removing both "you miss and do no damage" and "you crit and do double damage" from the system, we keep damage within a predictable range. A run of bad luck can only reduce your damage, not eliminate it, and a streak of good luck cannot crit the target into the dirt without giving them a chance to respond. If your hit points are dropping faster than your opponent's, you can't rely on luck to save you: change your tactics to regain the upper hand, or try to flee while you have the chance.
And that's how the attack sequence works. We are trying to strike a balance in this blog between providing enough detail and creating an overwhelming wall of math; if you'd like more clarification or examples, please visit us on the forums!
*Keywords used in this blog are examples and may not be the same as those used in the final design; they're just illustrative.
Discuss this blog on paizo.com.