[CM] 2C5 EXP bug in Area 29

Matt

Administrator
Staff member
Most of the time when killing enemies in Area 29 of 2C5, you will receive EXP of the wrong enemy.

Example:

http://puu.sh/jF5i5/e6662eb9d4.jpg (1779pt tnl before killing a Gibbles)
http://puu.sh/jF5mk/01425dc729.jpg (displayed EXP gained, 2028 pt, this is what you are supposed to receive)
http://puu.sh/jF5pp/bdbe2aad54.jpg (1311pt tnl after killing the Gibbles. This is an EXP gain of 468pt, which is the amount a Recobox gives)

Another Example:

http://puu.sh/jF5Mn/747b56f4c0.jpg (6142pt tnl before killing a Gi Gue)
http://puu.sh/jF5PC/239888f752.jpg (displayed EXP gained, 1989 pt, this is what you are supposed to receive)
http://puu.sh/jF5V1/c9e13806d2.jpg (4309pt tnl after killing the Gi Gue. This is an EXP gain of 1833pt, which is the amount a Mericarol gives)
 

Sodaboy

Administrator
Staff member
Shit, the more you learn about PSO, I swear.

So, apparently, digging into the quest files, I see there's supposed to be experience multiplication going on for Episode II Challenge mode. (HAD NO IDEA IT DID THAT.)

2c1 multiplies by what looks like 1.5ish
2c2 multiplies by 4.5ish,
2c3 multiplies by 3ish,,
2c4 multiplies it by 12ish
2c5 multiplies it by 31ish

The ish is some sort of fractional combined with other logic... Still haven't quite figured it out exactly.
 

Sodaboy

Administrator
Staff member
Alright, I'm going to update the server in a bit, I don't know exactly how Episode 2 does the calculation of the EXP in Challenge mode, but I got very close They're using a fractional plus some other logic. Maybe when Tofu gets back from his office, we can both try to figure it out.

I'm going to update the ship, though, in about an hour and 10 minutes with the changes. This plus the weapon drop fixes (which are correct now), should make it very playable. (If all else fails, it's lookup table time. :x)

Thanks for your reports.
 

Aleron Ives

Member
Yes, Challenge mode has built-in experience modifiers in every quest. In DC Stage1, it works like so:

leti R0, 00000001
leti R1, 00000032
leti R2, 00000064

The first number is the multiplier in front of the decimal point (1.x). The second two numbers are the fraction after the decimal point (50 / 100 = x.5), so the full multiplier for Stage1 is 1.5.

Floating-point calculations are not possible, so values after the decimal point are dropped and not rounded. This explains the following EXP values in Stage1:

Booma: 7 (5 * 1.5 = 7.5 -> 7 after dropping the .5)
Gobooma: 9 (6 * 1.5 = 9)
Mothmant: 1 (1 * 1.5 = 1.5 -> 1 after dropping the .5)

It appears that Episode II's Stage1 uses the same formula.
 

Sodaboy

Administrator
Staff member
Thank you. I love you so much right now, I could kiss you. :-*

BUT!! Still, it doesn't add up.

Rappy is 4 exp normally online, 4 * 1.5, which gives us 6, yet it gives 7 exp...?

Dimenian is 7 exp normally, but gives 11 exp.
 

Sodaboy

Administrator
Staff member
Yeah, it's not quite that simple it looks like.

Example: 2c5, which shows exp_calculation registers as 1D, 01, and 01, so decimal would be 29, fractional 1/1, which would make the total 30x exp. HOWEVER, Recobox is 15 exp, and killing it in 2c5 gives 468 exp. Which is a total of 31 exp. HOWEVER... And if you kill Gibbles, he gives 2028 exp, which doesn't follow the same calculation.
 

Aleron Ives

Member
Rag Rappy gives 6 EXP in Stage1 on DC, and the formula holds up for Stage9, too:

leti R0, 00000002
leti R1, 00000019
leti R2, 00000064

