Cellular influence maps

 from Red Blob Games
1 Nov 2019

I wanted to simulate belief systems that vary over time. I decided to use isolines on a triangle mesh.


 1  Rendering#

To make isolines at some threshold t, I fill each triangle according to these rules:

  1. No vertices meet the threshold. 0% fill.
  2. One vertex meets the threshold. 25% fill
  3. Two vertices meet the threshold. 75% fill
  4. Three vertices meet the threshold. 100% fill

Note there's no 50% fill. This set of rules seems like it might cause problems. Let's think about continuity. If the value goes from t - ɛ to t + ɛ, the fill should change only a tiny bit. Does it?


a= b= c=

I found this triangle rather unintuitive, and I was thinking I might have to abandon this approach. I decided to add a few more triangles to see how it would behave relative to neighbors. Try changing the c slider to see what happens:


a= d=
b= c= e=
f= g=

It does look like isolines are continuous. Good! I wasn't sure until I built this diagram to let me try out different scenarios. I will use these for rendering.

Option:

This is called Meandering Triangles[1]. Also see this beautiful shadertoy[2].

I wanted to make these regions round, and experimented here[3], but never got it working the way I wanted.

 2  TODO Simulation#

I decided on a two-axis model, using yellow-blue for one axis and red-green for the other axis. Thare are various two-axis political spectrum[4] models including the Nolan chart[5] and the Pournelle chart[6]. I also took inspiration from the B-Z reaction[7] and the Gray-Scott diffusion reaction system[8].

I want A and B to be influenced by the map. I tried a few different models:

 2.1. Cycling

  1. A += 0.01 * B
  2. B -= 0.01 * A

Looks cool but not interesting enough. Each node's behavior is independent of all other nodes. I think that's not what I'm going for.

 2.2. Reaction-diffusion (R-D)

  1. A += avg(A) - A * B * B + feed * (1 - A)
  2. B += avg(B) + A * B * B - (kill + feed) * B

This is really hard to tune. See Robert Munafo's parameter map visualization[9]. There are large areas that lead to uninteresting behavior. I got some interesting behavior but it rapidly evaporated. This seems like a hard problem that's been studied on grids but not on triangle meshes like I have. I decided to instead try to design something that's stable so that I don't have to tune the parameters so carefully.

 2.3. Belousov-Zhabotinsky (B-Z) reaction

B-Z seems to have less parameter tuning than R-D. See this introduction[10] including code. I tried this, and it worked without any tuning, but it wasn't the effect I'm looking for (which I admit I don't know what I'm looking for).

 2.4. Manual event generation

I had another idea: place some towns on this map manually, then let the reader click on them to trigger simulation events (war, famine, diplomacy, etc.). However, I think this would be a bit more involved, and I decided to leave it for another project.

Email me , or tweet @redblobgames, or comment: