Puyo Puyo Tsu/Soft Drop

From Puyo Nexus Wiki
Jump to: navigation, search

Soft drop (down arrow) is handled by a routine that also deals with regular pair drop besides free-fall, along with "locking" the pair once the player should not have control over it anymore.

Overview

Here's the fully annotated disassembly of the game routine:

RE-pair-fall-and-lock.png

The routine is split into two main paths (left and right), which both do the very same thing, except one path (on the right-hand side of the graph) is executed only when regular drop speed is higher than soft-drop speed.

When not accounting for this particular case, the routine reads the gamepad to check whether the down arrow is pressed or not. It then adds the relevant drop speed to the pair's vertical offset within the current cell. It finally performs a group of tests, checking whether the pair has reached the bottom of the cell, has crossed mid-height, or should be locked in place. The routine also triggers bouncing animations and placement sound effects.

Finally, that routine is responsible for the "grace period" during which the player retains control over the pair while it being at the bottom of the board or right at the top of a filled column.

Phases

This section will refer to the disassembly graph found above, by referring to code addresses.

Pair lock

The first check at 0x006116 skips right about to the end of the routine (0x0061F0) if the pair is already locked, preventing the player from moving it further.

Regular drop speed

At 0x006128, the routine checks whether the current, regular drop speed is greater or equal to 0x8001, while soft drop speed is hard-coded to 0x8000. This simply checks if the regular drop speed is faster than soft-drop speed, in order to skip reading the gamepad. Thus, contrary to popular belief, on Puyo Puyo Tsu revision 0 on Genesis, it is not possible to slow down the pair drop at latest solo stages, where drop speed is higher than soft-drop speed. This behavior may be present in other revisions, platforms and/or arcade.

If the current drop speed is high enough, the routing branches to the path dedicated to checking what should happen next and triggering animations. This path has exactly the same steps as below, except for the soft-drop speed section.

Soft drop speed

If the down arrow is pressed, current drop speed is set to its hardcoded value of 0x8000 (see address 0x006144). This speed amounts to exactly 8 pixels per frame.

Applying drop speed

At 0x006160, the current drop speed is added to the pair's vertical offset counter. This 16-bit value goes from 0x0000 (top of the current cell) to 0xFFFF (bottom). Mid-height is crossed when the counter is equal to or greater than 0x8000. This counter can be incremented by arbitrary amounts, though default drop speed in a 2P versus game is 0x1000, effectively requiring 16 frames to pass through a single cell, and only 2 frames while soft dropping.

Going on to the next cell

At 0x006162, the game detects whether the pair should carry on to the next cell by checking if an overflow occurred while adding to the vertical offset counter (the game added a value that would have made the counter go past 0xFFFF).

The pair's y-coordinate is incremented by one, and the vertical offset is cleared (reset to 0). Clearing that counter instead of keeping the remainder of the overflown counter effectively sets the pair back a little. This means soft-dropping cell after reaching mid-height of a cell is suboptimal, if the cell below is empty. Indeed, the player doesn't make use of the full potential of the 8-pixel distance added from soft-dropping. This can be used to put the falling pair to a well-known state (right at the top of a cell).

This means that while soft-dropping, a pair can only be at one of two vertical offsets, for the duration of a single frame:

  • 0x0000, right at the top of a cell;
  • 0x8000, right after mid-height.

If the cell below is blocked, the routine skips right to the end to lock the pair.

Starting the bounce animation

While the pair is dropping, the game checks for a specific event: if the pair has crossed mid-height of the current cell (at 0x00616C) and if the cell below is occupied (at 0x006174), it will trigger the bouncing animation as well as the placement sound effect. This only occurs if the vertical offset went beyond 0x8000 during that frame, so only right when it crosses that line.

Thus, if a pair is moved sideways after it crossed the mid-height line, if the cell below its target is blocked, the bouncing animation will not be triggered.

Grace period at the bottom

Once the pair is blocked at the bottom of the board or over a filled column, a counter is decremented as a grace period (at 0x0061CE). When that counter hits zero from an initial value of 0x20 (set at 0x0061C2), the pair will be locked. This means there is a 32-frame grace period before control lockout.

This counter is initialized the first time the pair encounters an obstacle (i.e. it should have carried on to the next cell but was blocked). It is never reset to its initial value afterward, thus going down a stair-like structure will decrement the same global counter.

Hence, a single pair can only spend a total of 32 frames while being blocked but controllable, even if that time is spent over multiple short-duration phases. This grace period is ignored by soft-dropping and the pair is locked right away.

Grace period override

Another counter (at 0x006190) overrides the grace period and triggers the control lockout anyway, if the pair crossed any mid-height line 8 times, while the cell below was being blocked. This is a hard limit at how many times one can push his pair back up. When the counter reaches 8 times, control is locked and the pair is forced at the bottom of the current cell. Since push back sets the pair just above the mid-height line, it is not possible to overcome this limit.

Locking the pair

This is the only routine locking the pair by setting a flag in the pair's memory structure (at 0x0061F0). This will prevent further control by the player as this bit is checked by other movement routines.

Animation wait

Right after locking the pair, the routine still loops while the current rotation animation has not ended. It is thus impossible to skip the final rotation animation when placing a pair (most probably when soft-dropping). This rotation animation takes 8 frames to complete.

Visual summary

Here's a GIF animation summarizing the 16 frames of a regular drop through a single cell, with the mid-height trigger for the bouncing animation explained. Note the actual animation is not properly synchronized with the actual game status, making it difficult to find accurate visual clues.

RE-cell-drop-small.gif

Consequences

  • On Genesis, with Puyo Puyo Tsu revision 0, it is impossible to slow down the falling pair by pressing down is the latest solo stages of the game.
  • It is possible to skip the bouncing animation when placing a pair (motion cancel).
  • It is impossible to skip the rotation animation.
  • It is impossible to skip the bouncing animation of a free-falling puyo.
  • There is a global grace period of 32 frames before control lockout, when the falling pair is blocked. It means a single pair can only spend a total of 32 frames being blocked but controllable, even if that time is spent over multiple short-duration phases. This grace period is ignored by soft-dropping and the pair is locked right away.
  • It is only possible to push a pair back up 8 times for the duration of its lifetime. On the 8th attempt, the pair will be locked out.

Motion cancel

Motion cancel is a trick enabling skipping the bouncing animation in order to save time (a few frames at each successful attempt).

The bouncing animation lasts for 16 frames, and is triggered only when crossing mid-height of the last free cell of a column. Thus, by making a pair fall through an empty column (or at least with one more free cell that the target column), the player can wait until the pair reached the desired vertical position, then wait for it to cross the mid-height line on the same column, then moving the pair sideways to the intended destination to skip the trigger point of the bouncing animation.

The following GIF animation explains the whole process, with P1 performing the motion cancel trick while P2 is not.

RE-motion-cancel-demo-small.gif

The trick can save up to 16 frames only, per successful attempt:

  • the bouncing animation lasts for 16 frames;
  • soft-dropping triggers the bouncing animation on the very last frame of the falling pair's presence in a cell, this frame being the first bouncing.

It is not possible to save time if the trick is performed without soft-dropping, as the grace period will not be skipped, imposing a 32-frame delay before control lockout.

The bouncing animation lasts for 16 frames but starts 1 or 8 frames before hitting the ground. The rotation animation lasts for 8 frames and cannot be skipped when the pair hits the ground.

Frame data

Drop speed frame data tables are maintained on the dedicated page.