Week 7 Part 1 - AI Pathfinding NavLink

AI Pathfinding NavLink

After last week's class, we will start working on putting together our research for each part. In addition, Anthony and I discussed how to solve the problem of the AI needing to go up stairs or steps in AI pathfinding. So, that's what I'm mostly working on this week.

At the beginning of my research, I found that among the functions of NavMesh. It can calculate a route for AI to go through a landslide, but the angle of the landslide can only be 0-60 degrees. When the landslide exceeds this range, NavMesh will no longer be able to provide a feasible route for the AI (it will be regarded as a wall).

The second is the steps, whether it is going up or down. NavMesh itself cannot provide a feasible route for AI. It means that if the AI's route needs to go up/down steps, it will just stand in place until it calculates the next feasible route.

At this time we can use another function in Unreal which is NavLink. This function can tell our AI that there is a path between two points. For example, if the AI needs to go down a step, we only need to place a NavLink and place its two points on the top and bottom of the step. At this time, our AI knows that there is a path to go between these two points, so it will choose to jump down the steps and continue on the path it originally had.

But such an ordinary NavLink can only help our AI know that there is a path to walk between two points. But it does not mean that it will take corresponding actions in the situation between the two points. For example, if the AI needs to jump up a step, and there is indeed a NavLink connection between the two points. It does realize that there is a path over there but it doesn't choose to jump up the steps. 

So, extending from here, we need to make a corresponding modification to our NavLink and AI Character.

Implement Explanation

1. First, created a Nav Link Proxy and place two endpoints on where we want AI to go. Just by doing this, the AI would already understand that there is a path between the step shown in the graph. So, it would go down the step when it reaches to the Nav Link point.

2. Further, if we want AI to jump on the step between two Nav Link points, we need to make a blueprint for the Nav Link and use a function called Event Received Smart Link Reach. (Note: We also need to turn our Nav Link into a Smart Link in the detail windows of the Nav Link). Then we need to create a blueprint interface for our AI character to call this function in itself.

Sending information when AI reached the Nav/Smart Link
Nav Link turn on the Smart Link function
Nav Link Blueprint Interface

3. Finally, we need to give some kind of behavior to our AI for it to act when it reached the Nav/Smart Link point that we set. The main action we want the AI to act is to jump, so we used the Launch character node in a blueprint to simulate the jump action. The rest of it is just some math calculations of a starting XYZ position and ending XYZ positions.

Demo


Relevant problem that I have

So, I did some more research on the NavLink to see if it could also be dynamic which is run in real-time when the game is running. Unfortunately, there is no easy method like turning on some dynamic settings like NavMesh. If we want to use NavLink dynamically we would need to go on the hard way which is making AI realize what it was surrounded by and how it would need to react to the environment.

Thus the NavLink that we have right now needs to be preset before the game start.

Comments