I am attempting to do a game and for that game I thought I'd use collaborative diffusion. I've got the idea from this paper:http://www.cs.colorado.edu/~ralex/papers/PDF/OOPSLA06antiobjects.pdf
This paper offers the following diffusion equation:
u(0,t+1)=u(0,t)+d*sum[across neighbours i](u(i,t) - u(0,t))
with u(0,t) being the diffusion value of the center,
u(i,t) being the diffusion values of it's neighbours and
d being the diffusion coefficient determining how fast diffusion happens. d is in the range [0,0.5]
This formula is very likely not correct, as for 2 neighbours, d=0.5 and u(i,t)=0 for all neighbours i it returns u(0,t+1)=0, which just doesn't seem right - I don't think that's how diffusion is supposed to behave.
Even worse: With more neighbours the value for u(0,t+1) can become negative and this is definitely not right, as the magnitude of the negatvie value becomes even bigger when the diffusion value at the center is more positive beforehand.
Does anyone know the correct diffusion equation for discrete grids?
I tried to do some corrections myself, such as not multiplying with d but instead with d/(number of neighbours) or using the sum
sum[across neighbours i](u(i,t) - u(0,t)/(number of neighbours))
instead, but the results of those seemed strange.