In my game I am working on a boss-fight enemy that traverses via straight lines between preassigned goals. What goals they can traverse to is preassigned based on each goal being reached. Now comes the tricky part. I wanted to try to make the boss less boring by removing the randomness and making the boss choose goals that were in the direction or closest to the player, but this rarely works and ends up going right back to being random anyways, so now I’m left trying to figure out how I can performantly calculate paths between accessible goals that allow the enemy to get to the player’s location.
This image, while crude, shows roughly what the set up I have is. The green lines represent paths the enemy may take as long as they’re at the goal. So for an example, if the player is down on the bottom left while the enemy is at the top right, how can I make a function that picks out which goals go where and finds the shortest paths, randomly choosing between those?
And, if this is too complicated of a system for something trivial, is there another approach I could take? Perhaps the direction system I had in mind? But if so, how can I only find goals that are in the direction of and closest to the player?