For example, in a game like Diablo, how did they decide how much damage each skill does? Is it the amount of clicks that the player needs to do? Or maybe the expected lifetime of a player? Maybe calculate the probability that the player will die?
There are a few things to point out, balance isn't done exclusively by the programmer, and in most cases shouldn't actually rely (entirely) on the programmer, but the designer instead. Which leads me to the important notice, that it doesn't usually depend on the algorithm itself (unless it needs a big change) but the variables OF the algorithm. For example, the Starcraft II team had something in the editor that could exclusively edit balance through the various inputs and testing the actual design inputs by hand (through play testing combine with common sense and decidind (as previously posted) what is "fun")
In other words, it's up to you how the actual algorithm works entirely. Some people will base it on damage per second, meaning the designer only has to alter how much damage, that the unit will 'do' per second. And the algorithm will say maybe, "once every second, do amount of damage" and it will recieve from the DPS that the designer put into the files via la editor.
This is called "experience." Blizzard has made games before and learned from experience. The heuristic to rating and improving that knowledge is "Is it fun?"
In Blizzard's case they are known for iterating when trying to find fun and balance, a lot, and that shows that there is no secret math but just a lot of work.
A better question might be "once I find out what feels fun, how do I create the math and code to match so that all of my game is fun?"
With a lot of iteration and playtesting.
I think this is what makes interesting the job of a Game designer. You can imagine balancing the game is a big part of what a game designer does once the coding has started.
I've always found Sirlin's articles very enlightening on the kind of work you have to do. He used to work at Capcom as a game designer. Here are a few you can check and are pretty good:
Super Balance Articles II Turbo (How he balanced the remake of Street Fighter II)
He is algo very good at picking apart other games and figuring how they work. Check his site.
There are countless factors to consider. Question is too broad IMO :)
It's all relative too... dmg is only relative to hp, etc. Damage over time (eg damage per second) is likely a good place to start when evaluating a weapon's power. Divide an enemy's HP by the Damage to get the amount of time it would optimally take to kill it... and so on. I'm just talking flow-of-consciousness... I'll stop.
Well the first step is to define what "balanced" is. How long an encounter should be, how much "grinding" there is, how much health should a given NPC take away from the player, that kind of thing.
From there you can pick some equations that get you something close to what you want. From there's it's a matter of testing and iteration. Some things don't have a complete corollary to your predefined values (i.e., how long a stun is worth X amount of damage, that kind of thing) and you have to do testing to figure out what the ratio of things are.
Someone linked to a article in a similar question here that goes into this process a bit more: http://www.eldergame.com/2010/11/how-to-balance-an-mmo-and-how-to-stop/
This is answered but I thought I would comment on Diablo 3 balance, specifically, and how it was described by Jay Wilson and other designers. D3 works off of one large "monster spreadsheet." The rows are monsters and the columns are monster attributes weighted in %. So 100% would be considered average. Paraphrased/very simple view:
Monster | Health | Damage | Exp ------------------------------------------ Monster_A 100% 100% 100% Monster_B 80% 50% 65% Boss_A 200% 120% 300%
This way, they can tune different monsters along the same relative scale. Smaller monsters that appear in packs have lower individual health and damage, but other monsters that appear alone may have higher health and damage (relatively speaking). As others stated, there is tons and tons of play-testing an iteration involved to get both the weighted and base values in a good place against what the players are capable of doing.
Diablo games, in general, use a lot of different tables/weightings to make everything easily scalable.
It sounds odd but Rock, Paper, Scissors is a condensed version of what you’re talking about. I don’t need to explain the rules, but there is a clear balance between the different elements.
Similarly, as most games progress, there are elements of levelling-up as the player increases in skill. RPGs are most notable for this: you have a level which then applies a multiplier on your attack, defence, health etc.
You could try to design the interactions between the numbers beforehand, but it’s easier to adapt them by hand to suit the gameplay you want to achieve. If you want some kind of “method” then you could start by picking a realistic number and then, if that’s not right, halve or double it. If that number isn’t right either, choose a number halfway between and repeat. Eventually, you’ll reach a satisfactory point.