A heatmap pathfinding algorithm can be used to find a path when the one or more destinations are known but the starting position is unknown, or when many separate entities want to move to the same locations. 

It could be computationally expensive to calculate a distinct path for every entity to reach a common destination, so instead I can just map the whole space and have each entity move towards the warmest area it can move towards.

Click on the board to place locations that the algorithm should try to find paths to.  Press spacebar to generate the heatmap.

The numbers indicate the distance to a destination.  The lower the number the warmer the location is.  If an entity checks the spaces around itself and finds a warmer space, if it moves to that location it knows it is getting closer to a destination.

This algorithm functions at a pretty consistant speed regardless of the number of destinations.

 

Add comment


Security code
Refresh