2013/02/25

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...

No comments:

Post a Comment