Discussion about Perfect Parrying System


Hi, here is a discussion about Perfect Parrying System which is inspired by Sekiro. I'm glad to share with you how to implement this system.

As in Sekiro, you will ignore attack damage if you defend when an enemy attacks, but your posture gauge will increase. Whenever your posture gauge exceeds the maximum value, your defense posture breaks, and you will suffer damage. 

 

By deflecting an enemy attack at the correct moment, you will be able to ignore the attack damage and increase enemy posture gauge. Once enemy posture gauge reaches the maximum, the player can execute the opponent as shown in the trailer :

To understand how to realize this system, let's take a look on Sekiro : 

If we press the Defense button(Right mouse) quickly and repeatedly, we can see that Sekiro's katana will keep shaking. This is due to the interaction of two animations : pick up Katana and put down katana which are in our Animation blueprint BeginParry and StopParry :

When we press the Defense Button(Right mouse), our character will not immediately pass to Defensing State. He will pass firstly to BeginParry which our character pick up his katana. At this state, you can define in your animation the scope of perfect parry with animation notify event. 

If the enemy attack is so quick and you need to respond as quickly as possible. At this time, you have to quickly release your Defense button(Right mouse) and quickly press back the Defense Button before the katana put down totally : 

That's why we need here an put down katana animation. This allow our player to pick up quickly(and repeatly) the katana as fast as possible. If we passe immediately to Idle state after release Defense button, it takes too long on taking the katana back. We can surely increase the speed of animation to solve this problem, but in this case the animation transition will become unsmooth. 

There are still works on our blueprints. When the player parries an enemy attack, the behavior of the enemy varies. This depends on the parry state(Enum) of the player which are : ParryStart, ParryEnd, Defensing, None. Those states will also have ParryResult which are Perfect, Normal, Fail as ParryResult(Enum).

Let's define an interface names Parry where we have 3 functions :  

  •  GetParryState :  Use to get the parry state of the Player when enemy is attacking the player
  • SetParryState :  Use to set the parry state when the Player picks up katana(ParryStart), remain defensing after pick up(Defensing), release pressing(ParryEnd) and None.
  •  ExecuteParry : reaction of the player by different ParryResult

Here is the logic :


 In response to an attack on the player, we check the player's ParryState. In the case of ParryStart, we run ParryResult.Perfect. The ParryResult.Normal is executed when it is Defensing. Otherwise, Parry.Fail is executed. It will become apparent how to proceed from there. You can use Switch to handle different ParryResult or another way as you like.

Here, our system of Parring is done.  I hope this can inspire you in creating your own game. I appreciate you taking the time to read this.

Files

MansFirstDual.zip 158 MB
May 23, 2022

Get Man's first dual

Leave a comment

Log in with itch.io to leave a comment.