March 15, 2021

Detail IX: A Case Study III

I previously covered terrain placement in Detail III and a bit in Detail IV. At the time, I was thinking of the effect that infrastructure had on the terrain, and so I used the terms somewhat interchangeably. The terrain type was simplified into "primary" and "secondary," but there are many cases where neighboring 20-hexes may have several different types between them. So the system needs to be able to take that into consideration.

At first, I just used a random choice between the available neighbor types, yielding something a bit like this:

This isn't really great, because the shape of the 20-hex is immediately identifiable.

To the surprise of no one, I'll turn to my old friend IDW. Normally, IDW is concerned with interpolating numerical values. Instead, for each hex, I'll determine the weights assigned for each potential terrain type. The 20-hex terrains are as follows:

Darker green is shortleaf pine (coded as c), lighter green is longleaf pine (n). Not a huge difference but adds some flavor. The green-brown is marshy terrain and not in view here. So we see that Hex 24 will be dominated by shortleaf pine and begin to transition to longleaf towards the south. Running the algorithm for the weights on a 1-hex near the bottom yields:

{'c': 1.3e-06, 'n': 1.9e-06}

So the longleaf pine is much more likely to be generated near the bottom. To use this in a random selector, I normalize these numbers to sum to unity.

{'c': 0.401, 'n': 0.599}

So there is about a 60% chance that that 1-hex will be longleaf as opposed to the dominate shortleaf.

Quite satisfying.

No comments:

Post a Comment