Category Archives: Paper Mario Series

The Trick Is To Not Get Hit – Evasion Badges in TTYD

So luck badges.  Years ago I tried doing research into the likelihood of Close Call, Pretty Lucky, and Lucky Day causing enemies to miss Mario in TTYD, taking thousands of samples for each, and summarized the badges’ effects among a bunch of others in my Badge Hunting + Stacking series.  Then after getting back into TTYD assembly reverse-engineering in the wake of the Palace Skip discovery last year (at that point having 2+ years actual software engineering experience), I found the exact rates of the badges, updated that post, and left it at that.

But for the 4 years since that initial post (and 5+ years since the initial statistical research), I took for granted that given evasion rates for each badge, it would be obvious how those ought to be combined into one evasion rate when stacked or combined.  Subsequent recent experience with a larger community of Paper Mario players has shown that not to be the case, so let’s do a deeper dive, shall we?

Brief note – all of the principles in this post could be applied to the evasion badges in the original Paper Mario as well, except the miss probabilities are a bit different (10/101 for Pretty Lucky, 20/101 for Lucky Day, and 30/101 for Close Call).  And there aren’t multiple copies of each to stack, obviously.

Calculating Evasion Rate (Independent vs. Disjoint Probability)

The crux of the issue comes down to badges’ evasion chances being independent of one another, and the fact that the math involved with that is un-intuitive compared to just adding disjoint probabilities together.

Illustrated here is a representation of what disjoint treatment of badges would look like, and the independent probabilities they actually have (assuming you have one Pretty Lucky, one Lucky Day, and one Close Call badge on in TTYD):luck-example

That’s a lot to take in, so let me elaborate in text form.

If badges represented disjoint probabilities of being missed, then you would just sum their evasion rates to get the total evasion rate; i.e. PL+LD+CC = 10 + 25 + 33% would be 68%, and the odds of getting hit would be 32%.

In actuality, though, evasion is calculated by multiplying the indepedent probabilities of the badge resulting in a hit; i.e. PL+LD+CC = 0.90 * 0.75 * 0.67 = 0.45225 = 45.225% chance of hit, or 54.775% chance of a miss.

This extends to multiple badges of the same type; i.e. each Pretty Lucky multiplies your chance of getting hit by 90%, every Lucky Day by 75%, and every Close Call by 67%; i.e. your total evasion rate is:

1 – (1 – 0.10)PL * (1 – 0.25)LD * (1 – 0.33)CC

But which of the evasion badges is the best?

(hint: it’s Close Call.)

So that settles the question of how badge evasion is calculated, but how do you compare the effectiveness of each of the three evasion badges, particularly Pretty Lucky and Lucky Day?  You cannot divide the rates by their BP cost to get an idea of “evasion per BP”, since that’d essentially be falling back on the incorrect disjoint-probability model.

Instead, since you already multiply the probabilities of badges together, you need to see what number needs to be multiplied by itself N times to produce the proper hit rate for an N-BP badge.  Thankfully, math has a helpful name for that concept, the radical / Nth root, but we can do one better and use logarithms to convert all the messy multiplication (for multiplying the effects from each of the types of badges), exponentiation (for getting the term for a number of a specific badge), and radicals (for getting the effect per BP) into much nicer addition, multiplication, and division respectively.

So, let’s take and compare the log base 0.5 of each of the badges’ hit probabilities, then (i.e. how many times you would have to multiply 0.5 by itself to get the hit rate).  The choice of 0.5 is admittedly arbitrary, but this way we can compare it to something meaningful; Repel Capes / Dodgy Fog (or enemy Dizziness) cause a 50% chance of evasion.

Badge Hit Rate log0.5(Hit Rate)
Pretty Lucky 0.90 0.152
Lucky Day 0.75 0.415
Close Call 0.67 0.578

This gives us some concrete insight into the badges’ real relative worth; Pretty Lucky is 15.2% of the effect of a Repel Cape, Lucky Day is 41.5%, and Close Call about 57.8%.  But we can do one better, and divide the log-transformed rates by the BP cost to compare the badges’ worth per BP.

Badge Hit Rate log0.5(Hit Rate) log0.5(Hit Rate) ÷ BP Cost
Pretty Lucky 0.90 0.152 0.076
Lucky Day 0.75 0.415 0.059
Close Call 0.67 0.578 0.578

