Guide
Game dodge roll and invincibility frames explained
Harbor Ruins shipped its first boss gauntlet with a dodge button that moved the player three meters but granted zero invincibility. Sweeps that looked dodgeable still clipped the hurtbox mid-roll; playtesters called defense “cosmetic.” The refactor added a short i-frame window aligned to the tuck animation, gated repeated rolls behind stamina, and introduced a perfect dodge reward when the input landed inside the last 150 ms before impact. Boss clear rates rose 22% without lowering damage — players finally trusted the roll. A dodge and i-frame system is the defensive layer of combat design that trades positioning, timing, and resource cost for temporary immunity to damage and often to stagger. This guide covers dodge archetypes, invincibility frame timing, stamina and cooldown gates, perfect-dodge rewards, interaction with poise and hitstun, camera and animation cues, multiplayer authority, the Harbor Ruins refactor, a genre decision table, pitfalls, and a production checklist. For close-quarters attack resolution once a dodge fails, see melee combat systems; for input buffering that makes dodges feel responsive, see input handling.
Dodge archetypes: roll, dash, sidestep, and blink
Players say “dodge roll” generically, but implementations differ in distance, facing rules, and whether i-frames cover the whole motion or only a slice of it:
- Roll: grounded arc with root motion; often locks facing to movement direction. Common in souls-likes and action RPGs. I-frames usually sit in the middle third of the animation when the body is tucked.
- Dash / burst step: short linear burst, sometimes air-dodge capable. Faster startup than a roll; fewer i-frames but lower recovery. Used in shooters and character-action games.
- Sidestep / strafe dodge: minimal displacement; preserves aim down sights. I-frames may be shorter because the player keeps offensive posture. Standard in cover shooters.
- Blink / teleport: instant position change with a brief post-blink vulnerability window. High skill ceiling; easy to abuse if cooldowns are short.
- Parry-adjacent dodge: standing evade with no translation (backstep). Tiny i-frame count but cancels into attacks quickly — common in fighting games as invincible backdash.
Pick one primary dodge per game mode. Mixing roll + blink + sidestep without distinct buttons confuses muscle memory and makes tutorial messaging harder.
Directional vs omnidirectional
Directional dodges require stick input before the button press; backward rolls often travel farther but have longer recovery. Omnidirectional dodges use the stick only to pick heading at press time — easier on controller, but can trivialize attacks designed around readable lanes. Lock diagonal speed to the same magnitude as cardinal directions unless you explicitly want skillful diagonal advantage.
Invincibility frames: what they actually do
Invincibility frames (i-frames) are ticks where the player hurtbox is disabled or flagged non-damageable. They are not the same as intangibility against all collision — many games keep the player physical during a roll so environmental clipping still applies. Document three separate flags in code:
- Damage immunity: HP and shield do not decrease.
- Stagger immunity: poise does not break; hitstun does not apply.
- Grab immunity: optional; some bosses ignore i-frames on command grabs to prevent infinite roll loops.
Typical souls-like rolls grant 12–20 frames of damage immunity at 60 FPS (200–330 ms), often not covering startup or landing. Fighting games measure i-frames in single frames — a 3-frame backdash invincibility is enormous at that scale. Expose start frame, end frame, and immunity flags in designer tables tied to animation markers.
Visual and audio telegraphing
Players learn i-frame timing through motion silhouette: tuck, blur, afterimage, or shader flash. Audio stamps (whoosh pitch drop) reinforce the safe window without requiring UI. Avoid hiding i-frames entirely — opaque immunity feels like random damage rejection. For color-blind accessibility, pair VFX with shape change (smaller hurtbox capsule) and distinct SFX.
Stamina, cooldowns, and spam prevention
Unlimited dodges reduce every attack to “roll until safe.” Common gates:
- Stamina cost: each roll drains a chunk; regen delay after empty prevents chain rolling. Tune cost relative to attack damage so two failed reads still hurt.
- Recovery lockout: cannot dodge again until landing animation completes — independent of stamina.
- Charge meter: limited dodge charges that refill over time; popular in shooters and souls-likes with magic dodge variants.
- Weight class modifiers: heavy armor shortens i-frames or raises stamina cost; light builds get longer immunity at lower poise.
Surface remaining stamina and dodge charges in the HUD before players die to opaque resource drain. See stamina systems for regen curves and action economy.
Perfect dodge, parry overlap, and offensive rewards
Perfect dodge (or “just dodge”) triggers when input lands inside a narrow window before impact — often 100–200 ms. Rewards vary by genre:
- Time dilation / brief slow-motion for readability
- Free counterattack opener with bonus poise damage
- Refill stamina or dodge charges
- Style rank bump in character-action scoring
- Ammo or mana refund in hybrid shooters
Perfect dodges overlap conceptually with parries and weapon clashes. If both exist, differentiate risk: parry fails on multi-hit strings unless held; perfect dodge always relocates the player. Use distinct button mappings and SFX so players do not confuse systems. In Harbor Ruins, perfect dodge triggered a 0.4s slow-mo slice and restored 30% stamina — enough to reward skill without enabling infinite offense loops.
Interaction with poise, hitstun, and attack phases
Dodges interact with the offensive side documented in melee combat:
- Active-frame overlap: i-frames must cover the enemy attack’s active window, not just startup. A 8-frame i-window loses to a 12-frame sweep.
- Tracking attacks: homing swings punish early dodges; teach players to dodge into active frames or use late perfect dodges.
- AoE ground effects: if damage persists after the swing, i-frames ending on landing still take tick damage — add lingering hazard telegraphs.
- Hyper armor enemies: dodging behind a boss mid-swing is valid; dodging through them may clip collision. Cap positional overlap with physics depenetration.
When stagger locks the player, disable dodge until recovery ends — unless a dedicated “breakout dodge” is a authored escape with long cooldown.
Harbor Ruins boss gauntlet refactor (worked example)
Problem: three bosses shared a roll animation with movement root motion but no immunity flags. Netcode logged hits on 31% of rolls that looked successful locally.
Changes:
- Added damage + stagger immunity from animation marker
dodge_iframe_startthroughdodge_iframe_end(14 frames at 60 FPS). - Stamina cost 24 per roll; regen pause 0.6s after third consecutive roll.
- Perfect dodge window 150 ms before hit; slow-mo 0.4s at 40% speed; stamina refund 30%.
- Backward roll +20% distance, +6 frames recovery — risk/reward for spacing vs punish windows.
- Server validates dodge start timestamp against last known enemy attack phase; reject rolls that start after damage application (anti-cheat).
Result: boss clear rate 22% higher; average attempts per boss dropped from 4.1 to 3.2. QA still tracks grab attacks that intentionally ignore i-frames — documented in encounter data per boss.
Genre decision table
| Genre pattern | Dodge type | I-frame length | Resource gate | Perfect dodge |
|---|---|---|---|---|
| Souls-like action RPG | Directional roll | Medium (12–20f) | Stamina | Optional slow-mo |
| Character-action (DMC/Bayonetta) | Dodge + witch time | Short; style-dependent | None / style meter | Core mechanic |
| Cover shooter | Sidestep out of cover | Very short | Cooldown | Rare |
| ARPG (Diablo-like) | Blink / dash skill | Full dash or none | Skill cooldown | No |
| Fighting game | Backdash / invuln move | Frame-precise | Frame commitment | N/A (separate system) |
| Bullet hell / twin-stick | Short dash | Short burst | Charge count (1–3) | No |
Multiplayer and netcode notes
Client-side i-frames feel responsive but enable cheating if the server trusts immunity blindly. Patterns that work:
- Server rewind validation: on dodge RPC, rewind enemy attack state by RTT and confirm i-window overlap before rejecting damage.
- Lagged hurtbox disable: server disables player hurtbox only after confirming dodge start within latency budget.
- Visual-only client i-frames: server uses generous but fixed windows; client VFX may start slightly early for feel.
Log desync cases where client predicted immunity but server applied hit — tune windows before players blame “ghost hits.”
Common pitfalls
- Movement without immunity: the most common dodge failure; players learn rolls are lies.
- I-frames covering entire animation: removes risk from long recovery rolls; enemies cannot punish whiffed defense.
- Invisible immunity: no silhouette or SFX change; deaths feel random.
- Stamina not shown: players cannot plan reads; difficulty feels arbitrary.
- Identical forward/back rolls: loses spacing depth; backward recovery should cost more.
- Perfect dodge without telegraph: reward feels like a hidden random proc unless attack wind-up is readable.
- Grab attacks ignoring i-frames without warning: must be visually distinct (glow, audio) from normal swings.
- Netcode afterthought: PvP ghost hits destroy trust faster than any boss difficulty spike.
Practitioner checklist
- Pick primary dodge archetype (roll, dash, sidestep, blink) per game mode.
- Mark i-frame start/end on animation timeline; document immunity flags.
- Tune stamina or charge cost against attack damage and regen curves.
- Implement recovery lockout to prevent infinite roll chains.
- Add VFX/SFX telegraph for safe window; test color-blind readability.
- Define perfect-dodge window and reward; differentiate from parry if both exist.
- Validate i-frames against longest enemy active frames in each tier.
- Author grab/unblockable attacks that bypass immunity with clear telegraphs.
- Server-validate dodge timestamps in multiplayer; log desync rejects.
- Regression-test diagonal input, backward rolls, and airborne dodge edge cases.
Key takeaways
- Dodge rolls must grant timed invincibility aligned to animation — movement alone is not defense.
- Stamina, cooldowns, and recovery lockouts prevent dodge spam from trivializing combat.
- Perfect dodges reward readable enemy telegraphs; pair with distinct SFX from parries.
- I-frame length must be shorter than or equal to the threats you expect players to beat.
- Multiplayer requires server-side validation of immunity windows — client-only i-frames breed ghost hits.
Related reading
- Game melee combat systems explained — poise, stagger, and hit detection when dodges fail
- Game combat systems explained — hurtboxes, damage pipelines, and frame data fundamentals
- Game stamina and resource systems explained — regen curves and action economy for dodge costs
- Game input handling explained — buffers and priority so dodges respond on the frame players expect