I am trying to simulate an intelligent player using Arongranberg’s astar pathfinding that runs away from enemies strategically. I haven’t found a good way to do this.
path finding is just what the name describes, it’s an algorithm to find a path to a certain destination, taking into account the physical environment (avoiding obstacles etc).
the way i understand your use case from the rather bare-bones description of what you want to be able to do, I think you should really just calculate a destination point that lies behind your character (as viewed from the enemy view) and use a generic a* implementation to path find and navigate to that destination. that way you will always run away from the enemy.
if you need something different, don’t mind going into some more detail, it will help you get more qualified answers.
Ok, I figured it out. For anyone else who wants to accomplish this, here’s what I did: I created 6 raycasts around the player and set the astar pathfinding target to the one with either the farthest or to the raycast with a non-existent obstacle. This made the ai flee from an enemy while still using obstacle detection. It’s not perfect, but its the best solution I could figure out.