2013/03/11

Corner Clipping Blocks


If Mario goes towards the corner of a solid block, he can clip it partially or totally, depending on how he gets there. It requires much precision, so doing it without tool-assistence is nearly impossible. The technique depends on many factors, such: Mario's X and Y positions relatively to the block, X and Y speeds, Mario's status (small or ducking versus big) and whether his is mounted on Yoshi.

Small Mario
When Mario is small (or ducking, because both have the exact same hitboxes) and without Yoshi his chances of corner clipping a block are the worst. First off, it's impossible to do it to the right, because the block is programmed to push him to the left when he is inside it.

Big Mario
When Mario is big and without Yoshi he can corner clip exactly like when he's small, except that he won't be pushed to left in a certain Y interval inside the block. Thus, he can get only partially inside the block by falling faster or even clip it totally if he uses a cape to slowdow.

Tutorial (to the left)
1) Find the first horizontal position in which Mario won't touch the top of the block. In this example, he stands at X = 3578.F but would fall at X = 3579.0. So the X position of entrance must be 3579.0 or more.


2) In order to corner clip, he must skip from a X position of entrance to X - 3 pixels. That means: Mario must skip from X1 ≥  3579.0 to X2 ≤ 3575.F in one frame.

Therefore X1 - X2 ≥ 3579.0 - 3575.F.

Converting pixels to subpixels, we get: 3579.0 -  3575.F = (3579 * 16 + 0) - (3575 * 16 + 15) , because 1 pixel = 16 subpixels and F is the 15th subpixel.

So, X1 - X2 ≥ (3579 - 3575) * 16 - 15 = 4 * 16 - 15 = 64 - 15 = 49.

This implies that one needs a horizontal speed of at least 49 in order to corner clip. For this speed, there's only one position of entrance: 3579.0.



3) The Y speeds and positions for the entrance is pretty liberal most of the time. One must just avoid the lateral walls (blue) and the top of the block (green).

Aproximate behavior of a block, taken from this post (in portuguese).

In the first picture we see that the top of the block makes Mario has Ytop = 256. Even if he happens to get to a Y position like 260, he will be pushed to Ytop immediately. This happens from Ytop until Ytop + 8, provided that X ≤ X . The lateral walls starts in Ytop + 6 (without Yoshi).

With a similar reasoning and looking at the picture, Mario needs a vertical speed of at least 33, from 261.F (or above) to 264.0 (or below).

4) Doing so, Mario will clip the block. He can fall very fast and activate the block or not. If he is small and there's a second block just below the first, Mario will die if he touches the top of the second one.


Tutorial (to the right)
1) The technique is similar. Find the first horizontal position in which Mario won't touch the top of the block. In this example, he stands at X← = 3557.0 but would fall at X = 3556.F. So the X position of entrance must be 3556.F or less.


2) In order to corner clip, he must skip from a X position of entrance to X + 3 pixels. That means: Mario must skip from X1   3556.F to X2 3560.0 in one frame. Again, the horizontal speed must be 49 or more.





To do
Corner clipping with Yoshi and high speeds.
Corner clipping with Yoshi and low speeds.
Corner clipping while flying anf corner boosts.

2013/03/08

The vertical speed in a jump

Mario's initial speed in a jump depends on his velocity and whether the player pressed B or A. It's also possible to have different values by stomping an enemy or dismounting Yoshi. Here we see those values:

Speed A B
0, 1, 2, 3, 4, 5, 6, 7 -71 -77
8, 9, 10, 11, 12, 13, 14, 15 -73 -79
16, 17, 18, 19, 20, 21, 22, 23 -75 -82
24, 25, 26, 27, 28, 29, 30, 31 -77 -84
32, 33, 34, 35, 36, 37, 38, 39 -79 -87
40, 41, 42, 43, 44, 45, 46, 47 -82 -89
48, 49, 50, 51, 52, 53, 54, 55 -84 -92
56, 57, 58, 59, 60, 61, 62, 63 -87 -94
64 or higher (Mario can't jump) 2 3

Jumping off of an enemy or sprite after stomping it makes Mario goes up according to the way he fell onto it (spinning or normally):

Falling normally while pressing B or A: -88
Falling normally without pressing B or A: -48
Falling spinning (eg: Shells): -8
Falling spinning (eg: Rex): like when falling normally.
Dismounting Yoshi in the air: -96
Dismounting Yoshi in the ground: -64
Springboard without pressing A or B: -80
Springboard pressing A or B: -128

Therefore, we have the following set of speeds:
{-8, -48, -64, -71, -73, -75, -77, -79, -80, -82, -84, -87, -88, -89, -92, -94, -96, -128}

2013/03/07

Lateral Block Clipping

When Mario isn't small or ducking and is on Yoshi, their hitbox is very different from when it's not the case. Depending on how one approaches a block, like a cement block or a brown block, he or she can pass through it as Mario and Yoshi were two independent sprites. Demonstration here.

Fixing a reference
As it can be done in various blocks, it's useful to set a system of coordinates.
X axis: Mario's position will be 0 when he is in the first X position where he can touch the block.
In this example, the Xblock = 0 coincides with 579.0

Y axis: his position will be 0 when he is touching the block from above.
In this example, the Yblock = 0 coincides with 144.0

The lateral of the block
Every solid block of the game has a region of 5 pixels that pushes Mario outside, even if he stands below the block and jumps. In our system, the first position of real roof is Xblock = 5.0. This means that in Xblock = 4.F,  Mario will be pushed to the left until Xblock < 0.0.
In the other side of the block, the lateral behaves similarly.
In our previous block, Xblock = 5.0 if  X = 284.0.

The "hole" in the block
In the lateral of each sides, there's a region in which Big Mario mounted on Yoshi can enter without touching the block. This region is:

24.00 ≤ Yblock < 26.0

Provided that 0.0 ≤ Xblock < 5.0 (left side of the block) or 21.0 ≤ Xblock < 26.0 (right side).

In our previous block, Yblock = 24.0 if Y = 168.0 and Yblock = 25.F if Y = 169.F.



Inside the block
Between the laterals we have the interior of the block. The game usually will push Mario to the left when he is inside, depending on his Y position. So, if you are traveling to the left, you must only pass through the lateral of the right and the rest will be easy. In order to get boosted more, don't fall faster.
But, if you are traveling to the right, there's an additional complication. You have to jump from the "hole" to a region that doesn't push you to the left. In order to perform it, Yblock < 22.0 when 5.0 ≤ Xblock < 21.0 (inside the block).

Keeping this in mind, Mario needs X speeds up to 41 when doing this trick to the right (if he's not flying or swimming) and a Y speed of at least 33 to get inside:





This trick underwater
 In water levels, you can do this trick too. But now you can stay in the "hole" during more than a frame, because it's pretty easy to manipulate the vertical speed. Clipping to the left is incredibly easy and can be done without tools. Clipping to the right is much harder, but possible. In fact, one can get boosted 5 pixels (normal corner boosting saves only 2). Here's a sample that can be done in the 96-exit TAS.