The multiplier in Stage9 is 2.25, and Dimenian normally gives 22 EXP. In Stage9, it gives 22 * 2.25 = 49.5 -> 49 EXP. (I'm pretty sure this is correct, but I can't find a Stage9 video to confirm it, as I haven't played Challenge in quite a while.)

As for Episode II, remember that BB greatly boosted the EXP for Episode II enemies (one of people's biggest complaints about GC), so if you use the formula in the quest with BB experience values, you're going to get more EXP than you would when playing on GC. I have no idea if Sega simply allowed you to level faster on Episode II Challenge in BB or if they hard-coded values somewhere to prevent the BB Episode II experience boost from making Challenge mode easier. I have never played Episode II Challenge, so I have no idea how things might have changed between GC and BB and what the correct EXP values should be for either version.

It is worth noting that the third value is always 100 for Episode I, so it's possible that my formula is a shortcut for when that's the case, but that it fails when the final value isn't 100. Also note that GC added support for floating point calculations, so it's possible that decimals are no longer dropped in Episode II Challenge (which would explain 7 becoming 11 and not 10 when you round 10.5 instead of truncating it).
 

Sodaboy

Administrator
Staff member
Must be something still more to it than that, oh well, yeah didn't realize Episode 1 does this too. Have to add all of this to the server.
 

Matt

Administrator
Staff member
Gave this a test, seems fixed. Gives a few points off (eg: Recobox is giving 450 EXP instead of 468 EXP, Mericarol is giving 1830 EXP instead of 1833 EXP), but I'm pretty sure nobody is going to care about a few points of EXP lost. Made Area 29 much more normal to play.
 

Sodaboy

Administrator
Staff member
Word up, yeah I added the exp calculations found in the QST files to the server. I don't know why it's a few points off, but eh, it is what it is. Still a million times better than it was before.
 

Aleron Ives

Member
You're just using the method I posted, then? I can't explain why Episode II is off, either. I might be able to figure it out with a complete list of the EXP each enemy is supposed to give, but testing this kind of thing is difficult, as a lot of the Challenge mode opcodes don't work in a regular team (and you can't load a Challenge quest by yourself, since the Guild tells you to GTFO). I haven't tested to see if exp_muli is one of the restricted commands, though.
 

Sodaboy

Administrator
Staff member
Aleron Ives said:
You're just using the method I posted, then?

Yeah, basically. We read the values from the quest file and I apply them to the experience as is. XP = XP * (Decimal Frac1/Frac2)

It's extremely close to the experience it's supposed to give, but the value for some enemies is off by a few points sometimes. Like the example above, 1830 instead of 1833.
 

Aleron Ives

Member
So the BB client is displaying 1833 on the screen, but you're giving 1830 from the server (using the formula)? It's quite strange that the client would be off by such a small amount...
 

Sodaboy

Administrator
Staff member
We figured it out today, Aleron. :) It'll be fixed on Sunday. It was a loss of floating point precision.
 

Aleron Ives

Member
Oh? How does floating point arithmetic come into play when the values are integers and the fractional part is 1/1 on the Episode II stages? :eek: Did you figure out a better formula?
 

Sodaboy

Administrator
Staff member
Your formula was correct, the problem was I lost the decimal places by the way my server program loaded the Episode 2 battle parameter file.

Previously, when the ship server started, it would load the parameter file and multiply all of the Episode 2 values by 130 then divide by 100, to get the experience to give in Episode 2. (Blue Burst gives an extra 30% when playing Episode 2 games, don't ask me why, it's just coded that way in the client.)

When Challenge Mode happened, the previously multiplied and divided value was used to calculate the final experience. This is a problem because now we have a loss of floating point precision.

Let me give you an example.

Dubchic in 2c2 challenge is normally a 2 exp monster. Giving the Episode 2 boost of 30% using my integer code above, 2 * 130 / 100 = 2.6 but the decimal is shaved off and the preboosted integer stored for later use. So it still ends up being 2.

The boost for 2c2 is 4.5x on top of the normal 30% boost... So, my previous way, of storing the 30% ahead of time as an integer, 2 * 4.5 ends up being 9 exp given by the Dubchic. THIS IS WRONG, IT'S SUPPOSED TO BE 11 EXP.

So, I now no longer take the short cut of storing the pre-boosted exp and do the whole calculation, including the 30% Episode 2 boost, whenever a monster is killed.

So it ends up being XP = (unsigned)floor((double)monsterxp * 1.3 * Challenge_Boost

In this same example, 2 * 1.3 * 4.5 = 11.7, using C's floor function makes the value 11 and we're done.

Using my messed up method before, for example, with Mericarol, it's exp value in the BP table is 47 exp... I used to save the preboosted 30% value before as 47 * 130 / 100 = 61 exp. The boost amount in 2c5 is 30... before that would result in a final exp of 1830.

There was never an issue before because floating point math wasn't used for exp until we got around to challenge mode... but now I can't store pre boosted integer exps anymore...

Doing it as a float and flooring it ends up with 47 * 1.3 * 30, which equals 1833. The exact number I need.
 

Aleron Ives

Member
Hahaha! That's awesome and explains a lot. Thanks. I had always assumed Sega modified the BattleParam for Episode II on BB, but it figures that they wouldn't even bother and would just hard code the client (one of Sega's favourite things to do!) to give a fixed 30% boot on top of the original values, thus saving them the trouble of modifying the BattleParam. XD

Sodaboy said:
Previously, when the ship server started, it would load the parameter file and multiply all of the Episode 2 values by 130 then divide by 100, to get the experience to give in Episode 2. (Blue Burst gives an extra 30% when playing Episode 2 games, don't ask me why, it's just coded that way in the client.)
Sega did it because the default Episode II experience sucks. Episode II has far fewer enemies per room than Episode I, and the enemies are all far more difficult than those in Episode I, yet Episode II enemies only give maybe 10-20 EXP more than Episode I enemies in Ultimate. As a result, Episode II is terrible for leveling compared to Episode I, as it gives a greater challenge for a lesser reward. Everybody complained about this on GC, so Sega boosted the Episode II experience on BB. They were just too lazy to alter the BattleParam file for every enemy on every difficulty. Ha! Classic Segac. :p

*edit*

For the record, I tested exp_muli in a regular team and got no results, so it's apparently restricted to Challenge, as I expected. :(
 
Top