Aug 13 2014

XP SCALING

This post’s a fairly abstract look under the hood of one of the changes I’m making to CQ2 for 1.04.

THE PROBLEM

CQ2 is big. Running through all the acts with all the classes is a 20+ hour job, never mind trying different builds and approaches. Getting all the achievements has taken people 200 hours of play time. Our QA consultant estimated recently it would take at least half that time with each new build to make sure everything’s working. It’s no longer possible for me to comprehensively try out changes to the game simply by playing it – not if I want to make a big change that affects lots of stuff and release an update a few days later.

So when I want to mess around with major systems, I do a lot of spreadsheet simulation.

(Mild spoilers ahead.)

The experience scaling in CQ2 has troubled me for a long time. Every XP level takes twice the experience of the previous. Since you normally gain about one XP level per area and enemies tend to show up in two- to three-area blocks, a tough enemy that gives you half an XP level when you first encounter it might only give you 5% ten minutes later. Now, that’s mostly fine! Unlike many games with experience systems, CQ2 has super-tight progression; you can’t wonder into the wrong area. I can fill every area with level-appropriate enemies and adjust their XP accordingly. Until now, that’s what I’ve been doing.

There are just a few minor problems. The first is that XP bonuses and penalties are almost irrelevant, since even halving your XP or doubling it only shifts your final level by one. The second is that the “charge on XP” skills in the game, like Heal and Enslave, become incredibly volatile due to the wild swings in XP between enemies and whenever you level up. You can out-level the enemies nearby with just a few big kills, and then your XP gain drops to practically zero.

So I’m making it better!

I’m changing the scaling between XP levels from 2 to 1.414 (its square root). That means the XP required to level up will double every two levels, not every level. Level 1 still takes about 100 XP but hitting Level 10 will now take 6,200 XP instead of 52,000.

The awkward part is adjusting the XP rewards from all the enemies to make sure the XP curve through the game still makes sense despite that massive change. That’s where the spreadsheet comes in!

ENEMY GENERATION

CQ2’s series of roughly fixed-size levels mean roughly fixed numbers of enemies in each. Too much variation and it’d throw off the pacing of combat. You’d randomly get boring levels with hardly any enemies, or levels where you just get mobbed and can barely move until you’ve killed everything. Instead, the variation comes from any given enemy randomly being something weak from the level’s list of possible enemies, like a Bandit, or something horrible, like a Werewolf.

The main complication is that I generate enemies in packs, not individually. Okay, a pack can be a single enemy, but they’re just as often groups of two or three enemies. A pack has a special AI bond; they’ll hang out together and alert each other when they see you. Each pack is a cohesive unit that fights together, making it a little harder to play “safe”, kite individual enemies and stay totally in control of the situation.

So what I’ve done in the spreadsheet is build a simulation that knows the XP value of each enemy type; the combined XP value of every generated pack; and the average XP value of the packs that’ll be generated for each given level. Feeding that total XP back into the XP formula gives me the average experience level you’ll reach at the end of each area by killing everything (pretty typical player behaviour!). I can then tweak each enemy’s XP reward and immediately see the effect it has on each Act’s XP curve.

Quite apart from letting me tune enemies so the XP curve under the new scaling matches the old one, this model also shows me where the XP curve was plain wrong. For example, the second half of Act 2 had the slowest XP scaling in the game. I’ve now fixed this, so in 1.04 you’ll probably hit Xiatol at level 8 instead of 7 (if you’re thorough).

WHAT DOES THIS ALL MEAN?

A few things come to mind:

  • Speed-running is going to come at a tougher XP penalty than before. I’ve run the numbers collecting only half the XP on each level and you fall behind by half a level more than you used to. That’s fine by me; the new items in 1.04 should make up for it. (Though Pugilist may struggle a bit, since they’re more dependent on XP and won’t be able to use the new weapons.)
  • Killing small enemies late in the game is going to be more worthwhile. Running away from overpowered enemies early on will hurt less.
  • The skills that charge on XP (Heal, Resurrect Pet, Form Wisp, Enslave) are going to be a bit more consistent, especially when you hit the highest XP levels at the end of each Act.
  • Using Paladin’s “Noncombatant” perk well will put you two XP levels ahead of par instead of one.

Despite how much work this is, the effects are (and should be) fairly subtle. It’ll fix some things that just felt wrong but otherwise the game should feel roughly the same to play. However, there is one big effect. Softer XP scaling will let me really mix up the enemies you encounter in 1.1’s Endless Mode without them having inappropriate XP rewards – so I’ll be able to make it much more varied 🙂

Pulling together all the data and building simulations like this is time consuming but makes it way easier to balance isolated systems, like experience gain and levelling up. Now the numbers look good in the spreadsheet, I’m going to go play for a few hours and make sure they feel right too. Until next time!