Guide

Game melee combat systems explained

Harbor Ruins shipped its first dungeon with sphere overlap checks at the sword tip. Attacks connected through walls, whiffed on enemies standing beside the blade, and heavy swings felt identical to light jabs because every move used the same single-frame probe. Playtesters called combat “floaty and unreadable.” The refactor replaced point overlaps with arc sweeps along the weapon path, added a poise meter that gates stagger, and introduced a soft lock-on that eased camera rotation without snapping aim. Close-quarters fights became legible: you could see why a hit landed, when a boss would flinch, and how reach differed between daggers and halberds. A melee combat system is the specialized branch of general combat that resolves attacks within arm’s reach — where spatial geometry, timing windows, and weight classes matter more than ballistics or reticle spread. This guide covers hit detection strategies, frame phases, poise and knockback, lock-on and spacing, weapon archetypes, enemy telegraphs, multiplayer authority, the Harbor Ruins refactor, a genre decision table, pitfalls, and a production checklist. For chaining attacks once a hit connects, see combo systems; for survivability math, see health and damage.

Melee hit detection: more than a sphere at the tip

Ranged combat often reduces to a ray or projectile path. Melee must answer: which volume did the blade occupy during its swing? Common approaches:

  • Static overlap at active frames: spawn a box or capsule at the weapon mesh for one or more animation frames. Cheap, but misses fast swings and curved arcs unless you sample many frames.
  • Sweep tests: cast a shape from last frame’s pose to this frame’s pose along the weapon bone. Catches motion between ticks; standard in action games and fighting engines.
  • Animated hitboxes: keyframed volumes parented to bones, toggled per frame in data. Highest authorial control; used in fighting games and precision souls-likes.
  • Physics queries: enable colliders on weapon meshes during active frames. Flexible for physics-heavy games but noisy for deterministic netcode.

Pair every attack hitbox with defender hurtboxes — usually larger, persistent volumes on torso and limbs. Head hurtboxes may take bonus damage; limb hurtboxes enable partial parries or armor plating. Document layer masks so environment geometry never absorbs hits meant for enemies.

Frame phases still matter

Even without fighting-game frame counts, melee attacks decompose into startup (wind-up, vulnerable), active (hitbox live), and recovery (endlag, punishable). Short active windows with clear startup telegraphs reward reads; long active frames on spin attacks trade safety for coverage. Track these phases in data tables so designers can compare light, heavy, and special moves without opening animation files.

Poise, stagger, and knockback

HP alone rarely sells melee impact. Three parallel systems shape how hits feel:

  • Poise (super armor): a hidden or visible meter depleted by incoming hits. While poise remains, the defender continues their animation; at zero, they enter stagger. Bosses often regenerate poise between phases; trash mobs break on first heavy hit.
  • Hitstun and stagger states: brief lockout where input is ignored or limited to dodge. Stagger length scales with attack weight and may open critical-hit windows.
  • Knockback and launch: displacement vectors applied on hit. Grounded knockback slides along the floor; launch arcs enable juggles in brawlers. Clamp knockback so characters do not clip through level bounds.

Tune these systems together: a heavy attack should deal more damage, drain more poise, and push farther than a jab — but not always. Some games decouple damage from stagger so defensive builds can trade chip damage for posture breaks. Expose tuning knobs per weapon class and enemy archetype in spreadsheets, not scattered constants in code.

Blocking, parrying, and i-frames

Directional blocks require facing the threat; omnidirectional blocks simplify mobile play. Parries are narrow timing windows on block input that stun attackers and may skip poise math entirely. Invincibility frames on dodge rolls trade stamina for temporary hurtbox suppression. Melee readability improves when each enemy attack has a distinct wind-up silhouette and SFX cue tied to its active frame start.

Spacing, lock-on, and weapon archetypes

Melee is a spatial game. The player constantly manages distance relative to enemy reach, arena hazards, and allies. Two camera/aim models dominate:

  • Free aim: player controls facing directly. High skill ceiling; best for character-action and musou titles where crowd control matters.
  • Lock-on: soft or hard target snap with strafe orbit. Improves readability on controllers; risk of camera wall clipping if not smoothed.

Weapon archetypes give players intuitive reach/risk trade-offs:

  • Fast/light (daggers, gauntlets): short reach, low poise damage, fast recovery; wins on aggression and punish windows.
  • Balanced/medium (swords, maces): moderate range and stagger; default baseline.
  • Slow/heavy (greatswords, hammers): long wind-up, high poise break, wide sweeps; loses on whiff.
  • Pole/reach (spears, halberds): keep-out zones, weak at close range; encourages spacing skill.

Animation root motion must agree with hitbox reach: a spear thrust that slides the character forward three meters without moving the hurtbox forward feels dishonest. Align input buffering so dodge cancels and attack cancels respect the same phase data your animation graph exposes.

