A* path finding being slow

This isn’t a question about making an A* path finder, I already have one I made for my game, the only problem is it takes a bit of time to process paths around hook shaped objects, all I’m doing is looping through the last tiles I added and then branching out like explained on Wikipedia, is this a common thing for A* or should I optimize it

I don’t know if this will look right but here is the shape I’m talking about, P is player X is the clicked spot


......................................................
......................######.........................
..................###.................................
...P.........##....................X................
..........##........................................

If that hook is a static part of the terrain you can do what some people refer to as waypoint or point of view pathfinding. That is you place a “waypoint” or marker at the top of the hook, or at some gap. If you want to go “through” the hook, you then first A* to the way point (which should be pretty quick) and then once you are at the way point you A* to your target on the other side.

Google “waypoint pathfinding” or “point of view pathfinding” for more information. I haven’t done much with pathfinding only read about it.

Thanks, I’ll try that

If done correctly, your A* algorithm should expand the following nodes. ‘e’ marks nodes that were explored. ‘v’ marks nodes that were visited. You can further improve efficiency on static square grid spaces, but those obstacles aren’t that bad for the vanilla algorithm to work with every once in a while millisecond (or less).


......................................................
............eeee......######..........................
...eeeeeeeeevvvvee###eeeeeeeeeeeeee...................
..ePvvvvvvvvv##vvvvvvvvvvvvvvvvvvvvX..................
...eeeeeee##vvvveeeeeeeeeeeeeeeeeee...................

Thanks guys, I realized that I had a for loop checking every single tile thousands of times if My A* path finder had logged that coordinate already, I ended up adding some debugging stuff to highlight tiles visited and I realized what was happening, now it works flawless with no wait