Video summary

Unreal Engine Hack & Slash Tutorial [2024] Series | Part 3 | Light Attack Combat

Main summary

Key takeaways

Technology

Tech/Gameplay Summary (Unreal Engine 5 Hack & Slash Tutorial – Part 3: Light Attack Combat)

Light attack basics (combo + reset behavior)

  • Light attack is implemented as a 4-hit combo triggered by Left Mouse Button.
  • If the player stops attacking, the system resets the attack state, allowing the combo to start again.
  • Direction changes are supported while attacking:
    • The character slowly rotates toward the movement direction as an attack plays.

Root motion distance “buffer/shove” (extra travel)

  • Adds a forward “buffer” effect during attacks to supplement root motion distance.
  • Conceptually adds ~10 Unreal units on top of the root motion movement.
  • Implemented using timeline-controlled movement that lerps the actor’s location forward over a short duration to cover the extra distance.

Input + attack state machine workflow

Finite State Machine setup (from previous part)

  • The previous tutorial established a finite state machine (FSM) and basic test attack input.
  • In this part, the test logic is removed and replaced with real light-attack logic.

Enhanced Input (UE5-specific)

  • Uses the Enhanced Input System:
    • Creates Input Action: “IAO Light Attack” and binds it to Left Mouse.
  • Notes: older UE versions would use a different, legacy input setup.

Light attack buffering system (to chain combo hits)

Core buffering idea

  • If the character is already attacking and light attack is pressed again:
    • The system saves the input (e.g., a boolean like P_SaveLightAttack) rather than instantly replaying.
  • A later animation moment consumes the saved input to trigger the next combo stage.

“Can Attack” gating function

  • Adds a CanAttack() function that checks FSM state with logic similar to:
    • “current state is any of …” and negates the result.
  • The player should NOT start an attack when in:
    • Attacking
    • Dodging
    • Dead
  • If the current state is none of those, attacking is allowed.

Playing montage sequence by index (1–4 combo)

Attack montage array

  • Uses an array like lightAttackMontages, containing an Animation Montage per combo hit.
  • Tracks an index variable such as LightAttackIndex:
    • Selects montage by index
    • Plays it
    • Increments the index
  • If the index reaches the end, it resets to 0.

Root Motion requirement for montages

  • Montages (e.g., Amont Light Attack 1..4) are created with root motion enabled.
  • Early testing issue: only the first montage played due to incomplete state/index reset and buffer logic.

Anim Notifies for consuming buffered input

Save-buffer notify (consumes saved input during recovery window)

  • Creates an Anim Notify Blueprint (e.g., AnimNotify_SaveLightAttack) that calls:
    • SaveLightAttack() when the notify is reached.
  • SaveLightAttack() behavior:
    1. If buffered input is true, clear it.
    2. Ensure the FSM is in an appropriate state for buffering (mainly Attacking).
    3. If valid, proceed to call LightAttack() (the montage-playing logic).

Reset state notify (allows attacking again when combo ends)

  • Creates another Anim Notify (e.g., AnimNotify_ResetState) to clear:
    • attacking state and relevant variables (e.g., reset attack index / “reset light attack”).
  • Without this reset notify, the character can remain stuck in Attacking state after the combo ends and cannot start again.

Notify State improvement (more forgiving buffer timing)

Why upgrade from a single Notify

  • A limitation with a single Anim Notify: buffered input only works up to a single point in the animation.

Anim Notify State approach

  • Upgrades to an Anim Notify State (e.g., AnimNotifyState_ModifyState / similar).
  • Uses Receive Tick to repeatedly call the buffer save/reset logic during a defined time window.
  • Benefit:
    • Player can press light attack any time between notify-state start and reset.
  • Tradeoff:
    • Receive Tick means repeated calls (performance concern), but the outcome is described as more player-friendly for buffering.

Animation feel tweaks (blend and rate scale)

  • Uses montage features to improve responsiveness:
    • Blend in / blend out for smoother transitions.
    • Rate Scale adjustments to control speed/responsiveness.
  • Reported result: lowering blend values and adjusting rate scale made attacks feel more responsive.

Directional rotation while using root motion

Notify State toggle

  • Adds an Anim Notify State to toggle something like:
    • Allow Physics Rotation During Anim Root Motion.
  • During selected parts of attack animations (anticipation/impact/foot steps), the character can rotate gradually toward the movement direction instead of being locked by root motion.

Rotation tuning

  • Uses Character Movement → Rotation Rate to control how quickly rotation catches up (e.g., adjusting to ~500).

Timeline-based “attack buffer” push (extra distance)

Timeline setup

  • Creates a Timeline that outputs an Alpha (0 → 1) over a short window (example mentioned: around 1 second, then tweaked).

Forward movement logic

  • During the timeline:
    • Performs forward movement using:
      • Forward Vector * (distance * alpha)
    • Adds this forward offset to actor location.
  • Uses sweep enabled for collision detection.
  • Downside acknowledged:
    • Can generate frequent hit results.
  • Calls “start buffer” right before/when the attack starts.
  • Calls “stop buffer” behavior:
    • Stops the timeline on reset state and/or when retriggering, preventing stacked movement.

Debugging guidance

  • Debugging tool:
    • Use Blueprint debug execution to watch orange execution lines during play.
  • Common mistake encountered:
    • Incorrect variable wiring/math and an incorrect length/index comparison prevented combo progression (fixed by correcting the condition).

Main speakers/sources

  • Primary speaker: “so what’s up guys…” tutorial author (not named in subtitles).
  • Source context: Unreal Engine 5 tutorial series by that author — “Unreal Engine Hack & Slash Tutorial [2024] Series | Part 3 | Light Attack Combat.”

Original video