Yikes, no contest now; Pretty Lucky is a good deal better than Lucky Day per BP (7.6% of a Repel Cape per BP vs. 5.9%), and Close Call destroys them both.

The Power of Math!

Rephrasing the effects of the badges this way means we have another way of representing overall evasion:

1 – (0.5)(0.152 * PL + 0.415 * LD + 0.578 * CC)

While not perhaps easier to calculate this way, it does make one fact perhaps more obvious; that being, there’s no way to get 100% evasion, as no matter how high the exponent gets, nothing will make 0.5N equal 0.

Except, technically that’s not actually true; since all RNG calls for badge evasion happen back-to-back, and Paper Mario: TTYD has a finite number of RNG states, technically it could be possible to wear enough badges that there’s no string of consecutive RNG states that do not result in at least one “miss”.

If using just Close Calls, this is actually possible to achieve at 52 badges; using the formula about 0.5(0.578 * 52) = 0.5(30.0) = about a 1/1,000,000,000 chance, but in fact no successive run of 52 out of the 4,294,967,294 RNG states produces all non-misses.  Not practical in purpose, as a “mere” 17 badges already results in a miss 999 out of 1,000 times, but interesting as a curiosity.

The Mega-Comparison Chart of Awesomeness

Rather than grab a calculator every time you want to get the exact evasion rate for an arbitrary combination of badges, here’s a helpful chart that compares the evasion rate for various combinations of 1-3 Pretty Luckys, 1 Lucky Day, and 1-3 Close Calls:

luck-badges-ttyd-full.png

You can extrapolate past the end of the chart by imagining more copies of the bars at the top added to the end, bearing in mind that adding another span of the marked length halves the hit rate.  (Of course, as a rule of thumb, if you’re bothering to badge hunt for more than 2 Close Calls, you’re probably going to get missed often enough (70%+) that you don’t really need to care about exactness.)

Hopefully this doesn’t end up being more confusing than the original blurb in the badges article, but I’ve said my piece at this point. Close Call master race!

Advertisements

’00s Mario RPGs’ Item Drops: Weights? Rates? Let me Elucidate…

Random enemy item drops have long been a focus of my Mario-RPG stat-gathering and what-not – there’s just something satisfying about getting extra items or missable equipment when it’s not guaranteed, and I always thought it’d be nice to know the odds.

Well, over time, I’ve gotten proficient enough in memory hacking and assembly to be able to interpret the routines and/or RNG calls responsible for item drops in the first three Mario & Luigi and Paper Mario games (since those are the ones that I’m the most experienced with, and whose systems have widely-accessible emulation), and the ways they represent the possible item drops in data form, and then use that data to determine what items to drop and when, vary wildly from game to game.  Hence, I’ll go into detail in how it works for each of these six games (links to the actual drop data will be at the end of the post).

Paper Mario (64)

This is the Mario RPG I’d been curious about drops for the longest, and somewhat ironically, it took me the longest of these six to find out anything concrete about how item drops are determined; these findings here are the first I’ve gathered on the matter.

Let’s take a look at Pleasant Path Koopa Troopas’ item drop list, since they’re one of the first to be able to drop multiple types of items:

Global Rate Item 1 Weight 1 Item 2 Weight 2
5 Mushroom 3 Koopa Leaf 7

This means that 5%* of battles against enemy sets led by a Koopa Troopa will drop an item, and of those items, Mushrooms and Koopa Leaves appear with frequency 3 and 7, respectively (30% and 70% of the time there is a drop, or 1.5% and 3.5% including the overall drop chance).

* Note: As alluded to in my Power Bounce article, Paper Mario 64’s RNG is weird in that it generates numbers from 0 to N inclusive (ergo, N+1 different values) when called with rand(N), meaning there are a lot of cases where there’s one extra value than intended. This is no exception, so the global drop rate is actually 5 out of 101, and though I haven’t checked, it’s possible that the weights between different items might get slightly messed up as well (probably giving the last item +1 weight, if so).

Also of note, both Paper Mario and Paper Mario: TTYD’s drop tables are assigned by encounter, not by enemy type, so it’s possible I missed a couple more battles where the drop tables are different the ones listed for the enemy type.

