Sunday 29 June 2014

The dreaded stat system

As anyone who has played an RPG knows, the stat system is crucial and a minor flaw in an RPG's stat system often leads to catastrophic game imbalances, exploits or can render the game unplayable when the extremes play themselves out.
While developing Asciilands, we will be making sure that the stat system is well developed and treated to be as crucial as it is to the entire in-game experience. That said, we want a stat system that's unique. I've been trying out a few things and tweaking the resulting systems and we now have something that we're fairly happy with as a foundation and that we're keen to build on so I'll take you through what we've got both as a "have a look if you're curious" type thing and also to invite feedback from anyone with a thought on it.

What not to do

The stat system reached its current state not by coding it down a certain path but rather by coding it away from other stat systems that I've seen in other games that I just think don't work very well.

Here are the things that need to be avoided:

  • Too complex
    There are people out there who love a hardcore stat system. They get into a new game, see a screen full of numbers and look forward to a time when they'll understand them all. I am not one of these people and I intend to cater for others who are not like this. That said, these people will also be catered for (if they build their characters that way).
  • Too simple
    Diablo 2 had a pretty good stat system; you could control four variables directly, about 10 (?) variables indirectly (via gear or skills) and the rest happened behind the scenes. This was ok but people managed to massively screw it up and with no way to change your past decisions, you could render your character unplayable. Diablo 3 learned from this (sort of); they abolished giving players direct control over stats. This is what I mean by "too simple". Diablo 2 was about balance but Diablo 3 is about massing one of two variable: one to help you survive and one to help you kill faster. The choices are always made obvious to you and you can change them whenever.
  • Too unforgiving
    Diablo 2 not letting you alter your stats meant you could build your character into an unfixable and unplayable corner if you screwed it up. This is too unforgiving.
  • So many calculations behind the scenes that the stats themselves don't mean much of anything
    When I'm playing a game, I want to see a number and know what that number will mean while I'm actually playing. I want the formulas to be simple and consistent. I don't necessarily want to be able to do all the maths in my head but I want to know for sure what I'm looking at without having to test the changes. In Diablo 2 there was a stat that was affected by dexterity called "attack rating" and it was basically the stat that controlled your chance to hit. I, to this day, don't know how it worked. I could probably find out but that's not the point; it was crucial to gameplay for characters that needed chance to hit but it was never fully explained or at all self-explanatory. All I knew was that you needed as much of it as possible. Fine, but when did I have enough? Can I focus on my other stats now? It annoyed me and partly because I was too lazy to research it but I don't think I should have had to. I played caster characters.
  • Ability to create wildly unbalanced stat monsters
    As soon as you stick a multiplication symbol in one of your algorithms (or, if you're feeling particularly crazy, indices), you run the risk of certain numbers reaching great heights, possibly in ways you hadn't anticipated. One thing I was trying to ensure was built in from the start is a "diminishing returns" system (which I'll go into more later).
What then?

Where do you start with that? Here's where I started: Working out what actually needed to be measured and match those things up to a human-applicable kind of stat name. We're all very used to "Strength, Agility and Intelligence" systems and we all know what to expect from that but I wanted Asciilands to be a bit more complex than that to allow for higher character build diversity.
They're a good starting point and in more recent RPGs have been treated more like categories than stand-alone stats. Asciilands will be using them that way along with two others: "Social" and "Magic". Although Intelligence generally control's a player's magical ability in RPGs, in this case it will be a more multi-purpose stat. Intelligence will help you pretty much every other stat if you build your character around it. After all, it makes sense that a more intelligent fighter will do more damage by knowing where to hit, dodge more attacks by identifying where strikes are likely to come from etc.
Social will be more handy for people wanting to play more with the game's economy than the game's world.

What have we got then? Well under those headers, I threw a bunch of sub-stats together. Here's the [ever-changing] list as it is at time of writing:


Woah! Too many? Too complex? Maybe at first but we'll probably go down that well-establish road of only exposing a few to the player at first so as to not overwhelm them. We'll also we working hard to ensure that the game's balance is geared to challenge a character who doesn't care much about the stat system. Someone who does will have an easier time but they will have earned that advantage.

What do they all do?

There's a question with a possibly unexpected answer: most of them won't have concrete functions. The usage of the various stats will be controlled by a system called "techniques". A technique is a method used to determine which stats are used in what parts of the calculations to determine which outcome transpires during whatever event. Different creatures and weapons will have different techniques and techniques are basically a list of stat purposes. At the moment, there are six types of technique: damage, hit chance, crit damage, crit chance, defence and dodge chance.
Let's run over a rudimentary example of a guy using a sword:
Suppose this is what we have:



In this example, the dude will only be using his own base stats and the sword will act only as the technique carrier. In reality, the sword will be adding to stats and the dude would be adding extra variables into the technique but that's too messy for a quick example.

Right so the sword does 80 damage but to determine how much damage actually gets through, we need the dude to be able to amp it up using his stats. The sword's technique variables are a list of which of the dude's stats to aggregate in order to get a "Bias Variable". Also attached to each stat in the technique list is a percentage. This percentage tells us what percentage of the stat is added to the Bias Variable.

In this case, the sword uses Strength, Inertia and Finesse to determine damage. This is how the Bias Variable is calculated:


Now what's a bias variable? Well, in combat, for every calculation there is another calculation to resist it (e.g., damage and defence, hit chance and dodge chance etc.) so the Bias Variables are used to dilute the calculations that they oppose. It's difficult to explain, work with me and it should (might) make sense at the end.

The result here is calculating the dude's ability to deal damage with a sword and the result is "231.9". That means that the Bias Variable for this dude's damage is 231.9 as a result of adding the given percentages of his stats as listed in his weapon's technique list.

For the rest of the example, we'll assume that the target that this dude is attacking has undergone a similar calculation process (but for defence instead of damage) and ended up with a defence Bias Variable of "77".
The two competing Bias Variables are added together and the percentage formed by the attacking compared to the total is then applied to the original damage to determine the total damage delivered.

So the two combined Bias Variables (231.9 + 77) is 308.9 in total. The attacker's damage Bias Variable (231.9) is 75.1% of that total so 75.1% is then applied to the sword's damage taking it down to 60.1 total delivered damage.

If you got a bit lost, that doesn't matter. The best part of this is that once you understand this calculation, you'll understand how pretty much everything is calculated! Chance to hit or dodge and percentage increases and reductions to things are all obtained using this method and all affected by the technique variables dictated by the equipment in use at the time.


Why it's done this way

The key advantages of this system are these:
  • Simple
    One calculation is used to modify or determine the outcome and magnitude of all combat related events (and even more stuff down the track [like economic stuff etc.]).
    The formula is actually really simple and only needs to be understood once.
  • Diminishing returns
    Since one variable only dilutes the other (instead of directly reducing it or something), the advantages received from adding more and more to a single stat are reduced with each addition. Diminishing returns were a design goal from the start because they're the best way to ensure that:
    • You can't just mass one stat and see a linear improvement up and into over-poweredness.
    • When you have a stat that's letting you down and requires a bit of quick boosting, the first boost will give you the biggest improvement and the rest can be used for tuning. This means that if you're in a tight spot, you can quickly solve most of the problem and totally seal it off with only a little more effort.
  • Diversity
    With the ability to make different stats mean different things according to gear type and character build, the possibilities are endless for how people get the most out of their gear and builds. I'm always frustrated but RPGs that railroad you into specialising and then make it impossible to deviate from that specialisation. Surely if a character is strong enough to use a giant stone hammer, they'd have enough strength to draw a very high damage bow! With this stat system, strength could (and most likely will) contribute to hammer damage and contribute to bow range. It also means we can make the stats make sense to the player without just repeating familiar RPG paradigms.
    In short, it will finally make sense to use a bow and an axe without spreading yourself thin with your stats.
I'm keen to continue to implement this system across more enemy types and weapons. I feel like it'll be an interesting extra layer of challenge to not only keep your stats at appropriate heights but to make your stats applicable to your style of fighting (since techniques will be able to be extended to include more stat types and higher percentages).

Giving the players the ability to specialise in a way that feels right to them, and in a way that helps them create a clever or innovative way to keep their combat strong is something we're keen to do.

So yeah, that's the stat system! Be sure to leave any questions or comments below or on the facebook page!