Guide

Game combat systems explained

Combat is where player skill, game feel, and systems design collide. Whether you are building a Soulslike dodge-roll encounter, a combo-heavy brawler, or a turn-based RPG, the underlying pipeline is similar: read player input, advance attack state machines, test collision between offensive and defensive volumes, apply a damage model, and feed results back through animation, audio, and UI. Get any layer wrong and fights feel mushy, unfair, or desynced online. This guide walks through hitboxes and hurtboxes, frame data and invincibility windows, damage formulas and status effects, combo design, enemy telegraphing, multiplayer authority, and how combat ties into difficulty curves and game juice.

The combat pipeline: from button press to hit confirm

Most real-time combat systems follow a repeating loop each frame or fixed timestep:

  1. Input sampling — buffer actions during recovery frames so a dodge queued at the last millisecond still registers.
  2. State transition — move the attacker from idle to windup, active, recovery, or hitstun.
  3. Hit detection — test whether attack volumes overlap valid hurtboxes this frame.
  4. Hit resolution — compute damage, knockback, stun duration, and on-hit effects.
  5. Feedback — play hitstop, screen shake, damage numbers, and state changes on both parties.
  6. Cleanup — expire one-shot hit flags, decrement combo timers, tick status effects.

Turn-based and card combat swap continuous collision for explicit target selection, but the resolution step — applying modifiers, crit rolls, and resistances — uses the same design discipline. Document each phase in a combat design spreadsheet so designers, animators, and programmers share one source of truth.

Hitboxes, hurtboxes, and collision layers

A hitbox (attack volume) is the offensive shape that can deal damage. A hurtbox (vulnerability volume) is where a character can be struck. They are intentionally not the same as the visual mesh — a sword swing often extends beyond the blade mesh for readability, and a dodge roll shrinks or disables hurtboxes during i-frames.

Detection strategies

  • Axis-aligned or oriented boxes — fast, common in 2D fighters and platformers.
  • Capsules and spheres — smooth rotation for 3D melee arcs.
  • Raycasts and sweep tests — thin weapons, bullets, and piercing attacks.
  • Physics overlap queries — engine-native broadphase then narrow phase.

Use collision layers and masks so player attacks hit enemies and breakables but not allies, and enemy attacks hit players but not other enemies (unless friendly fire is a feature). Each attack should carry metadata: owner ID, damage type, knockback vector, pierce count, and a unique hit ID to prevent the same swing from registering twice on one target.

Debug-draw hitboxes in development builds. Fighting-game communities publish frame data because invisible boxes erode trust; action RPGs benefit from the same transparency during internal playtests.

Frame data: startup, active, recovery, and cancel windows

In frame-based combat (60 FPS = one frame ≈ 16.67 ms), every attack decomposes into:

  • Startup (windup) — animation before the weapon can connect. Vulnerable unless armored.
  • Active frames — hitbox enabled; this is the only window that can deal damage.
  • Recovery (endlag) — follow-through where the attacker cannot act or is punishable.

Cancel windows let designers chain attacks: a light combo might cancel recovery into the next swing on frame 12, while a heavy attack is fully committed. Invincibility frames (i-frames) temporarily remove or shrink hurtboxes — essential for dodge rolls, parries, and spawn protection. Players learn i-frame counts intuitively; changing them mid-development without patch notes feels like a stealth nerf.

Hitstun and blockstun freeze or limit the defender's options after contact. Blocked attacks often apply reduced hitstun and chip damage. Frame advantage — how many frames the attacker recovers before the defender can act — is the hidden math behind "this move is safe on block."

Damage models and scaling

Pick a damage model that matches your progression and readability goals:

ModelBehaviorCommon in
Flat damageAttack deals fixed HP regardless of statsArcade brawlers, roguelike floors
Stat-scaledBase × strength × weapon tier × critRPGs, looter shooters
Percentage (HP-based)Deals % of current or max HPPlatform fighters (Smash-style)
Poise / postureSeparate meter breaks stance before HP lossSoulslike, Sekiro-likes

Layer modifiers consistently: armor reduction (flat or percentage), elemental weaknesses, critical hit rolls, damage falloff by distance, and combo scaling that reduces per-hit damage in long strings to prevent infinite loops. Expose the formula to designers as data (ScriptableObjects, JSON, CSV) rather than hard-coded constants scattered through code.

Status effects — burn, poison, stun, slow — should declare stack rules (refresh duration vs intensify), tick interval, and cleanse interactions up front. Ambiguous stacking is a top source of balance bugs in live-service titles.

Combat feel: hitstop, knockback, and combos

Numbers alone do not sell impact. Juice bridges simulation and sensation:

  • Hitstop — freeze or slow both parties for 2–8 frames on connect. Heavier hits get longer stop.
  • Knockback — impulse vector plus optional gravity override. Scale with damage or enemy mass.
  • Hit effects — sparks, blood (rating-dependent), camera punch, audio pitch shift.
  • Combo counters — visible feedback that rewards chaining without obscuring enemy telegraphs.

Combos can be systemic (launch → juggle → slam with strict timing) or scripted (cinematic sequences). Systemic combos need juggle gravity caps and diminishing returns so enemies do not float forever. Always give the defender a clear out: combo break at high damage, air tech, or emergency dodge with long cooldown.

Enemy design and telegraphing

Player attacks are only half the system. Enemy combat AI must telegraph before dealing damage:

  • Wind-up animation — color flash, audio cue, ground marker for AoE.
  • Consistent timing — same windup always means the same active frame count.
  • Counterplay — every threatening attack has dodge, block, interrupt, or spacing answer.

Tie enemy damage and health to your difficulty curve: early enemies teach one mechanic per encounter; later mixes combine patterns. Boss phases often reset poise, change attack tables, or alter arena geometry — implement phase transitions as explicit state machine events, not ad-hoc HP thresholds buried in scripts.

Multiplayer authority and fairness

Online combat adds synchronization constraints. Common patterns:

  • Server-authoritative hits — server validates overlap and damage; clients predict visuals. Best for competitive integrity.
  • Rollback netcode — predict locally, rewind on mismatch. Demands deterministic simulation and fixed input delay budget.
  • Client-side hit detection with reconciliation — responsive but cheat-prone; acceptable for co-op PvE with server audit.

See multiplayer netcode for rollback vs lockstep trade-offs. Combat-specific rules: cap simultaneous hit events per frame, serialize random crit seeds from authority, and never let the client report "I dodged" without server-side i-frame validation.

Production checklist

  1. Define collision layers for player, enemy, projectile, and environment hit targets.
  2. Document startup / active / recovery frame counts per attack in a shared table.
  3. Implement one-shot hit registration per target per swing (hit ID or flag).
  4. Expose damage formula and status stacking rules as designer-editable data.
  5. Debug-draw hitboxes and hurtboxes in dev builds; record slow-motion replays.
  6. Playtest frame advantage on block and punish windows with fresh players.
  7. Profile hit detection cost — broadphase culling before narrow overlap tests.
  8. Verify i-frame behavior matches animation on all dodge and parry moves.
  9. For multiplayer, choose authority model before animating 40 attack variants.
  10. Balance early enemies to teach one defensive mechanic at a time.

Key takeaways

  • Hitboxes are gameplay, not art — tune offensive and defensive volumes independently of meshes.
  • Frame data is the hidden contract — startup, active, and recovery define fairness and skill expression.
  • Damage models should match progression — flat, scaled, and poise systems each teach different player habits.
  • Feel sells contact — hitstop, knockback, and audio matter as much as the HP subtraction.
  • Online combat needs early authority decisions — retrofitting server validation is expensive.

Related reading