Paper Mario: The Thousand-Year Door

I’ve already gone over this at length in a previous article, but I might as well have it here too for completeness’s sake. While most enemies only have one or two possible drops in PM64 (aside from a few weird ones like Shy Guys that have up to five), a good number of enemies in TTYD have up to five items + three badges that can be dropped.

Here’s a sample drop table (take a guess what enemy’s, at this point):

Item Hold Weight Random-Drop Weight
None 200 300
Super Shroom 10 10
Maple Syrup 0 10
Thunder Bolt 10 10
Point Swap 0 15
Fright Mask 0 10
Happy Flower 0 2
Flower Saver 0 1
Flower Saver P 0 1

Notably, all enemies have the same “None” weights, normal items’ weights are either 5, 10, 15, or 20, and badges’ are 1 or 2.

The hold weights are used to determine whether an enemy will hold an item/badge in battle (or have Ms. Mowz steal an item/badge, if they are holding nothing).  For example, in this case, the enemy will hold a Super Shroom 10/(200+10+10) = 10/220 = 4.54% of the time.

For drops, there are three possible scenarios; the game will either try to drop a held item, a random drop item, or nothing.  The relative probabilities of these cases are as follows:

Held Drop Random Drop No Drop
Normal battle 1 1 2
Normal battle (N Item Hog badges equipped) 1+N 1+N 2
Pit of 100 Trials battle 1 1 3
Pit battle (N Item Hog badges equipped) 1+N 1+N 3

If the held drop case is selected, then one of the items the enemies were holding in battle is dropped at random (items used by enemies are considered, but not ones stolen by Ms. Mowz).  If no enemies were holding items, nothing will be dropped, unless Item Hog badges are equipped; then there is a 50% chance one of a set of items will be dropped:

item-hog-list

If the random drop case is selected, a random drop is selected from the front enemy’s random drop column, weighted accordingly.  For example, the chance of a Flower Saver being chosen is 1/(300+10+10+10+15+10+2+1+1) = 1/358.  Given there being such a high weight for no random item, in addition to having to have the random drop case selected in the first place (a 1/3 chance with an Item Hog, or 2/7 with an Item Hog in the Pit of 100 Trials), getting any random drop is pretty rare, especially badge drops.

Super Paper Mario

Compared to the wealth of complication in TTYD’s system, SPM’s is much more straightforward; essentially the same as the original Paper Mario’s.

Here’s the drop data for a normal Goomba:

Global Drop Rate 4%
Item Name Weight
Dried Shroom 100
Cake Mix 100
Big Egg 100
Honey Jar 100
Shroom Shake 200
Catch Card 50

Pretty straightforward.  Notably, poison-inducing enemies often have 100% global item drop rates (as might be pretty evident when playing the game).  Doesn’t mean you can’t get unlucky in a pinch and get a Catch Card, though.

Mario & Luigi: Superstar Saga

Unlike the Paper Mario series, M&L games have been pretty consistent about the pools of items enemies have to draw from from the very beginning – at most one standard drop, one rare drop, and every enemy in a battle can independently drop one of its items. Superstar Saga is a bit of an oddball in how it handles those two drops, though.

Here’s Bob-omb’s data, for an example:

Normal Item Weight Rare Item Weight
Nuts 6 Red Pepper 10

Uniquely to the series, only the “normal” item can drop under normal circumstances, and the chance of it dropping is just the normal item’s weight out of 31 (yes, 31; they only had five bits to spare, I guess).  So Bob-ombs drop Nuts about 19.3% of the time.

If you equip the Gameboy Horror SP accessory, then you always receive the Rare Item if the enemy has one, no matter what the weight is (even 0, which does happen; Troopeas in the US version have Super Nuts as a 0-weight Rare Drop).

Swing Bros. Advance is where it gets interesting; here, and only here, are both items treated as weighted item drops.  In Bob-ombs’ case, then, you’ll get Nuts 6/16 (37.5%) of the time, and Red Peppers 10/16 (62.5% of the time).  Note that Woo Beans cannot be stolen in this way, but their weight does contribute (so Tanoombas with their “Woo Bean, 20 / Green Pepper / 10” table only drop Green Peppers a third of the time, and nothing the other two-thirds), and there’s no way to get an item with a 0 weight.

