Wednesday, October 04, 2006

A Balanced Fairy Tale

Gather around and I shall tell you a (very long) story of a fantastic contest, a festival of carnage which brought warriors from every corner of the globe. Yes, a good, old-fashioned, world-wide beat-down.

Wait, you've heard this story before? What's that? Mortal Kombat? Dead or Alive? Soul Calibre? Darkstalkers? Virtua Fighter? King of Fighters? Street Fighter? Fighter Fighter?

Some of the most observant of you have probably noticed that certain fighters fit certain players better than others. Other of you have probably noticed that some people consider some fighters cheesy. Others might have noticed that certain warriors tend to beat specific other warriors, but lose to still other warriors. "Is this balance?" you cry, "Nobody gets to play Vega, he's too freakin' cheap!" But the other day, it was Chun Li we banned...

I have cracked the secrets. Yes, indeed, like Indiana Jones I have braved the wilderness, searching for the holy grail of Game Balance, until now done mostly by the Deep Magic known as "Guess and Test".

The First Secret of Fighter Game Balance is Spherical Coordinates.

Nearly every move in nearly every fighting game is character-centric. The moves issue from the character, center around the character, and affect specific distances from the character.

It's a mistake to think of an attack as having a given range. Instead, it occupies specific layers of the sphere.

For ease of not-letting-our-brains-ooze-out-our-ears, spheres come in five onion-like layers: immediate, short, medium, long, and extended ranges. What these ranges actually are depends on the game - a game like Dead or Alive, with no weapons or energy attacks, "extended" is about five feet. A game like Darkstalkers, extended range is "as far as the screen can possibly stretch". Games might have fewer ranges, if you really feel like it.

Few attacks only affect one range. Most attacks will "cut through" several ranges on their path to the enemy's face. For example, thrusting a spear pokes a small hole through medium, long, and extended ranges.

What percentage of the effective surface of the sphere an attack covers is also critical. A spear thrust takes up only a tiny portion of the layers it penetrates. A swing will carve a huge horizontal line through the sphere. A vertical slice may carve a line just as large, but it cuts through less effective surface, since surface above head height is rarely used in today's 3-D fighter games (except for juggling purposes).

Now, looking at the mathematics of it, a spear thrust covers only a teeeeeeeeny tiny little bit of space - say, 1/30th that of a swing. But it's not 1/30th as effective. That really screwed me up for a long time. How do you account for it?

I tried a couple of methods, but the one that works is to add the size of the opponent to all edges of the effect. It makes sense, when you think about it: in his attempt to dodge, the opponent must heave his fat ass out of the way. The bigger the ass, the more heaving is required.

Therefore, a spear thrust pokes an enemy-sized hole through several layers of sphere while a swing carves an enemy-height hole along the course of the swing. This means that the swing is something like 2-4x as "effective", which is just about right since most thrusts are either faster or cover more layers of sphere.

Already, we can see a few fun things developing.

First, long-range swings are rather evil, since they carve a lot of surface area out of a lot of layers of the sphere. Hence, most long-range swings are quite slow, with an impressive wind-up. There are a few exceptions, such as the knight class in Soul Calibre III, and I generally find those exceptions to be the cheesiest thing since gouda.

Second, when you're fighting tiny characters, horizontal swings should be moderately more effective than thrusts or vertical swings. This is especially true because small characters typically have a much faster foot-speed and better dodge moves. Innnnteresting. This is not true of games where size is virtual and has no actual effect on the collision box, and is obviously slightly different in 2D fighters.

Okay, so rule 1: Spherical coordinates. Rule 2: add enemy size to attack effects.

Rule 3: Optimum range.

Most moves have an optimum range. Some moves are very forgiving, with a range of ranges, but even these moves typically have a range they are "best" at. For example Ken's fireball can theoretically hit at immediate range, but is usually of more use at longer ranges.

Most characters have moves which are geared towards working at a specific range. In some games, like Dead or Alive, this is extremely subtle. In other games, like Soul Calibre, this is extremely pronounced. Most of their moves work most effectively when the enemy occupies a specific layer of our killer onion.

