Floor Snap Portal Boost

From P2SR Wiki

Revision as of 03:47, 23 June 2024 by Jerry (talk | contribs)

Floor Snap Portal Boost

Overview

Floor Snap Portal Boost (FSPB for short) is a glitch which allows you to gain massive velocity boost upon portal transition by conserving an offset of the last floor snap as a downwards velocity right before passing through portal.

Technical explanation

The glitch exploits an intended game mechanics which attempts to correctly preserve the movement direction when passing through portals. When moving on slopes, the player does not have any vertical velocity, and instead, is snapped right onto the surface they're walking on. The game's movement code measures the distance of the snap every frame the player is walking on a surface, and stores it as an implicit vertical step speed. Then, when player passes through the portal (which is no closer to being a floor portal than 30 degrees), this value is used to adjust the player's vertical velocity, giving the player downwards boost right before teleporting them to the other side.

The problem appears when the same logic is applied to larger steps. The amount of velocity given is equal to the speed you'd need to travel the snap distance in a single frame. With the maximum detectable floor snap distance of 18 units and framerate of 60, implicit vertical step speed can be as high as 1080 units per second.

One flaw which makes the glitch more powerful is the fact that the implicit vertical step speed is never updated if you're not on the ground. This means that you can keep getting the boosts on as much portal passages as you wish, as long as you're not grounded after getting snapped onto the ground.

It should be mention that the implicit vertical step speed is only applied by ground snapping and not the stepping logic, meaning only downwards velocity can be obtained. For more technical details, refer to the game's source code.[1]

Execution

In order to preserve the implicit vertical step speed, the player must tick-perfectly jump right after getting snapped to the ground, and then avoid ground frames entirely until portal passage. Alternatively, player can pass through the portal the same tick they were snapped to the ground (see examples below).

Upon entering a portal which is no closer to being a floor portal than 30 degrees, player acquires downwards velocity right before being teleported to the other side. This is more useful for upward angled portals, since applying a downward force would push the player more into the portal, allowing them to shoot out of the other one. However, for wall portals, the velocity would be applied towards the bottom edge of the other portal. In order to avoid hitting it, the player would have to have enough inwards velocity in the first place to avoid hitting it, or perform a portal bump.

Interestingly, implicit vertical step speed can be conserved even after portal passage. As long as player does not walk on the ground, Floor Snap Portal Boosts can be chained indefinitely.

Angled Portal Boost

It is confidently considered that Angled Portal Boosts are in reality Floor Snap Portal Boosts, where player snaps to a faulty geometry within a portal at the same tick they're passing through it. The exact behaviour of that faulty geometry generation is unknown and the concept is yet to be researched.

Examples

FLoor Snap Portal Boosts were used for quite a long time, despite not being understood.

In current Cave Johnson route, speedrunners align portal near a railing to get boosted by a scripted momentum. This, in reality, uses FSPB. By performing a floor snap right when we pass through the portal, we get a downwards boost. This velocity is then detected by a scripted momentum, which then corrects our velocity to point at the right direction.

Some maps, like Laser Catapult, Separation or Maintenance, use FSPB in a form of Angled Portal Boost. Performing it with an angled portal is more beneficial, because downwards velocity into an angled portal can be easily transformed into an upwards velocity.

References