Mario & Luigi: Partners in Time / Bowser’s Inside Story

Only recently did I discover how these rates are actually calculated, but it’s consistent between these two games (and possibly later games in the series as well, but I have no experience with their data).

Here’s Shroob Rex’s pair of items:

Normal Item Global Item Rate Rare Item Rare Item Rate
Mix Flower 15 100-Point Pants 15

Until recently I’d been interpreting these as each having a 15% chance, since nothing in Partners in Time had more than a 50 for either (although some enemies in Bowser’s Inside Story did, leading to confusion on my part about enemies whose “rates” summed to over 100, but no further research).

As it turns out, though, the numbers are misleadingly ordered in the data; it turns out this means that Shroob Rexes drop an item 15% of the time, and 15% of those items are 100-Point Pants (thus meaning 12.75% / 2.25% overall rates for the items, respectively).  Equipping the Treasure Badge skips the first check entirely when the enemy is defeated by a Bros. Item, meaning 85% of Rexes drop Mix Flowers, and 15% drop 100-Point Pants.

I don’t offhand know exactly how the Item Gloves work in BIS, but I imagine it might cap some enemies’ global drop rate so as not to get an item every attack from bosses (though notably, likely not Shroobs‘); might be worth looking into in the future.

Item Drop Data Resources:

Paper Mario (64)
Paper Mario: The Thousand-Year Door
Super Paper Mario (data reverse-engineered / extracted by aldelaro5)

Mario & Luigi: Superstar Saga
Mario & Luigi: Partners in Time
Mario & Luigi: Bowser’s Inside Story

That’s all for this post, stay tuned soon (hopefully) for an in-depth look at evasion badges in Paper Mario: TTYD.  In the meantime, join my Discord server if you have suggestions for other mechanics you’d like to see get a deeper dive, or just want to chat Paper Mario or what-have-you.

Power Bounce Caps: Not Quite Infinity+1

If like me, you were a casual fan of Paper Mario 64 back in the day, you might have wondered why you were able to get a ton of Power Bounces on enemies normally, but always crumbled under pressure when trying to use them against a boss. Well, this’ll probably come to no surprise if you’re into the speedrunning / TAS-ing scene now, but it turns out that in both Paper Mario 64 and TTYD, there are hard limits to how many times you can Power Bounce in a row, especially on bosses.  Let’s dive into how those are determined!

Also for completion, I’ll give the frame windows for how long you have to execute the Action Command each bounce, since they do get tighter on the later bounces.

Paper Mario 64

Though not that technically complex, the way the cap is determined in Paper Mario 64 is… well, rather indirect.  Where you end up getting capped also tends to have pretty heavy variance, with most of the caps being early on, but with an arbitrarily long tail.

Each enemy/boss has a single value that gets fed into the calculation, with a max of 100 (Goombas, Fuzzies, Shy Guy, et al.), and a minimum of 50 (Final Bowser, prior to the Twink battle), which I’ll call the Cap Multiplier, or Cap% for short.

A value in memory (I’ll call it the “bounce chance”, or BC) is set to 200 on the first bounce, and for every subsequent bounce, this value is multiplied by the Cap%, then divided by 100, and rounded down to the nearest integer. For example, if Cap% is 50, the BC will take on values of 200, 100, 50, 25, 12, 6, 3, 1, and then 0 for all subsequent jumps.  On each bounce, a random number from 0 to 100 (inclusive) is generated; if that number is higher than the current BC value, then no more jumps will be possible afterwards.

This will almost always be the limiting factor of a Power Bounce on anything with a Cap% < 100, since the timing windows are fairly lenient, giving you 7 frames at 30fps for the first bounce, and 1 frame fewer each subsequent bounce until it hits a minimum of 2 frames at 30fps (2/30 seconds) on the sixth bounce, totally reasonable compared to TTYD’s 3/60-second Superguards or SMRPG’s 2/60-second Super Jumps.

Curiously, not only does Dodge Master increase the timing windows for later bounces to a downright ridiculously forgiving minimum (5 frames, or 1/6 of a second; as generous as TTYD’s jump / normal guard commands with THREE Simplifier badges), it also makes your Power Bounces get capped later!  The badge adds 7 to the enemy’s Cap%, making the values take longer to get small. For instance, a 50-Cap% enemy’s BC goes from the above values to 200, 114, 64, 36, 20, 11, 6, 3, 1, 0.

