Jumping AI

Hello!
I want to make my AI to be able to jump. I’ve read several threads, and tutorials about it, but didn’t really find what would satisfy my needs.
I think it should be pretty simple, but I don’t know where to touch, and it’s not very well documented…
Needs are:

  • I would not like to rewrite the whole pathing system, only extend it
  • I would not like to use NavLinkProxies, because if I had to, I’d have to place really lot of them, would scatter the terrain, and would be horrible
  • I want to make destination position to be in the air( can only be reached by jumping. Like coins that need to be picked up )
  • I would not like to modify the engine source. Only extend it by custom components, or some way…

My idea:

  • Modify the path finding algorithm, so when it’s checking if you can move from one segment to another, it will take account the character step height + the jump height( * 0.75 ). Basically, From path finding perspective I would like to enable the path to go through objects which can be jumped on
  • Preferably save this as a flag in the path. It would be nice to remember on which segment do my character have to jump in order to reach the next segment. It’s not necessary, but would be nice, if I could do this.
  • When following the path, the AI checks if it needs to jump( by the saved flag, or calculating on the fly )
  • Allow them to fall down of a ledge, if the path finding requires it. If there is a navmesh beneath the current object, it can fall down. Currently the AI stops on ledges

And basically that would satisfy all my needs. It doesn’t need to be super smart, doesn’t matter if they fail sometimes, falling down.
Can anyone please point me on the right direction? Currently I don’t know which classes and functions to override

Sorry for the bad english, thanks in advance

Hey, while it would be easy to modify the NavMesh path-finding to take jumping height into account, it is a whole different beast to actually tell the AI when to jump and when not to. A simple bool wont work for a few reasons.

Unreals system basically uses NavMesh and NavLinkProxies to allow you to implement this stuff. You could use EQS to scan the level around you and place NavLinkProxies dynamically. You could check the Engine/Source/Runtime/AIModule and Engine/Source/Runtime/Navmesh for all the additional classes involved in this.

For open worlds or at least big worlds like yours, I think the best solution would be to implement your own path-finding. One thing that could work is a sparse voxel octree instead of a NavMesh. You could check if the neighbouring voxel is reachable, if it is below or above the current location and if is safe to drop or close enough to jump up.

Thank you for answering.
My world is far from big, it’s rather small, so performance should not be a real concern. Problem is, I can’t really think of a method placing NavLinkProxies correctly. I mean, you can jump over crates from around every point of the geometry, if it’s close enough.
Also, I have floating things what are needs to be reached( power-ups, coins to pickup ). So sometimes, I need the AI to move to the projected location of the target, and then jump.

Implementing a new pathfinding would be overkill in my opinion, but maybe I’m wrong.

Is it possible to modify the current nav-mesh pathfinding? Without modifying the unreal source code? I don’t know which class to override…

Also, if I need to implement my own pathfinding, how would I start doing it? How to override the default pathfinding?

Thank you :slight_smile:

Hey Honya!

I believe this is what you are looking for: https://wiki.unrealengine.com/AI_Navigation_in_C%2B%2B,_Customize_Path_Following_Every_Tick

At least it will point you in the right direction :slight_smile:

If needed you can also modify/change the existing Pathfinding (or Navigationmesh) from Unreal but it is a bit complicated.
I have some experience on this topic so if you have any further questions feel free to ask! :slight_smile:

Good luck,
Elias

PasteDog posted Rama’s solution for this problem, pretty sure it can help you.

Maybe I’m just stupid, but I can’t seem to find where the pathfinding happens. Found this article before I asked questions here, but it only talks about BEFORE the pathfinding( processing the level geometry ), and AFTER pathfinding( following path ).
Where does the pathfinding happen? The best would be if I could override a function which takes 2 points on the navmesh, and expects a bool return value, which tells the pathfinder that is there an obstacle between these 2 points.

Could you please tell me where should I look if I want to modify the pathfinding algorithm?

Hey, the pathfinding is by the RecastNavMesh (ARecastNavMesh) and also calls something along the lines of PImplNavMesh where the actual path calculations happen.

I can not really look inside the code right now because I am on holidays :slight_smile:
I can help you better as soon as I am back!

Happy reverse engineering! :slight_smile:

I know sounds stupid but it works for my 2d platformer, I’ve made triggers on the edge of the platformers and they are triggered when spesific enemy overlaps. I used launch character node and make z velocity something like 500(depends on your height of the character) and it works for me.

I did this just by tunning the Recast Navmesh options: UE4 Jumping AI - Follower Bot - YouTube

I achieved this just by modifying some recast-navmesh parameters: UE4 Jumping AI - Follower Bot - YouTube

You don’t need to do that. I achieved this just by modifying some recast-navmesh parameters: UE4 Jumping AI - Follower Bot - YouTube

My take on the subject is this:
AI needs to get to the player that is shooting it from place unreachable by path finding. AI runs EQS that finds spot closest to player that can be navigated to and still within max jump range. Then just goes there and uses LaunchCharacter with SuggestProjectileVelocityCustomArc.
Ends up with no nav mesh around but after dealing with player it can use same technique to jump back.

Yeah, I know. You’ve posted it twice already without providing any details on how it’s .

Pathfinding is not just about following player, but to getting from one point to another. Like jumping over an obstacle, and continue to your goal

Could you tell us the specifics of this “naive code” you made?

I’m very interested

What parameters are you altering, and what native code did you add?

Hi!

Here is the tutorial on Jumping AI without Nav Link Proxies neither other kind of Helper Actors or classes.

Just pure and simple Nav Mesh: UE4 Jumping AI - Follower Bot Tutorial - YouTube

Hi!

Here is the tutorial on Jumping AI without Nav Link Proxies neither other kind of Helper Actors or classes.

Just pure and simple Nav Mesh: UE4 Jumping AI - Follower Bot Tutorial - YouTube

Hi!

Here is the tutorial on Jumping AI without Nav Link Proxies neither other kind of Helper Actors or classes.

Just pure and simple Nav Mesh: UE4 Jumping AI - Follower Bot Tutorial - YouTube