Download

Help: Jumping AI that always takes the shortest path to the player

Feel free to skip to the part that you want to read :slight_smile:

Introduction
Hi,
I am currently studying Game Design and I have to work on my own project over a period of 18 weeks. The goal of the project is to learn something new and to get out of the comfort zone. Since we only worked with Unity for two years Ive decided to pick up the Unreal Engine. I want to create a game on my own and learn how to work with Unreal and its Blueprint system.
To make it short: I am a Game Designer who wants to create a fast-paced Shooter. I have never worked with Unreal until Ive started with this project and I am not a programmer (but I do understand the logic behind it, Ive studied Computer Science for a year).

Whats the status of the project?
I have a simple prototype. I can run around, dash, slide and use a grappling hook. I have a pistol with animations working based on line tracing and with it I can shoot enemies and kill them. I have created my own point system which for example gives the player more points depending on how fast he is moving.
The AI behavior is really basic. Its a simple move to the player and if they are close enough to the player he recieves damage.

What do I want?
I would like to have a level with platforms on different heights. Similar to a level in the latest Doom. But the AI only walks on the nav mesh. So if as the player jump on a platform the AI has to take a longer path to take the stairs to reach my position. I want to find a solution for the AI to jump up (or down) on the platform to reach the player’s position faster.

What have I tried?
I started with searching on Google and Youtube for some tutorials or ideas to tackle my problem. But I wasn’t able to find anything good. Except for this series:
https://www.youtube.com/watch?v=wW4t5QxOQaE&t=1s
I have tried to recreate what the guy is doing two times but its never working for me. My AI always ignores the nav links and keeps running into the obstacle. Except I put a cage around it and the nav link is the only option to get out.
Thats why Ive tried to come up with my own solution (which is not working properly)

My approach
Since I couldnt find anything useful Ive tried to come up with my own solution. The idea is that I have my own nav links (or Jumping Points) for the AI that I place on all the positions where it makes sense for the AI to be able to jump up and down. But the AI still needs to know when to take the jump. To find out there are a lot of calculations running in the background. The jumping points (for now on JP) are recieving the distance to the player and the AI is recieving the distance to the JP. They are both added up and then compared with the path length of the AI character to the player. If the distance from AI -> JP -> Player is shorter than the path length the AI will go to the JP and use it. If not it will take the normal path.
But there are some problems.
The first one is that the AI is not always taking the shortest path. Sometimes they do jump but it makes no sense to do it. But thats probably just a mistake in my Blueprint. The bigger problem is the performance. I already assumed that its going to take a hit but its worse than expected. The calculations have to be done for every AI character and for every JP that Ive placed in the level and thats just too much. On my PC Im running the prototype with 120 frames when there are 1-4 enemies. As soon as I reach around 10 the frames drop to ~90 and if there are about 30 enemies in the game the frames drop to ~50 with some hickups.

My Question
Does someone have an idea how I could fix my solution? Or is there a better and easier way to solve my problem?
Keep in mind that I am not a programmer so I cant do anything in C++.
If there is a free plugin that would solve everything let me know. I might be able to convince my teachers that I can use it (since AI is not my main focus of the project).

And if there is no easy solution I will have to go for plan b I guess.

Thanks for taking your time :slight_smile: