Skip to content

Invulnerability frames

Asunaya edited this page Oct 1, 2017 · 1 revision

Invulnerability frames (or i-frames) is a bug where, during certain animations, and at certain angles, the player will be invulnerable to melee attacks (slashes, massives, and flips).

Internally, this occurs because the function that is supposed to tell if the victim of a melee attack is behind a wall, ZGame::CheckWall, has a bugged implementation, making the game erroneously thinks that the player being attacked is behind a wall.

The idea of the ZGame::CheckWall algorithm is to obtain a point on each player, 100 height units above their position (that is, each player's position + (0, 0, 100)). Then, the function shoots a traceray (using ZGame::Pick) from the attacker's point, through the victim's point (i.e., continuing beyond the victim). Then, it checks if the first thing hit by the ray is a wall, and if so, concludes that the victim is behind a wall, and invulnerable to attacks.

The assumption that is supposed to make this work is that a (0, 0, 100) offset would always be on the player, and the player would always be hit by this ray unless there's a wall behind them. The problem with this is that the algorithm uses the player's damage hitbox (from ZCharacter::HitTest), which moves to roughly match the current animation.

For instance, if a player gets flipped and doesn't safefall, the animation will have them lying flat down, horizontally on the ground. Although the hitbox is not very exact, it will roughly follow along, and also be flat on the floor. However, the (0, 0, 100) offset rigidly always goes straight upwards from the position, which makes the point somewhere in the air way above the player in this position.

So what does the traceray hit instead? On a normal map that doesn't have leaks, the ray will always continue on and hit a wall behind the player.

However, if you move sufficiently above or below the player, you can make the ray go through the hitbox, which means that i-frames stop working at certain angles.

Clone this wiki locally