# Navigating an AI that shouldn't take the shortest path but the scenic route instead (e.g. fish)

I'm working on a sidescrolling game with an underwater "fish-like" AI that has some goals (interacting at various locations) and things to avoid (player).

1. Started of with a Navmesh and simple straight line navigation but since algos like A* always take the shortest path what ends up happening just doesn't look good.

1. To solve this, I thought I could add some random area penalties to the navigation nodes (currently a grid). I generated these penalties using perlin noise, which did curve the path, but the effect is very minor, because again A* does not like to deviate from a straight line even with big penalties. If you make them too big, it's gonna act like obstacles, which isn't very usable either.

1. So the question is - how do I achieve something like this?

Thanks

• I am not sure if NavMesh is the way to go then (in it's out of the box state). Did you try to add more than just one position, instead of going from start to end, keep multiple points (like an array of points) that your fish has to visit before it gets to it's final (original) desination? In that case you could try to manipulate how those points in between have to be chosen, then let NavMesh handle the actual pathfinding (which will still be a shortest path towards those points). Just an idea, hence a comment. You make the curves in this case, not NavMesh, but it still navigates for you. Jan 7 at 11:43
• D.Kallan idea is good. You could create points between objects where the fish as to go before reaching the destination. You could just get the middle of the 2 objects location (and add random variations ?). Else, you could generate a region around the object that the fish would have to avoid as much as possible, so it would do more of a curve. Instead of just adding circular zone, you could use perlin noise to generate them with more complex patterns. Jan 7 at 14:02
• From the images, looks like you want to model inertia - something like chapter 2.4 from AI from Game Developers. Jan 7 at 19:51
• Can you include an image of the noise you used to generate the altered paths? Jan 8 at 5:10
• You might also be interested in "How to force a sub-optimal path" Jan 9 at 16:02