So, working on my ongoing Falling Sand Game project, I find that the best way to make the heat spread evenly is to use distances from heat sources. the problem is that the only way i can think to do that is brute force.
Here's a simplified version of my problem.
i have a 2D array such as:
1,2,3,4 5,4,3,5 1,3,3,2 2,3,5,6
So, if 3 is a heat source, then while looping through the arrays, how can i find out which 3 is the closest and how far away it is from the current position? ex: (1,1) is closest to the 3 at 1,3 with a distance of 2, but if everything can move in the array, the positions will not be known in advance.