Advanced 2D&3D AI Jumping

Godot Version

4.2 - 4.4

So i was never able to find a proper tutorial on 2D advanced AI jumping, even tried searching for just the logic, no matter the engine. It all was either too simple, where an enemy jumps in front of a wall, or a gap, or if the player is above them. Or too complex. So i’ve come up with a pretty simple and powerful way to achieve that and even more using NavigationLink2D.

I was able to make my enemies jump, fall down one-way platforms and even climb ladders. All that was only happening if a navigation path decided that it needed to do that in order to reach the target, no hard coded stuff.

Further details are in the video:

This logic can easily apply to 3D environments too.

4 Likes

This is great! Thank you for sharing this.

I also faced similar issues of not finding a solution for my companion AI in a 2d side scroller I was working on. Most tutorials are for topdown games.

I ended up with a very similar solution to yours, but I discarded it because it was a lot of work setting it up for large levels, especially when I needed to iterate on the level.

Another method I used in addition to this is to add navigation instructions to specific tiles in a tilemap that pass commands to agents on it. The combination of these two really worked well but was not scalable for the kind of game I was working on.