There's two kinds of "focusing" to take in to account. One is how forgiving each individual move is as to range. Some characters, like the barbarian class in Soul Calibre, can happily allow their enemy to occupy any of the three middle ranges because all their attacks hit all three of those ranges. Being low-focus in this way is very beginner-friendly.

The other kind of focus is how many of their moves deal with that range as opposed to other ranges. A barbarian has few immediate or extended attacks, so they are very "focused" in this way. On the other hand, a monk wielding a size-changing staff has moves for every range, usually found when least applicable. Being low-focus in this way can be easy for advanced players, but beginners will frequently suppose that "forward thrust" should be something other than "poke your finger into his belly button, if it happens to not be more than one foot away".

Once a character's optimum range and level of focus is determined, there is the art of staying at optimum range. There are two basic options for this. One is maneuvering. Typically done by smaller characters, they simply dash into their favorite place on the map.

The other is knockback. This is a misleading term, because not all knockback is actually knockback. Some people (Scorpion) have knock-FORWARD. Some people have knock-DOWN. Many people have knock-UP, usually leading to an asinine 75% damage combo.

The most interesting form of knockback is self-knockback. A lot of attacks move the attacker as well, covering distance while attacking. This is a very common method of "knockbacking" into a shorter range.

For most characters, the more they have of one of these methods, the less they have of the other.

Now we're starting to see some intertwined stats. Movement is useful for dodging as well as changing range. So, technically, movement should be nerfed somewhat, so it's not quite as easy to dodge things as it should be. Most games seem to do this.

Most games also take the approach that small characters should be fast, short-range characters. This allows them a strong "hook" to balance the game. Small, long distance chars are irritating, largely because the opposite supposition is that big characters need to be slow and long-range, giving those small guys plenty of time to get out of the way.

There are games which break these conventions. Games where long-range attacks are frequently as fast as short-range attacks. Characters that do this usually feel "cheesy" - think Kilik and, if you've ever played it, the magicians in Valkyrie Profile Fight Tag.

Blllleeeeaaaaahhhh... running low on juice. I'd like to say I'm coming up on the home stretch, but there is really no end to the exposition.

So the last thing I'll talk about is rule four: speed.

How long the enemy has to evade, block, and/or counter an attack is critical. This is primarily affected by how long the pre-attack animation is, and we can also think of the post-attack animation as part of its "speed".

Many attacks have "paths" - classically, attacks simply "popped" in, affecting their effective areas simultaneously. This changed, famously, with Dhalsim. Now there are many games (usually 3D ones) where the attacks have an effective area that changes moment by moment. Obviously, these attacks are "faster" near the beginning of their arc, and "slower" near the end, since they give more time to react.

The other half of this equation is how long the enemy takes to react to your attack. An enemy must see what you're doing. Milliseconds gone, decreases with training. They must recognize what you're doing. This takes less time the more you've fought against a character. Some characters, such as Yoshimitsu and Voldo, specialize in attacks that are hard to predict. Lastly, they must actually block (which takes a certain amount of time) or dodge (ditto).

These four primary rules interact to form a brutal statistical representation of what characters do what. I haven't explained how to actually BALANCE anything yet, and I'm not going to do that today. (And then they ate the minstrel.)

Rule 1: Onion spheres
Rule 2: Add enemy size
Rule 3: Optimum ranges
Rule 4: Speed

Rule five is combos, but I'll just leave it to your imagination.

2 comments:

Craig Perko said...

Bah! If you use this system to balance a "evolve your own character" game, you'll end up having to use different weights due to excessive levels of familiarity with the character's moves... but a "make your own character" game wouldn't require that...

Bah!

Patrick Dugan said...

This exhaustive (and I imagine exhausting) analysis is actually kind of useful to a side-project I'm doing in my CyberArts class. I'm planning on doing a final project with a two coders that takes stolent tile/sprites from ROMs and puts it into a metroid meets shonen fighting/adventure game.

I was thinking originally of having the character evolve through choices made when finding power ups (more health or more energy, more speed or more blocking ability, ect.) but maybe it'd just be easier, to make and to play, if players could pick pre-fab fighters or customize one out of a database of stolen sprites, like on Shyguy Kingdom.