What are invincibility frames in action games? I-frames explained

If you have ever rolled straight through an attack and taken no damage, you have used invincibility frames. So what are invincibility frames in action games? They are a short window of time when your character cannot be hurt, even though attacks still touch them on screen. This guide explains how they work, the two kinds you will meet most, how games show them, and a drill you can practise with the dash in Tank City Zero Day.

What are invincibility frames in action games?

A game redraws the screen many times a second. Each redraw is a frame, and the frame rate is how many of them the game draws per second. Invincibility frames, or i-frames, are the frames in which the game ignores hits on you.

The shot still flies. It may pass right through your character. The game simply skips the damage step for as long as the window lasts. Players use the same name whether the game counts that window in frames or in seconds.

You will also see other names for the same idea: mercy invincibility, an invulnerability period, or flashing invulnerability, after the way many characters blink while it lasts.

How i-frames work: a timer and a hitbox

Every character has a hitbox: an invisible shape the game checks for collisions, often a simple rectangle in a 2D game. The one that takes damage is sometimes called a hurtbox. When a bullet's shape overlaps yours, the game asks one question: should this hurt?

I-frames add one more check to that question. In plain steps:

  1. Something starts the window: you got hit, you dodged, or a new life began.
  2. The game sets a timer.
  3. Every update, the timer counts down.
  4. While the timer is above zero, overlaps with enemy attacks do nothing.
  5. When it reaches zero, hits count again.

That is the whole trick. What changes from game to game is what starts the timer and how long it runs.

Two common kinds: mercy frames and dodge frames

Mercy frames start after you take damage or lose a life. Without them, several shots arriving together could take several lives at once. The window gives you a moment to get clear. Protection when a new life starts, often called spawn protection, is a close cousin: it stops an enemy waiting at the start point from hitting you before you can move.

Dodge frames start when you press a button: a roll, a dash, a sidestep. They reward timing. Dodge too early and the window ends before the attack arrives. Dodge too late and you are already hit.

The two feel very different. Mercy frames are a safety net. Dodge frames are a skill you practise.

How games show i-frames on screen

A rule you cannot see is hard to trust. If you cannot tell when you are safe, the end of the window feels unfair. Games use a few common signals:

  • Blinking. The classic sign: the character flashes for as long as the protection lasts.
  • A shield effect. A ring or glow around the character.
  • A trail. During a dash, a streak of ghost images shows you are mid-move.
  • Words. A one-line tip such as "you cannot be hit mid-dash" teaches the rule faster than guessing.

Tank City Zero Day uses the last two. Its dash leaves a trail of ghost images, and its How to play list says the rule in one line.

The How to play list on the Tank City Zero Day page, where the Dash line says you cannot be hit mid-dash

The dash in Tank City Zero Day, by the numbers

Tank City Reboot is a free site of two original tank games that play in your browser. In the second one, Tank City Zero Day, your tank moves and fires in eight directions and can dash straight through enemy fire. You cannot be hit during a dash: dodge frames in their plainest form. Press Shift, K or X, gamepad button B, or Dash on a touch screen.

The numbers come from the game's code:

  • A dash lasts a fifth of a second (0.2 seconds).
  • The recharge starts when you press Dash and takes 1.5 seconds.
  • Each level of the Overclock upgrade cuts the recharge by 30% of that, to 1.05 seconds and then 0.6 seconds. Overclock also adds 15% to your starting move speed per level.
Timeline of the Zero Day dash: a fifth of a second when you cannot be hit, then ready again after 1.5, 1.05 or 0.6 seconds by Overclock level

So without Overclock you are safe for 0.2 seconds out of every 1.5 at most. If the game drew 60 frames a second, that safe window would be 12 frames. You cannot hide inside the dash; you have to pick the moment.

A worked example: dash through a Cryptominer's ring

The Cryptominer is a turret that fires rings of shots. It is a good teacher, because a ring has no gap to walk through. Try this drill:

  1. Stay a few tank lengths from the turret and watch one ring leave it.
  2. Hold a direction that points through the ring, not along it.
  3. Press Dash just as the shots reach your tank. You pass through during the fifth of a second you are protected.
  4. Count to about one and a half before you count on the dash again. With one level of Overclock, count to one; with two, a bit over half a second.
  5. Repeat for five rings. Note how many you cleared and whether you went early or late on the misses.

If you went early, the window ended before the shots arrived: it is only a fifth of a second, so wait a beat longer next time. If you went late, press a little sooner.

Two more tools help. Your shots cancel enemy shots, so you can clear a path with your cannon and save the dash. And staying alive protects your score: kills made within 2.5 seconds of each other build a chain multiplier of up to eight, and losing a life resets it. For more on surviving the later waves, see our boss-wave survival plan.

Shields: mercy frames in the two games

Zero Day also has a shield. After each wave you pick one of three upgrades, and Sandbox gives you a shield that stops one hit and then recharges, in 12 seconds, or 8 at level 2. It is not a timed window but a single blocked hit, which works like a mercy window you carry around. Our guide to picking upgrades after each wave weighs it against the others.

In the first game, at Tank City Reboot, there is no dash; your tank moves in four directions. Protection comes from shields instead. Each new tank of yours starts with a shield of about 4 seconds, which is spawn protection, and the Patch power-up gives a shield for ten seconds.

Frequently asked questions

Are i-frames the same as a dodge roll?

No. A dodge roll is a move, and i-frames are the protection window that some dodges give you. Mercy frames after a hit and spawn protection are i-frames too, with no dodge involved.

How long do invincibility frames last?

It depends on the game and the kind. In Tank City Zero Day the dash protects you for a fifth of a second, while a new tank in the first game starts with a shield of about 4 seconds.

Do frame rates change how i-frames work?

They can. If a game counts the window in frames, a lower frame rate makes each frame last longer, so the window lasts longer in real time. A game that counts in seconds keeps the window the same on any device.

Why does my character blink after a hit?

Blinking is the common sign that mercy frames are running. It tells you that you cannot be hurt for a moment, and that the protection ends when the blinking stops.

Get started

The fastest way to understand i-frames is to feel them. Open Zero Day, wait for wave 4, when Cryptominers start to appear, and run the drill above. Then try the first game and notice how the spawn shield changes the way you re-enter a fight. If you play on a phone, our controls guide shows where Dash sits on the touch pad.

Play Tank City Reboot: it is free, plays in your browser on a computer or a phone, and needs no account.

0 likes

Comments

No comments yet.

Sign in or make an account to comment.