Is "stupidity" an option for pathfinding?

One problem I’m having is that A* is too smart for its own good when it comes to mimicking reality. I have a pack of wolves running around the wilderness for example. In the simulation using A*, they move perfectly from one side of the map, to the other, and directly to the player as if they had GPS and satellites guiding them.

Given this, is there a way to code nature into their behavior?

Hi

One possible way is to apply some semi-random penalties to the grid.
If you have the pro version you can use a texture as penalties:

Then you can use some noise similar to this:

which will add a penalty for traversing some parts of the graph. This will cause the units to take slightly suboptimal paths, but they will still be smooth since the noise is smooth. Note that you may have to use quite a large ‘factor’ value for the penalty.

Interesting idea, I’ll try that!

I just noticed something. It looks like the penalty is A* wide? That means each unit will behave with the same level of randomness. Is there any way to set the penalty per unit instead of per A*?

Penalty is used for everything. However there are ways to override it and other systems which work differently.
There are tags for example which you can set per unit, however there are only a limited number of tags: https://arongranberg.com/astar/docs/tags.php.
There is also the ITraversalModifier interface which you can use to completely override the penalty calculations for all nodes: https://arongranberg.com/astar/docs/turnbased.html#ITraversalProvider

I experimented with an alternative to Alternative Path modifier that achieved something like that. Basically I hashed together path/node info to get an integer from which I could translate into a pseudo random per-node penalty without setting the node’s penalty property or providing a texture for penalties. This meant that every agent that requests a path - by virtue of the path info differing - would find a unique path. Sometimes a large random penalty would be placed on a chokepoint node, resulting in an interestingly different path even if starting on the exact same node and going to the same destination. Unlike Alternative Path modifier, this applies to all paths, not paths recently visited by agents. Unlike a noise texture paths aren’t necessarily smooth. The paths can be more wiggly if the pseudo penalty range is allowed to be large, and smoother if the penalties are small.