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.

2013/02/25

Walljump


Prerequisite: Catching the wall.

Walljumping is an old technique in SMW and previous Mario's games. It can be done without tools quite often, if you try enough. In order to do a walljump, one must only press B or A one frame before snagging the wall. That means, the jump button must appears in the input in the last frame before hitting the wall. The height of the jump is identical as when Mario is stationary.

One-Sided Walljumping

In several hacks, the player has to pass through a high wall by walljumping. The video shows an example in the original game. Nearly everytime, he wants to surpass the maximum of blocks in a jump and that his jump takes the minimum amount of frames. The first criterion is easy, he must surpass two blocks per jump. A reasoning due to Mister answers the second criterion: we need 44 frames between the jumps and 43 is impossible. In the Input Macro Editor, this sequent works if Marios starts moving from the wall with speed -2 and his subpixel is .0, the left-extremum of the block's top.

[(<BY)]15(BY)[(<BY)]2Y[(>BY)]24(>Y)

If those conditions don't match, you must:
  • Edit you previous input in order to fulfill the conditions;
  • While going to the left, stop when you are further from the wall. But your speed needs to increase starting from -26.
Demonstration: http://dehacked.2y.net/microstorage.php/info/417001734/Wall%20Jump.smv

Catching the Wall

It's very well known that SMW has this "glitch": sometimes when we jump against the wall, Mario's feet catch it for a while and then he starts falling again. Although it seems random when playing in the console, we TASers must know the exact conditions.

TASVideos says:
Walljumping happens when Mario jumps towards a wall, and his foot catches the wall, stops his falling speed, and allows him to jump again in mid-air. In order to pull off a walljump, Mario needs at least a speed of 33 going toward a wall, and must run into the wall at exactly a block boundary (every 16 pixels). If Mario "catches" the wall, then conditions are good for a walljump - simply press jump a couple frames before he snags it.
The smallest variations in speed and position during the jump onto the wall can affect whether or not this works correctly. Keep trying!
Let's see how it works.

1) A block in SMW has two sides and a top. The distance between the edge of the side and the extreme of the top is 2 pixels. That means, if 101.0 is the first horizontal position in which you can't stay stationary, so 101.0 is the edge of this block. The previous position, 100.F, is free. For this imaginary block, the top starts in 101.0 + 2 = 103.0.

2) The position and speeds work like this: if Mario is in a position x with speed v and is going to a free position x', then x' = x+v. But if the new position is not free, like in the side of the wall, this result will diminish 1 pixel (or grow, depending on the side).

3) If Mario travels to position that is the side of a block , the game will first compute what would happen to Mario in x' and then will push him outside.

Snagging the wall

Suppose we want to snag the following wall.



We notice that 1619.0 is the edge of the block. The edge always ends in .0 if you are in the left of the block and ends in .F if you are in the right of it. Therefore, we want to go to 1621.0 or further to reach the top. The speed is zeroed if we run against the side, so we need to jump from x to x', provided that

x < 1619.0 and x' 1621.0

That implies:

x ≤ 1618.F and x' 1621.0     x' - x 1621.0 - 1618.F = 2.1 pixels = 33 subpixels

Therefore, Mario needs a speed of at least 33 in order to snag the wall. With this minimal speed, we would have:


As pointed out, Mario goes to 1621.0.
The game flags that Mario is on the top of a block.
Mario isn't in a free position, so he must be pushed 1 pixel to the left, 1620.0.

Demonstration: http://dehacked.2y.net/microstorage.php/info/797472019/Wall%20Catch.smv

Other conditions are:
  • Mario must have a vertical speed higher than 2, when he gets inside the wall.
  • Mario's vertical position must be such that he would fall onto the block, if the other block didn't exist to stop him. It does NOT happen once each 16 pixels, but 6 pixels out of 16 (with Yoshi, 8/16).

Snagging the wall for two consecutive frames

Instead of going to 1621.0, we could go to 1622.0 or beyond. In order to perform it, we must have high speed. Reasoning like before:

x < 1619.0 and x' 1621.0

That implies:

x ≤ 1618.F and x' 1622.0     x' - x 1622.0 - 1618.F = 3.1 pixels = 49 subpixels

Entering:


Being pushed outside:

Demonstration: http://dehacked.2y.net/microstorage.php/get/546695181/Wall%20Catch%2049.smv

This might be useful. In the Super Demo World TAS, it was used to scroll the screen in #2 Desert Castle.

Applications

  • Walljump.
  • Entering pipes without ground below, but next to a wall.
  • Entering doors without ground below, but next to a wall.
  • Catching the wall under water.
todo: make an article about those...