Advanced Grapple Hook System - Using Unreal Engine 4 (Sekiro Style)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone today we are going to look at an amazing game mechanic which is created by the developers of secure shadows type twice of course i'm talking about iconic grapple hook which provides an awesome way of navigating sakiro's beautiful game world this scrapple huck does not only provide different way of navigation but it also provides a new aspect to the gameplay for an example players can use this as a way to engage in stealth gameplay or it can use to escape from a difficult enemy encounter or players can use this grapple hook in combat gameplay such as reaching above enemies and performing in aerial takedowns now that you know the purpose of the grappling hook let's break down how developers actually implemented this system in sakiro first and foremost player can only grapple with their inactive grapple points these grapple points are displayed in user as circle points based on players current location there can multiple number of grapple points which are manually placed by level designers in order to support game play but after quick analyze i found out that a particular grapple point can only be activated at that point met with certain conditions first the grapple point should be within a specified range based on player's location if it doesn't match that range then it shouldn't be considered as a possible grappling point even if a grapple point is within that range it should be the closest point to player's point of view and the angle between that point and player should not exceed certain angle and finally in order to grapple that particular point player must be within unspecified grappling range sakiro communicates these conditions from the user interface with the help of a circle point indication first this circle point appear if a particular point is a possible grappling point if it's not within the player's field of view the circle point provides an off-screen indicator to indicate grapple points location in the world so player can quickly make decisions also it provides hints about the grappling distance by filling up the circle and if it's filled up completely then you can grapple apart from that circle point indication changes its state to plot if the line of sight between player and that grappling point is broken in order to implement actual grappling mechanic first we need to create the grappling points system so let's get into unreal and start working on that first open up standard third person template because it automatically sets up basic character movements first thing i did was creating an object channel called grappling project settings because then it's easier to find and interact with only grapple points then i needed to find a way to query possible grapple points after quick research i found out that there are multiple ways of detecting grapple points around the world such as multi-sphere tracing or using collision sphere but i went with making a grapple container which is basically an actor with a collision box and it store all grappling points within that box range in this way level designers also have much freedom to do whatever they want with grapple points next thing i did was creating an enumerator which holds every possible state of a particular grapple point then i created an actor called grapple point and implemented a system which keeps track of the distance between grapple actor and the player based on calculated distance i called a function to update its state between activated or deactivated now it's time to make circle point widget we call this says target widget i quickly made some circle images using photoshop and created a simple material to fill up the circle when it needs then i added up those elements to the target widget and wrote a function to handle the filling of the circle after that i created in another widget as the parent widget of the previously created widget this widget handles the off-screen indicator and the rotation of directional arrow towards selected grapple point just like in sikiro implementing an off-screen indicator was kind of difficult and reduce performance if it was done completely in blueprint especially when need to run it on every tick because it involves heavy math calculations after doing some search i found a c plus plus solution on unreal engine forums provided by nepeter which handles off-screen indicator and it was also exposed as blueprint node this was the perfect solution for this problem by using that function i set target widget location on canvas and provide values to arrow indicator to rotate it properly after completing widget setup i moved into third-person character blueprint to implement the grapple point detection system first thing i did was using it for each loop i filtered all the grapple points based on previously stated conditions by doing so i was able to get the most appropriate grapple point which player might consider to grapple after that i saved its location into a variable for later use then i created target point widget and added it into the viewport next i use previously saved location of grapple point and set it as target widgets location which used to as an input for off-screen indicator function this way i was able to move targeted widget to the position of the selected grapple point but in a 2d coordinate plane then i called fill distance function to fill the circle based on the distance to player with selected grapple points and finally i changed selected grapple point states who can grapple if all the conditions are sufficed and made it deactivate if even one or more condition fails now we have handled selected grapple point states but we also need to check if we are already grappled to a different grapple point or not this means we have to manage states of current grapple point as well using same logic which use with selected grapple point i have also managed current grapple point states as well finally let's do a test to see how our grapple points system works here how it looks now now that our grapple point detection system is up and running let's try to implement the actual grapple movements if selected grapple point state is set to can grapple then pressing f key triggered the grapple movements first thing i did was snap characters rotation towards the selected grapple point then obtain the angle between character and selected points i use this variable in animation blueprint to make character bend towards upper town based on grapple point location next thing i did was adding cable component to the character this cable component acts as the rope of the grappling hook and finally i set a prop length based on distance between player and selected grapple point then played an animation on target point widget to indicate that player is currently grappling selected grapple points let's just take a break from coding for a while and take a look how shaqiro's grapple movement works especially how grapple animations are handled [Music] when we look at shakiro's grappling animations there are three animations for three possible states which are grappling from ground to higher point in character grappling from ground to lower point in character and finally grappling in mid-air sadly there were no good-looking grappling animations to find anywhere and i'm still a beginner at animating characters so what i did was downloaded multiple animations from different actions from mixomo and combined them into one animation montage in unreal and made adjustment to make that animation actually look like grappling and i did this for all three grappling states as you can see in sakiro the distance traveling when grappling must sync with the grappling animation in simple terms when grappling animation starts character should start to move and whenever animation is finished character must be in the target grapple point location which means we have to adjust scrapple movement speed dynamically based on grappling animation once it's done i created two custom animation notifies one is used to start grapple movement and it also has a variable to set the duration of the grappling animation which we can use later we can set this variable manually because different grapple animation have different movement durations another notify is to start rope movement and it also has same logic regarding the duration finally i call these notifies on animation montage at the right time first we handle how ropes should work when character performs grappling when rope movement notify fired first we detach end point of the robe from its parent and lurp it to the grapple point location using a timeline note that we use duration as signed by animation notify to set the play rate of the timeline once rope reaches the end point we reverse the timeline to tuck the rope back to our character and finally we reattach rope component to pair and components [Music] next i added a spline component to character this component provides ability to create a spline path at runtime using an array of locations when grappling in sakiro character follows a projectile path from current location to grapple point location to simulate that first we determine the suggested projectile velocity to reach the grapple point from the current location under no gravity this gives us a velocity which can be used as input to predict projectile path node this node also used trace by object channel to determine if projectile path hits the grapple pointer knob this spits out array of locations along the path which can be used to create in spline path using spline components and finally detach spline component before starting the movement of the character to avoid unnecessary movement of the spline component with the character the final step is to loop the character along the spline path for this we use a timeline with an adjusted play rate from the animation let's use a curve to make movement faster start and getting slower on at the end of movement we use this curve to get an alpha value which used to select points along the spline path and then setting character location to those points in order to move characters smoothly finally at the end of the movement reattach spline component and set gravity scale to its default values i extracted same sound effects from sakiro and attach those sound effects on all grapple animation montages finally let's look how our grapple system turn out to be [Music] i have only explained how core mechanics put together in this system the project source code is well documented and easy to understand so if you want learn more you can download the checks from github and feel free to look at the code thank you for watching if you learned something new or like my content support me by liking this video and subscribing to my channel what the mechanic breakdown would you like to see next let me know in the comments down below see you guys from the next video
Info
Channel: ThatsUnreal
Views: 22,067
Rating: undefined out of 5
Keywords: Grappling System, Grapple In Unreal Engine, grappling hook, grapple hook sekiro, grapple ue4, grappling hook games, game design, unreal engine, tutorial, game dev, unreal grappling hook
Id: VHyG4EhyLEM
Channel Id: undefined
Length: 13min 18sec (798 seconds)
Published: Wed Nov 11 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.