How do I make npcs not get stuck in walls while pathfinding ?

0 favourites
  • 3 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hello, I was refered to post here. So basicaly, i have npcs who chase the players when they see him, the ai works great, since in the last few days I was fixing up bugs related to it. The only problem which remains is the pathfinding. No matter what I try, the ai gets stuck in the wall when chasing and turning, ex. I walk around the wall, and sometimes the npcs tries to turn on the corner, but instead goes too deep into it and gets stuck. I have tried - increasing the cell border, that didnt help, tried decreasing it - npcs went into the wall too much and still got stuck. The current solution I have - it does work, but it damages the gameplay. Basicaly I created sprites on top of walls called blockers and made that those sprites would have a path cost of 50. Now the ai usually doesnt get stuck, but instead it starts to "turn like crazy" sometimes when chasing the players when the npcs get near the wall. So, what is the best way to deal with this dilema ?

    Tagged:

  • Here's part one and two of something that should help you. Good luck!!!

    Subscribe to Construct videos now
    Subscribe to Construct videos now
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sounds like a cell sizing issue. If your pathfinding grid's cell size is larger than the sprite, then the sprite should never collide with a solid.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)