2D Platforming path advice (vertical movement)

I’m working on a 2D platformer game (It’s using 2d physics a well). I have my basic point graph setup in the XY space and am able to have my AI follow a target on the x axis.

I am stuck and am looking for some advice on how to solve the following issue. When my AI is following a target that is above it, I want to figure out a way for it to find paths that include platforms it can jump up to reach the target. The issue I’m having is that my AI will just simply stop below the target. I thought one way of solving this might be to add some areas that include penalty’s so that my AI won’t want to try and go straight up towards the target. This somewhat works but then I still have the issue of trying to get my AI to “platform” itself up to the target rather than trying to just want to jump straight up empty space as you can see here:

Does anyone have any suggestions of how I can add some extra control to how my AI will want to follow a target vertically similar to my red arrowed path in the above image?

As I’ve continued to think about this, I had a thought. Does A star have any functionality built in for adding pathway nodes of a sort? For example I could put these nodes on edges of platforms to have it incentive the path finding to route through these nodes before it continues along it’s normal path?

1 Like

Did you ever figure this out? What about implementing this with a point graph?

Hey @TheHummingWanderer
I just finally found a solution that works for me a few months ago. I found this post by the guys that developed ‘Awesomenauts’, that talks about what they did for 2d platforming / pathfinding.

I’m not using A* the package at all. Instead, I built an editor tool that lets me visually build out a Graph with Nodes and Edges between the nodes. I then use Dijkstra’s algorithm to find pathways from a given Node, to a given destination Node.

I then have logic in a “Local Solver” on my bots that tell it when they should jump, etc. as the bot trys to follow a pathway of Nodes.

Hope that is helpful

2 Likes

Since I’m newer to pathfinding, do you think it would be wise to build off of Astar’s path algorithm? I was thinking I could use Astar’s Point Graph and then have specific nodes that tell the AI to jump. And then modify the movement script to detect lefts and rights to move in that direction, so hopefully when they hit a jump node they’ll just spring up with the velocity required for the jump.

I have my basic point graph setup in the XY space and am able to have my AI follow a target on the x axis.

This image shows a Grid Graph though.

A point graph would probably work much better for this. Though at the moment the A* package isn’t able to automatically place the point graph nodes for you, so you’d have to place these manually / write a script to place them for you.

Aron did mention he was working on better systems for 2D games like yours, though that hasn’t been priority for a little while.

1 Like