09-13-2003, 10:51 AM
(This post was last modified: 09-16-2003, 04:05 AM by Crystalion.)
Edit: some important corrections and addenda to this post are in my reply to it (see follow up post)--if you just want the simplified summary for non-math geeks then please scroll down to my final post on this topic.
In the AB thread Experience points for mercsI noticed something odd and Ruvanal gave me a pointer to an old complex code thread on the subject at Phrozenkeep. As I suggested I would, I have indeed done a little investigation (without v1.10s code reading) and run some numbers so I'll share the tentative findings here, in case anyone wants to double check it or flesh it out...
First, some "known" basics:
Hirelings and minions don't reduce your xp (or give you a bonus)--you and party members get the full xp for their kills just as if you'd killed the monster yourself (the gold find and magic find issues are more complicated, but these are not my focus here).
A hireling shares experience from you and your minions' kills (I haven't tested to see if they get xp any time that you would, e.g. from a party kill). If the hireling doesn't do the kill him/herself then their xp share gets chopped in third.
I rather imagine the code just takes the info for the xp it wants to give you and also calls (other party members) and hirelings, so that kills are just one uniform happy family, but I've not tested or read for this.
Hirelings ?do/don't? get the +50% xp bonus from shrines (I didn't test this, but I'm sure it is "known" and I will edit it in here later if I get the chance to test it or someone else reliably reports it).
Hirelings are on a different xp scale than players for leveling up. I suspect this also means they do not suffer the 70+ xp nerf players suffer (as that is data driven with the players xp scale, in experience.txt)
Hirelings will not gain any xp unless they are below their player (owner's) level.
Hirelings don't gain xp when they are dead. You don't gain xp when you're dead either--last I checked though, you do get xp for monsters that die by your hand--e.g. ow/poison--when you're in town. Certainly you gain xp in town when your hireling is just outside of town, slaughtering things for you (the monsters will ignore him/her, so really the only way your hireling can get hurt is if they have indiscriminate damage output, such as lightning emission).
Hirelings have an exp scaling factor, aka penalty, based on their type and difficulty they were hired in. A current look at hireling.txt shows a normal base of 100 to a nasty penalty level (40% more xp needed per level) of 140 for some hires from hell.
Hirelings suffer the mlvl of kill vs. level (theirs) xp penalties. (the within 5 levels, unless you're 25+ stuff).
Hirelings have a 1/64th of a level-up xp cap per kill...
This is the one that caught my interest, as xp calculation order of application and actual numbers involved in kill xp vs. 1/64 of a level up could make a difference and might help to explain why, in practice, leveling up lowbie hirelings is such a pain.
So I read the PK thread and did some tests with level 1, 2 and 3 hirelings from act 2 in the blood moor (by no means a complete set of tests for all the "open" questions). Hammerman's stated formula for the Hireling xp scale didn't jibe, but it was close, so I don't know if it was changed or he just mis-read the code (remember I'm trying to avoid getting into code reading myself these days). I also uncovered evidence that the cap is applied in an unfavorable order, to wit, before the 1/3rd penalty (for non-hireling kills). Additionally, though I didn't spreadsheet it out, or look for a site that does (with the correct formula) I spot checked some points to see when the hireling xp scale is better or worse than the players. Here are some of the numbers...
Hireling xp needed to be a particular level is:
L == level
P == percent penalty (really a scale factor, baseline 100, but useful to think of as a penalty)
XP(L) = L**2 * (L+1) * P
as a practical matter, if you hire a level 1 act 2 normal merc with a Penalty factor of 110 this means they come with:
XP = 1**2 * (1+1) * 110 = 1 * 2 * 110 = 220 experience points.
and, of course, they will show their next level needed xp as:
XP = 2**2 * (2+1) * 110 = 4 * 3 * 110 = 1320 experience points.
If you wish to just derive the equation for the delta in experience to get to a "next level" from L, it is:
D = (3 * L**2 + 5 * L + 2) * P
and for the L = 1 case we'd compute:
D = (3 * 1 + 5 * 1 + 2) * 110 = 1100 (which is, naturally, 1320 - 220).
(there are many different notational conventions for typing equations--please feel free to recast mine to suit you).
Looking at experience.txt quickly I see the same numbers I see on Arreat, so let's look at a few of those numbers and then generate the hireling numbers for comparision...
02: 0,000,000,500
10: 0,000,057,715
20: 0,000,537,513
30: 0,004,663,553
40: 0,017,270,791
50: 0,047,116,709
60: 0,117,772,849
70: 0,285,041,630
80: 0,681,027,665
90: 1,618,470,619
Hireling with baseline 100 (Fire Arrow act I normal Rogue):
02: 0,000,001,200
10: 0,000,110,000
20: 0,000,840,000
30: 0,002,790,000
40: 0,006,560,000
50: 0,012,750,000
60: 0,021,960,000
70: 0,034,790,000
80: 0,061,840,000
90: 0,073,710,000
and, of course (assuming my punching up numbers didn't goof) you can just treat P factors as percentage penalties to that table (from 1.0x to 1.4x) for the other hirelings (see hireling.txt the "Exp/Lvl" column).
What you can easily see here is that somewhere between level 20 and 30 the Hireling baseline (100) is easier on level ups than that for players. This is also approximately when the hirelings stop suffering the pre-25 xp nerf for non-level appropo kills (above level). Someone reading this is no doubt soon to be preparing a calculator so you can see the crossover point for the various act/type/diff hires at which Hirelings start to have an easier time of it than you do.
But the additional factor is to ask my original question: are the hirelings getting clipped on xp by the 1/64th of a level cap (per kill limit, so that conceptually the hireling must always get 64 kills between level-ups at a minimum). And, indeed, the answer is yes, since my very first test, the act 2 hire with P==110 in the example above, was getting only 17 xp when he killed a fallen whereas I was getting the full 18 xp. Worse still, when I killed one, he only got 5! (This is my evidence for the 1/3rd non-hireling kill penalty being in an unfavorable calculation order).
To see why he'd only get 17 xp, lets run the numbers for the cap (the 5 is easy, it's 17/3 truncated)...
As we calculated, he needs to go from 220 to 1320 to go from his starting level of 1 to level 2 (I was a rushee, so grabbing an act 2 hireling was convenient, whereas I do not have the right to hire one in act 1!) which is, as noted, a difference of 1100. Now we calculate 1100/64 and truncate, getting--surprise!--17.
So, hypothetically, let's imagine we've gotten our hireling to level 26 (post xp nerf) and we kill normal Mephisto for (apparently, according to D2data) a level 26 kill worth 10,718 xp. Since we are impatient and haven't properly twinked our hireling anyway, we do the kill ourselves, patting ourself on the back that the hireling even survived to share in the xp credit.
If we are using an act 1 fire Rogue, the xp needed to level from 26 (to 27) is:
D = (3 * L**2 + 5 * L + 2) * P
D = (3 * 26**2 + 5 * 26 + 2) * 100
D = (3 * 676 + 130 + 2) * 100
D = 216,000
so the cap is 216,000/64 = 3375 per kill.
As 10,718 is greater than that, we cap. As the hireling didn't do the kill, we divide by 3. Thus the Hireling only gets 1125.
Wow! Even after we get the hireling past 25, this sucks. Note that the "penalized" hirelings, taking greater xp between levels, will have a higher cap, and thus aren't penalized at all, relatively speaking, when the cap is being bumped into.
But wait, everyone knows that at high levels hirelings level up like popcorn, a short while after you do. Does all this silly math potentially fit with that? Let's see...
Hypothetically what we've seen is that the cap is evil and the hireling not getting the kills is evil, such that you're going to take a minimum of 192 kills (if you are doing the work) per hireling level up (and, do to the nature of these penalties, I have to wonder if the calc order for the other bonuses, like xp shrines, players X and party, don't get horked by the cap as well--good thing to test for, eh?). This could be even worse, if you are fighting sufficiently far enough away from the hirelings level that the other nerf dilution takes you below the cap (or, heavens! the calculation order could be really really evil, and apply all bonuses pre-cap and all penalties post-cap--again, something to test for).
What this suggests is that we want to find a point where the monster xp/kill is only going to take 64 to 192 kills to level up the hireling but where that xp seems like a drop in the bucket to us, on our xp bar. So whats its look like for hell difficulty Prowling Dead? (assuming, like a Holy Bolt synergy build, that these are easy and convenient to slaughter 64 to 192 of)
D2data says these are level 83 and worth 50,900 xp. At level 83 for an act 1 fire rogue the cap is 1/64th of:
D = (3 * L**2 + 5 * L + 2) * P
D = (3 * 83**2 + 5 * 83 + 2) * 100
D = 2,108.400 and so
cap = 32,943 (truncated).
So even now, we are still capped. That's good though, because it does explain that after we (do the work) of killing 192 of these guys (well, less than that, but over and over as they return from the dead) we will get 192*50,900 xp, or 9,772,800 xp, diluted down to ~35% (if we're level appropriate) for around 3 million xp, which is on the order of 1/20th of a level up for us, while our hireling levels up (catching up to us).
This is indeed what I've seen myself, and others have reported.
So the key remaining question is order of calculation for other bonuses and penalties that apply to the hireling.
This order either opens the door or shuts it on opportunities to level the hireling faster without either super fast kills or letting the hireling do the kills (but rapidly).
I think it is clear the Holy Freeze Mercs, now that their aura does damage, are going to be levelable faster by a Static Sorc than some other catch-up combinations. Certainly any twink that increases hireling kill credits and speed will potentially prove useful, unless you're a god at continuous rapid mass kills (of hireling level appropriate monsters--if indeed the cap is applied *before* that penalty). Giving Rogue hirelings a Ravenclaw or Kuko and enchanting them has got to help. Feeding a hireling healing potions while thorns aura is up seems like another potential winner.
Gotta run. Hope some of this proves helpful.
In the AB thread Experience points for mercsI noticed something odd and Ruvanal gave me a pointer to an old complex code thread on the subject at Phrozenkeep. As I suggested I would, I have indeed done a little investigation (without v1.10s code reading) and run some numbers so I'll share the tentative findings here, in case anyone wants to double check it or flesh it out...
First, some "known" basics:
Hirelings and minions don't reduce your xp (or give you a bonus)--you and party members get the full xp for their kills just as if you'd killed the monster yourself (the gold find and magic find issues are more complicated, but these are not my focus here).
A hireling shares experience from you and your minions' kills (I haven't tested to see if they get xp any time that you would, e.g. from a party kill). If the hireling doesn't do the kill him/herself then their xp share gets chopped in third.
I rather imagine the code just takes the info for the xp it wants to give you and also calls (other party members) and hirelings, so that kills are just one uniform happy family, but I've not tested or read for this.
Hirelings ?do/don't? get the +50% xp bonus from shrines (I didn't test this, but I'm sure it is "known" and I will edit it in here later if I get the chance to test it or someone else reliably reports it).
Hirelings are on a different xp scale than players for leveling up. I suspect this also means they do not suffer the 70+ xp nerf players suffer (as that is data driven with the players xp scale, in experience.txt)
Hirelings will not gain any xp unless they are below their player (owner's) level.
Hirelings don't gain xp when they are dead. You don't gain xp when you're dead either--last I checked though, you do get xp for monsters that die by your hand--e.g. ow/poison--when you're in town. Certainly you gain xp in town when your hireling is just outside of town, slaughtering things for you (the monsters will ignore him/her, so really the only way your hireling can get hurt is if they have indiscriminate damage output, such as lightning emission).
Hirelings have an exp scaling factor, aka penalty, based on their type and difficulty they were hired in. A current look at hireling.txt shows a normal base of 100 to a nasty penalty level (40% more xp needed per level) of 140 for some hires from hell.
Hirelings suffer the mlvl of kill vs. level (theirs) xp penalties. (the within 5 levels, unless you're 25+ stuff).
Hirelings have a 1/64th of a level-up xp cap per kill...
This is the one that caught my interest, as xp calculation order of application and actual numbers involved in kill xp vs. 1/64 of a level up could make a difference and might help to explain why, in practice, leveling up lowbie hirelings is such a pain.
So I read the PK thread and did some tests with level 1, 2 and 3 hirelings from act 2 in the blood moor (by no means a complete set of tests for all the "open" questions). Hammerman's stated formula for the Hireling xp scale didn't jibe, but it was close, so I don't know if it was changed or he just mis-read the code (remember I'm trying to avoid getting into code reading myself these days). I also uncovered evidence that the cap is applied in an unfavorable order, to wit, before the 1/3rd penalty (for non-hireling kills). Additionally, though I didn't spreadsheet it out, or look for a site that does (with the correct formula) I spot checked some points to see when the hireling xp scale is better or worse than the players. Here are some of the numbers...
Hireling xp needed to be a particular level is:
L == level
P == percent penalty (really a scale factor, baseline 100, but useful to think of as a penalty)
XP(L) = L**2 * (L+1) * P
as a practical matter, if you hire a level 1 act 2 normal merc with a Penalty factor of 110 this means they come with:
XP = 1**2 * (1+1) * 110 = 1 * 2 * 110 = 220 experience points.
and, of course, they will show their next level needed xp as:
XP = 2**2 * (2+1) * 110 = 4 * 3 * 110 = 1320 experience points.
If you wish to just derive the equation for the delta in experience to get to a "next level" from L, it is:
D = (3 * L**2 + 5 * L + 2) * P
and for the L = 1 case we'd compute:
D = (3 * 1 + 5 * 1 + 2) * 110 = 1100 (which is, naturally, 1320 - 220).
(there are many different notational conventions for typing equations--please feel free to recast mine to suit you).
Looking at experience.txt quickly I see the same numbers I see on Arreat, so let's look at a few of those numbers and then generate the hireling numbers for comparision...
02: 0,000,000,500
10: 0,000,057,715
20: 0,000,537,513
30: 0,004,663,553
40: 0,017,270,791
50: 0,047,116,709
60: 0,117,772,849
70: 0,285,041,630
80: 0,681,027,665
90: 1,618,470,619
Hireling with baseline 100 (Fire Arrow act I normal Rogue):
02: 0,000,001,200
10: 0,000,110,000
20: 0,000,840,000
30: 0,002,790,000
40: 0,006,560,000
50: 0,012,750,000
60: 0,021,960,000
70: 0,034,790,000
80: 0,061,840,000
90: 0,073,710,000
and, of course (assuming my punching up numbers didn't goof) you can just treat P factors as percentage penalties to that table (from 1.0x to 1.4x) for the other hirelings (see hireling.txt the "Exp/Lvl" column).
What you can easily see here is that somewhere between level 20 and 30 the Hireling baseline (100) is easier on level ups than that for players. This is also approximately when the hirelings stop suffering the pre-25 xp nerf for non-level appropo kills (above level). Someone reading this is no doubt soon to be preparing a calculator so you can see the crossover point for the various act/type/diff hires at which Hirelings start to have an easier time of it than you do.
But the additional factor is to ask my original question: are the hirelings getting clipped on xp by the 1/64th of a level cap (per kill limit, so that conceptually the hireling must always get 64 kills between level-ups at a minimum). And, indeed, the answer is yes, since my very first test, the act 2 hire with P==110 in the example above, was getting only 17 xp when he killed a fallen whereas I was getting the full 18 xp. Worse still, when I killed one, he only got 5! (This is my evidence for the 1/3rd non-hireling kill penalty being in an unfavorable calculation order).
To see why he'd only get 17 xp, lets run the numbers for the cap (the 5 is easy, it's 17/3 truncated)...
As we calculated, he needs to go from 220 to 1320 to go from his starting level of 1 to level 2 (I was a rushee, so grabbing an act 2 hireling was convenient, whereas I do not have the right to hire one in act 1!) which is, as noted, a difference of 1100. Now we calculate 1100/64 and truncate, getting--surprise!--17.
So, hypothetically, let's imagine we've gotten our hireling to level 26 (post xp nerf) and we kill normal Mephisto for (apparently, according to D2data) a level 26 kill worth 10,718 xp. Since we are impatient and haven't properly twinked our hireling anyway, we do the kill ourselves, patting ourself on the back that the hireling even survived to share in the xp credit.
If we are using an act 1 fire Rogue, the xp needed to level from 26 (to 27) is:
D = (3 * L**2 + 5 * L + 2) * P
D = (3 * 26**2 + 5 * 26 + 2) * 100
D = (3 * 676 + 130 + 2) * 100
D = 216,000
so the cap is 216,000/64 = 3375 per kill.
As 10,718 is greater than that, we cap. As the hireling didn't do the kill, we divide by 3. Thus the Hireling only gets 1125.
Wow! Even after we get the hireling past 25, this sucks. Note that the "penalized" hirelings, taking greater xp between levels, will have a higher cap, and thus aren't penalized at all, relatively speaking, when the cap is being bumped into.
But wait, everyone knows that at high levels hirelings level up like popcorn, a short while after you do. Does all this silly math potentially fit with that? Let's see...
Hypothetically what we've seen is that the cap is evil and the hireling not getting the kills is evil, such that you're going to take a minimum of 192 kills (if you are doing the work) per hireling level up (and, do to the nature of these penalties, I have to wonder if the calc order for the other bonuses, like xp shrines, players X and party, don't get horked by the cap as well--good thing to test for, eh?). This could be even worse, if you are fighting sufficiently far enough away from the hirelings level that the other nerf dilution takes you below the cap (or, heavens! the calculation order could be really really evil, and apply all bonuses pre-cap and all penalties post-cap--again, something to test for).
What this suggests is that we want to find a point where the monster xp/kill is only going to take 64 to 192 kills to level up the hireling but where that xp seems like a drop in the bucket to us, on our xp bar. So whats its look like for hell difficulty Prowling Dead? (assuming, like a Holy Bolt synergy build, that these are easy and convenient to slaughter 64 to 192 of)
D2data says these are level 83 and worth 50,900 xp. At level 83 for an act 1 fire rogue the cap is 1/64th of:
D = (3 * L**2 + 5 * L + 2) * P
D = (3 * 83**2 + 5 * 83 + 2) * 100
D = 2,108.400 and so
cap = 32,943 (truncated).
So even now, we are still capped. That's good though, because it does explain that after we (do the work) of killing 192 of these guys (well, less than that, but over and over as they return from the dead) we will get 192*50,900 xp, or 9,772,800 xp, diluted down to ~35% (if we're level appropriate) for around 3 million xp, which is on the order of 1/20th of a level up for us, while our hireling levels up (catching up to us).
This is indeed what I've seen myself, and others have reported.
So the key remaining question is order of calculation for other bonuses and penalties that apply to the hireling.
This order either opens the door or shuts it on opportunities to level the hireling faster without either super fast kills or letting the hireling do the kills (but rapidly).
I think it is clear the Holy Freeze Mercs, now that their aura does damage, are going to be levelable faster by a Static Sorc than some other catch-up combinations. Certainly any twink that increases hireling kill credits and speed will potentially prove useful, unless you're a god at continuous rapid mass kills (of hireling level appropriate monsters--if indeed the cap is applied *before* that penalty). Giving Rogue hirelings a Ravenclaw or Kuko and enchanting them has got to help. Feeding a hireling healing potions while thorns aura is up seems like another potential winner.
Gotta run. Hope some of this proves helpful.