Stair Drag

From ALttP Speedrunning Wiki
Revision as of 18:31, 27 September 2023 by RequiemOfSpirit (talk | contribs) (Cancelling stair drag)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Stair drag refers to the short period of slower stuttery movement link has when exiting manual stairs/ladders or when moving in certain directions after finishing spiral staircase transitions. This page goes over what stair drag is, how to cancel it, visual cues for cancelling stair drag on manual stairs, a brief look at dashing off stairs and a brief look at what happens internally to cause stair drag.

The "stair drag" state activates when link walks on to the last 7-8 px of manual stairs or when link tries to move any direction that is not left or right after a spiral staircase transition. This state will automatically end after 15 frames after which link will regain normal speed. (Note: If link moves back onto manual stairs during this 15 frame period, this state will end immediately and link will switch to manual stair speed. Stair drag will reactivate again when exiting stairs.)

Stair drag movement speeds

Stair drag causes link to move a max of 8px-9px in the 15 frames it is active (i.e. 0.533-0.6px/frame). This is slightly slower than manual stair speed (0.6875px/frame on average) and much slower than normal walking speed of 1.5px/frame.

Cancelling stair drag

Stair drag can be cancelled early by holding straight left (<) for 1 frame, holding dash (holding A while you have boots) for 1 frame or holding straight right (>) for 2 frames. After cancelling stair drag, link will regain normal movement speeds.

While link is going through spiral staircase transitions, you can hold straight left or right to cancel stair drag immediately before transitioning to the direction you need to move in. Alternatively, you can hold your desired non-left/non-right direction and tap A (with boots) when you see link start to move after the transition completes to cancel stair drag.

On manual stairs, you can cancel stair drag as soon as it starts. Cancelling stair drag on the earliest possible pixel can save 9 frames if moving up off of the stairs or 8 frames if moving down off of the stairs. The section below goes over visual cues for manual stair drag cancels.

Manual stair drag cancel visual cues

Moving up off manual stairs

(Note: The visual cues described below use link's ear when link is at a standstill. These cues change when link is moving because of his up-down bobbing animation. Always err on the side of being higher than the cues listed below to guarantee not going too early.)

When moving up off manual stairs, the coordinates you can cancel stair drag on will be of the form xxx1 or xxx9. The images below show the visual cues to look for the different types of manual stairs:

North closed stairs

(Closed stairs here refer to 1-tile wide manual stairs)

The line where Link's ears changes color lines up perfectly with the top of the stair wall
The line where Link's right ear changes color lines up perfectly with the line where the left edge of the right wall changes color
North open stairs
The line where Link's ear changes color is 1px below the top stair line
North ladder
The line where Link's ear changes color lines up perfectly with the top of the stair texture

Moving down off manual stairs

(The visual cues below use Link's shadow and are not affected by link's movement animation)

When moving up off manual stairs, the coordinates you can cancel stair drag on will be of the form xxxF or xxx7. For all types of stairs, the earliest pixel when stair drag can be cancelled is when Link's shadow touches the bottom of the stair texture (bottom row of link's shadow is 1 px above the bottom of the stair texture). The images below show a couple examples of this:

Stair drag cancel - Open stairs south.JPG
Stair drag cancel - Closed stairs south.png
Stair drag cancel - Ladder south.png

Dashing off manual stairs

When activating dashes on stairs, link gets a 4px movement on the 1st frame of movement. Additionally, when dashing off stairs, link will automatically exit stairs at full dash speed 1px or 2px after the visual cues shown above, skipping most of the stair drag. However, while still on the stairs, after the first frame of movement, link's speed drops to 0.625px/frame on average. This only loses 1px every 16 frames to normal walking on stairs, but is much slower than link's speeds when double pumping up stairs (which can approach 1px/frame with decent pumping).

Dash movement on stairs is slower in general, but the first frame of movement gives you a 4px jump immediately. So whenever you need to having dash speed exiting stairs, you should start your dash 2px-3px before the visual cues shown above (2px when moving up, 3px when moving down).

When dashing down, the timeloss from starting your dash early is quite low and also pretty random. In practice, the only room where dashing has significant timesave is when exiting desert palace big chest room. If you start your dash from the top of the stairs in that room, the time lost compared to dashing from 3pxs above the visual cue shown above is only 0-2 frames. However, for every frame you delay after reaching the 3px point, you lose a frame, so it's better to err on the side of dashing early.

Internal workings of stair drag

The game maintains a value in $57 that affects your movement speed: $57[0x01] - Modifier for Link's movement speed. 0 - normal, 0x01 to 0x0F - slow, 0x10 and up - fast. Negative values actually reverse your direction.. Normally this value is always 0 (avg speed: 1.5px/frame or 3px/2frames). When you're on stairs, this gets set to 1 (avg speed: 0.6875px/frame or 11px/16frames).

When the game detects that you are no longer on stairs, it starts incrementing this value by 1 every frame, counting up from 2 to 16 - this is when stair drag is active. During these 15 frames, link moves 8px-9px assuming you move continuously while it's counting and don't cancel it early. After 16, it resets back to 0 and your movement speed returns to normal. If at any point you move back onto the stairs, it immediately gets set back to 1. Once it starts counting, you can stand in place to wait for it to hit 0 and you'll regain your normal speed again.

For manual staircases, the game detects you as "off of stairs" on the last 7-8 px of stair tiles. It will start incrementing $57 when you reach these ends of manual stairs.

For spiral staircases, this value gets set to 1 when you enter a spiral staircase transition and persists through the transition. After the transition completes, the next step that link takes (step of at least 2 px - e.g. holding down at least 2 frames) causes the game to detect that he is no longer on any stairs. The game then starts to increment $57.