Worked example: Harbor Ruins melee refactor

Harbor Ruins is a third-person dungeon brawler with eight enemy families and three playable weapon stances. The original combat module used a single sphere overlap at the weapon tip on frame 12 of every attack. Problems surfaced in week-two playtests:

  • Diagonal enemies beside the player took hits without visual contact.
  • Greatsword heavies shared the dagger’s reach because the probe offset was identical.
  • Boss armored phases ignored light attacks with no feedback beyond tiny HP ticks.

The refactor shipped in three passes:

  1. Sweep hitboxes: each active frame stores bone transforms; physics sweeps a capsule along the blade edge. Per-weapon reach tables define capsule length and radius.
  2. Poise layer: enemies and players have poise pools. Lights drain 10–20 poise; heavies drain 40–80. At zero, a 0.6s stagger opens riposte damage ×1.5. UI shows a subtle posture bar on elites.
  3. Soft lock-on: holding L2 eases camera toward the nearest threat within 120° and 8m, without hard snapping aim. Strafe orbit speed scales with enemy size so ogre fights do not induce motion sickness.

Metrics after the patch: whiff complaints dropped 62% in survey tags; average encounter length on the tutorial gauntlet rose 18% because players engaged longer instead of kiting with thrown pots. QA still tracks edge cases where sweep tests hit through thin floors — fixed by excluding environment layer from melee masks unless attacks are explicitly ground-slams.

Genre decision table

Genre pattern Hit detection Poise/stagger Lock-on Combo density
Souls-like action RPG Per-frame animated boxes Core mechanic Soft lock optional Low–medium
Hack-and-slash musou Wide sweeps, multi-target Light; crowds rarely stagger Free aim preferred Medium; cancel chains
Character-action (DMC-style) Sweeps + juggle volumes Juggle + launch states Free aim High
2D/3D brawler Lane-scoped hurtboxes Hitstun focused Implicit facing Medium; juggle caps
ARPG (Diablo-like) AoE cones/arcs Minimal Click-to-target Low; skill rotations
Fighting game Frame-perfect data Hitstun/blockstun Fixed facing Very high

Multiplayer and accessibility notes

Authoritative servers should validate sweep endpoints and timestamps, not just “I hit” RPCs. Roll back or delay hurtbox activation by measured latency for PvP; PvE can remain client-authoritative with server sanity checks. For accessibility, offer optional auto-target soft lock, generous dodge i-frames on easy mode, and clear color-independent telegraph shapes (silhouette + audio stamp). Training rooms that show active hitbox overlays accelerate onboarding without flattening difficulty curves.

Common pitfalls

  • Single-point probes: fast weapons and wide arcs need sweeps or multi-sample overlaps; one sphere at the tip is almost never enough.
  • Reach mismatch: animation slides the character without moving hitboxes; players learn to distrust visuals.
  • Poise without feedback: invisible super armor feels like broken hit detection; show flinch VFX or posture UI.
  • Identical weapon classes: if dagger and greatsword differ only in damage numbers, build diversity collapses.
  • Camera fights lock-on: hard snap through geometry causes nausea; ease rotation and widen collision-aware orbit.
  • Stunlock loops: infinite poise break on players without escape options reads as unfair; add dodge invuln or diminishing stagger.
  • Netcode afterthought: bolting replication onto sweep-heavy combat late produces phantom hits; design authority model early.

Practitioner checklist

  • Choose hit detection method (sweep, animated box, physics) per weapon and document in data.
  • Define startup/active/recovery frames for every attack; expose in designer tables.
  • Implement poise or stagger with clear break feedback and recovery windows.
  • Tune knockback clamps and launch arcs against level geometry bounds.
  • Author weapon reach, arc width, and poise damage per class; playtest spacing.
  • Wire block, parry, and dodge i-frames with distinct SFX/VFX telegraphs.
  • Pick lock-on model (free, soft, hard) and test on controller at 30 and 60 FPS.
  • Build training overlay showing hitboxes/hurtboxes for QA and advanced players.
  • Validate multiplayer sweep timestamps on server; log desync rejects.
  • Regression-test thin geometry, diagonal enemies, and multi-hit sweep duplicates.

Key takeaways

  • Melee hit detection must follow the weapon’s motion path — sweeps and animated boxes beat single-point probes.
  • Poise, stagger, and knockback sell impact beyond raw HP damage and define risk/reward per attack weight.
  • Weapon archetypes need distinct reach, timing, and poise profiles — not just different damage coefficients.
  • Lock-on and camera easing improve controller readability but must respect geometry and player motion comfort.
  • Readable enemy telegraphs tied to active frames are the cheapest upgrade to melee fairness.

Related reading