What do all these values mean practically though? Well, here’s a chart of the chance of getting capped upon reaching each of the first 10 bounces (“Cap Likelihood”), as well as the number of expected attempts to get to that number of bounces (“Expected Attempts”), for an enemy with a Cap% of 70 (typical for chapter bosses; only Hallway / Final Bowsers have worse), with and without Dodge Master.

Jump # 1 2 3 4 5 6 7 8 9 10
w/o Dodge Master BC 200 140 98 68 47 32 22 15 10 7
Cap Likelihood 0% 0% 2.0% 31.7% 52.5% 67.3% 77.2% 84.2% 89.1% 92.1%
Expected Attempts 1 1 1 1.4 3.1 9.6 42.2 267 2447 30,903
Timing 7/30s 6/30s 5/30s 4/30s 3/30s 2/30s 2/30s 2/30s 2/30s 2/30s
With Dodge Master BC 200 154 118 90 69 53 40 30 23 17
Cap Likelihood 0% 0% 0% 9.9% 30.7% 46.5% 59.4% 69.3% 76.2% 82.2%
Expected Attempts 1 1 1 1.1 1.6 2.9 7.3 24 101 568
Timing 7/30s 7/30s 7/30s 7/30s 6/30s 5/30s 5/30s 5/30s 5/30s 5/30s

Interestingly, given that the bounces are only capped if the generated number is higher than the current BC, but not if it’s equal, it is technically possible to get arbitrarily many bounces (up to the global cap of 101) even for the worst Cap%, so long as the random number generated is always 0.  For example, getting a 13-cap without Dodge Master on Tutankoopa (or another 70-Cap% boss) is a 1/1,000,000,000 chance.  And yet, it’s possible. (Lua scripting FTW!)

Here’s a spreadsheet of the Cap Multipliers and “Expected Attempts” for the first 30 bounces for every enemy / boss in the game.

EDIT (2017-11-16): As a side note, wearing Dodge Master does not change the cap multiplier or frame window for Goombario’s Multibonk move.  Otherwise, the logic for it is exactly the same as Power Bounce.

Paper Mario: TTYD

Compared to Paper Mario 64, TTYD’s approach is remarkably simple. Each enemy/boss has a “soft cap” N. For the first N-1 jumps, you can’t get capped. For the next N (bounces N through 2N-1) you have a 67% chance of getting capped each bounce (bounces N through 2N-1), and you will be forcibly capped on bounce 2N.  Practically all enemies have a soft cap of 9,999 (e.g. effectively infinite), and bosses’ soft caps range from 5-9, much better than Paper Mario 64’s potential (and on Bowser, likely) 3-caps.

Unlike PM64, Simplifier and Unsimplifier badges do not change the cap counts or likelihood of being capped; however, that does lead to the disadvantage of TTYD’s Power Bounce – no matter how which badges you’re wearing, eventually the timing window on the bounce gets down to a single frame at 60fps, which is basically impossible to keep up for more than a few bounces.

Here’s a table of the timing windows for any number of Simplifiers / Unsimplifiers, in 1/60-second frames:

Bounces 1 2 3 4 5 6 7 8 9 10 11+
3 Unsimplifiers 5 4 3 2 1 1 1 1 1 1 1
2 Unsimplifiers 6 5 4 3 2 1 1 1 1 1 1
1 Unsimplifier 7 6 5 4 3 2 1 1 1 1 1
Normal 8 7 6 5 4 3 2 1 1 1 1
1 Simplifier 9 8 7 6 5 4 3 2 1 1 1
2 Simplifiers 10 9 8 7 6 5 4 4 3 2 1
3 Simplifiers 10 10 10 10 10 9 8 7 6 5 1

You can find the soft-caps for each enemy in my recently-updated PM2 Stat Guide (listed as “PB Cap”).

That pretty much covers this little-known / understood balance feature! Really, I don’t think TTYD’s cap is accomplishing all that much when you’re forced to perform frame-perfect jumps from the eighth bounce onward, but ehh…