Cthulhu game: better path finding

I just finished to implement a better version of path finding for my cthulhu game.

The basis is still based on A* but i add some additional steps to make the path used by hostile smoother and clever: I describe my enhancements in drawings below:

  1. The first drawing explain the real situation: you have one hostile located at point A. This hostile is modelized as a rectange (the collision area); The hostile need to reach point B behind a wall.
  2. The second drawing explains a path finding result using A*. A* is based on tiled so you will have a tiled vision of the path to used to reach point B. But remember, our hostile is a rectangle on a map with x,y coordinates and not integer tile indices.
  3. My first enhancement take A* tile path result and remove unecessary tiles (see third drawing) to keep only turn points.
  4. Then i do some additional process to compute real points (x,y coordinates) which takes care of hostile collision area and mnimizes the path regarding turn points.

The result in action:

  • M

    Can you post your a* pathfinding/following code? I am a student currently working on a libgdx project and would like some help with the pathfinding/following. Game looks pretty fun.

    • Hi
      Ok i will see how i can extract something for you. Have a look to A* on this article: this will give you an understanding on how it is working: http://www.policyalmanac.org/games/aStarTutorial.htm

      • M

        I have pathfinding implemented but my AI tend to get stuck around objects…I am more interested in your following the path code. That would be much appreciated since it looks so smooth 🙂

        • OK i will try to post something for this week end. Glad to help 🙂

  • m

    Can’t comment on the last post for some reason, but thank you, it is very informative!