Author Topic: A good explanation about the logic behind aligns  (Read 3373 times)

lawatson

  • The Kid
  • Posts: 331
  • I do things and I make things.
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 40.0.2214.94 Chrome 40.0.2214.94
    • View Profile
  • Playstyle: Keyboard
A good explanation about the logic behind aligns
« on: February 03, 2015, 11:18:37 PM »
Let's go over the basics. The player moves 3px per "step" when a directional button is pressed. Let's say the player is on align 0. This means they can go to X = 3,6,9,12,15, and so on. But if they wanted to change their align so they could go to X= 1, 2, 4, or 5, they would have to change their align to 1 or 2. How do you do this? By hitting a wall with that align. Let's see an image regarding the aligns.

Now let's ask our first question: Why do the aligns shift like this? This occurs because since there are 3 possible aligns and the grid is indivisible by 3 (32/3 ≠ integer).
What does this mean? Let's take a more in depth look.


With this, you should understand how you get each align. Now for an explanation regarding offset blocks. Note: this is pretty much an extended example of the first part, which explains how aligns work in the first place.
Chances, although low, are that one of the blocks is offset, with its position maybe 40 or 48. This isn't too complex, because all you're doing by grabbing the align is offsetting it.
Let's take a look at a regular block and an offset block's aligns.
'

There's an explanation for why these two aligns are the same. if the left align's X is 0, that means the far align's X is 24. 24 and 0, when divided by 3 (move speed), result in the decimal point .00, so this means that they are both on align 0.

Now let's look at an offset block which doesn't result in the same align.

The left align's position is 0, and the far align's position is 16. 0/3 is .00 and 16/3 is 5.33 or 1/3. 1/3 * 3 is 1, so it makes sense that the far align is shifted by one pixel.
You can use this guide to basically figure out anything align-related.

That basically covers the align explanation, so I hope you understand now what aligns are and how they work!

Now let's move on to a bonus explanation regarding walk-off aligns!
Walk-off aligns let you walk off a block which has a spike poking out from it. It's only possible with one of the three aligns. But why? The explanation for this is quite complex. The short answer is that it depends on the player's hitbox. If you want the long answer, you can learn about it from the next section.

Here's a failed attempt at a walk-off, where the kid got an align from the block next to them.


Now let's check out the successful attempt, where the kid got an align from the other side of the spike block.


You may or may not be wondering how the player does it with the align farther away from the spike instead of the align closer to the spike. Now we're going to get technical.

Let's see an image of that same thing, but with the align grid.


More specifically, the align which allowed the player to fall through:


The top of the spike where the player can hit is 2px wide.
Let's say that the correct align's X position is 0. That would mean the spike's position is 32. The two kill pixels are at position 32 and 33. With the align, you could go to X=27,30,33,36,39.
Now here's where it gets weird: Though the player's origin, or true position, follows the same 3 pixels as the align, the edge of the hitbox doesn't. The player's regular hitbox is 11px wide, which is not divisible by 3. It's 2px longer than the highest .00 division decimal result, 9. Simply, the edge of the hitbox is extended by two pixels.
 Normally the align in the same block as the spike would be the correct one, but the two edge pixels would collide with the two kill pixels. With the 1px far align, the edge pixels would only collide with the far kill pixel. With the 2px far align, or the correct one, the two edge pixels go beyond the kill pixels, resulting in a successful walk-off! You can use the same logic as this explanation to determine walk-off aligns with different hitbox lengths. I hope this helps you understand!

EDIT: I'm bad at explaining things, so there are probably quite a few things in the post that don't make sense. Try to look past that, though :BloodTrail:
« Last Edit: February 03, 2015, 11:33:10 PM by lawatson »
(click to show/hide)

smoke weed everyday

tehjman1993

  • Global Moderator
  • The Kid
  • Posts: 278
  • Meme Enthusiast
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 40.0.2214.94 Chrome 40.0.2214.94
    • View Profile
  • Playstyle: Keyboard
Re: A good explanation about the deal with aligns
« Reply #1 on: February 03, 2015, 11:22:23 PM »
Good basic explanation, I think it would help more if you put more example pictures up, such as optimal aligns for specific jumps that you commonly find in needle games, like corner jumps!

lawatson

  • The Kid
  • Posts: 331
  • I do things and I make things.
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 40.0.2214.94 Chrome 40.0.2214.94
    • View Profile
  • Playstyle: Keyboard
Re: A good explanation about the deal with aligns
« Reply #2 on: February 03, 2015, 11:27:42 PM »
I based this post more on the logic behind aligns, not the aligns for jumps. I'm sure someone will make a post on that, though.  :SoonerLater:
(click to show/hide)

smoke weed everyday

thebmxbandit11

  • Wannabe
  • Posts: 46
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 40.0.2214.94 Chrome 40.0.2214.94
    • View Profile
  • Playstyle: Keyboard
Re: A good explanation about the deal with aligns
« Reply #3 on: February 05, 2015, 02:29:36 AM »
Good basic explanation, I think it would help more if you put more example pictures up, such as optimal aligns for specific jumps that you commonly find in needle games, like corner jumps!

I made something like that a little while ago:
(click to show/hide)