Ai decision making

so, here is my game again

so the enemy character is the ghost named “bonhomme”. he chases after the player (homme) through the castle.

what i need is some way for the bonhomme to decide based on his surroundings where to move

hell raycast the four surrounding walls and see which ways he can potentially go to (he cant clip thru walls ofc) and then based on the homme’s position decide to move in his directions

i dont have much idea on how to make it compare its possible options to the most optimal chase movement, but id like to hear from a more experienced coder on how they would go about this

1 Like

So just to be clear, you want the ghost to move in the shortest path from it’s current position to the player?

1 Like

yeah, it just needs to be able to evaluate movement options and choose the one that would put it closer to the player