Wednesday, July 27, 2016

Thinking with Infrastructure

Hahahahahahaaaaaa! I'm feeling good!

Just think, a few hours ago I thought I wouldn't work on D&D at all today ... but given my historical percentage of days on which I do work on D&D is, as of today, 95.5 percent (tracked over the last 267 days), I should have realized something would come out of the brainpipe.

I worked, and worked, and got more and more energetic as I added more chunks of code, and the end result is: I've added infrastructure calculations to the world data, including the spread of infrastructure out from each hex.

First, let's take a look at a view I've whipped up. Remember that the map I'm showing here is only a portion of the whole world. The darker the red color, the higher the infrastructure, and because of certain technical limitations and because I've only just written all this, everything 200 infrastructure and above gets the same color -- but most hexes aren't in that range. The highest value under the current calculations is a hex with an infrastructure of 235 -- not sure which hex it is or whether it's in this map, but I could find out.

(If you're wondering why some of the towns are in low-infra hexes: it's because I have to move the towns around. I didn't have infrastructure or civilized-wild measurements when I originally placed them.)

Now I'll explain how I arrive at these values.

Step one is to set a base infrastructure value for each hex. For now, I'm assigning it such that 1 civilized subtriangle = 1 infrastructure point awarded to the parent hex. Later on, I'll add bonuses for towns and cities.

Step two is to go through to each hex and spread out, from that hex, a fraction of its infrastructure value, in all directions. Finding the fraction for spreading infrastructure from hex A to hex B is calculated like this:

(base infrastructure value at the hex) / (sum of all wilderness levels in hex A + the difference in elevation bands between hex A and hex B)

Then that value-to-be-spread is added to the EVENTUAL value at B. What do I mean by eventual value? I mean that when the whole procedure has completed, for each hex, in each of the six hexagonal directions, then the accumulated eventual value (which might have been added to several times, by several different iterations of the procedure) is all added at once to the original base value at B. I do things in this way so that the value spread from A to B is always calculated from the original infra value at A, and has not had any of the intermediate values added to it. Otherwise the value which is spread from hex A would depend on whether any other hexes have given it a shot of infrastructure yet! And that would mean that how much infrastructure a hex ends up with would be predicated on the order in which each hex is processed through the system. That's something to avoid at all costs.

I hope that's all clear, but if not, ask away. I'm just typing this all out as it comes to me.


  1. It is clear; remember, however, that the roads should follow where the infrastructure is highest. "Infrastructure" should refer to the bridges, the available roadside inns, the amount of general services for people between the high areas - we should be able to see from the roads where those infrastructure patterns are.

  2. I typed a comment then lost it. Short version: to achieve "infrastructure following roads," I'd work backwards from the roads and give extra infrastructure to hexes with roads in them, the more roads the more of an infrastructure bonus. Then I could just spread those values around, and throw out the idea of having civilized/wild distinctions be the source of base infra values.

    I'll put this onto the todo pile.