## December 15, 2018

### Rivers VI: Lakes

A few months ago, Alex Schroeder left a comment on one of my river basin head-wrackers. Unfortunately, the comment has now been deleted thanks to Google+'s wonderful management strategies, but the point still stands: when rivers are trapped, they usually can form lakes and flow out anyway, even if the hex is "higher."

Something that I have to remember is that a hex altitude is the average. The hexes are not simple flat planes stacked like the Giant's Causeway.

So, it's totally possible for a river to flow from a "lower" hex to a "higher" hex, simply following the shortest route to the sea. Perhaps it carves a canyon not visible on the main map.

This algorithm needed a little elbow grease to implement, but it works. There are still some totally endorheic lakes. I can either continue to jitter the surface to make everything shake out, or just be ok with it. A shocking amount of the earth's groundwater never reaches the ocean (over land, anyway), so it's not a terrible thing.

Right now, I'm just representing the lakes with circles (and non-navigable rivers with red). I agonized for a bit about making nice, generated lakes, but then I realized that...it was fine not to. This is not a beautiful overland map like Scott makes. This is, more or less, a representation for game purposes. So it's sufficient to say "here is a lake."

The other thing to point out about this map is the size of the rivers. Again, this is purely representational, but I think I will continue to scale the numbers until the map is not quite so busy. I will have to determine the minimum river size necessary for trade, and that will be the low cutoff.

This map is also not adjusted for precipitation. Since I've just now completed the elevation, I still have to run the wind and rain algorithms. But the actual drainage networks should remain unchanged.

## December 13, 2018

### Elevation XIV: Let It Be Done

I've decided (for now) to be done with terrain generation. I've got something I like even if it's not perfect, and to facilitate the rest of my project I'll let it ride for a while at least. It won't matter too much if I do decide to come back and change it (as will no doubt happen) because everything is generated.

I still might do some tinkering but this will do.

## December 7, 2018

### Gimme That Old Time Religion

I'm not the first to address the issue of religion in D&D, and I'm certain I won't be the last. But I think it's worthwhile to begin thinking about how the divine works in my world, at least to form a coherent treatment of clerics, monks, and paladins (and sort of warlocks, though they are not connected with outside religion).

For the paladin, his oath is what provides his power. The cleric, however, is granted strength by a Divine Being.

Yet there are more orders of clerics than just one. How can this be in a world where proof of your god's existence is instantly accessible by any mook with a holy symbol? RPG clerics live in a world where they walk by sight, not by faith.

There are some solutions to this, of course. One solution is to make all clerics worship the same deity. There cannot be more than one.

This is a little unsatisfying. But consistent.

If we wish to have more than one clerical order, following different gods, then it follows naturally that these deities cannot be all-powerful, and therefore not gods at all. If they were all-powerful, and also all true, then they could not all coexist logically. Zeus and Odin cannot be both god if both exist (as separate entities).

Therefore, then, clerics could gain their power by belief in a localized (more or less) entity which existed on a plane above their own. This is a different level (higher or lower?) than that which a warlock patron might occupy.

Clerics, of course, are gregarious, while monks are ascetics. I'm thinking that a leveled cleric would probably be a step up in whatever hierarchy exists from the local priest, but of course could certainly take up that mantle. A priest might be able to conjure some small healing magic or other stereotypically clerical things, but for the most part is responsible only for the spiritual journey of the local flock, whatever that might mean. Clerics are holy warriors with additional training from an established temple.

I don't really like monks. So I'll ignore them for now. I think clerics fit the role much better, without the edgy Bruce Lee vibes.

So what do they worship? I was browsing around and found the Book of Urantia, an absolutely insane mystical document of no religious value, but it's got some good inspiration for worldbuilding. Paper 85 identifies 6 progressive sources of worship:
1. Stones
2. Plants
3. Animals
4. Elements
5. Heavenly bodies
6. Man
Of these, elemental forces are the most attractive to me in terms of a cosmology. However, I must recognize the extreme difficulty of putting myself in the shoes of an ancient man who worshiped, say, bears or fire. That said, I suspect the desire to anthropomorphize was still strong in those days. So the lightning that destroys trees and people becomes the Father of Storms and we'll give him a name, Ja-Pater.

Ritual worship involves invoking the power's favor or appeasing it in some way. The question arises as to whether the cleric's powers are dependent on correctly approaching the power. Would schisms arise? If so, wouldn't it immediately be obvious that one side picked the wrong theological formula? Can a rogue cleric be stripped of his magic by his superiors as punishment for some crime against the deity? Food for thought.

Ultimately, clerics must operate in some kind of organized (named) religion, whether it's a structured church or a looser collective like shamanism. I'm not sure yet how to determine a local religion procedurally, or if that's something to save for a rainy day. It's not going to matter that much for my planned model of empire growth.

## December 6, 2018

### Elevation XIII: The Uplifting II: Return of the Uplift

So let's examine some of the intermediate output. The full blended map is a little hard to process, so I'll crack it apart:
 C
 T
 D

So there is very heavy C+T concentration in a few areas, and essentially flat elsewhere. Same with D, but at least its not in the same spots.

While IDW gives a nice smooth interpolation, I want it to be a bit spikier. The top-left continent should have a small C band running across it, yet this is smoothed all the way out (with small whiter patches where T is dominant).

The problem with IDW is that it does not know that the value is supposed to drop off from the actual fault line. Instead, it's a smooth interpolation. Which is good for many other things, but might be a bad design choice here.
What about a multi-modal Gaussian? I could determine the distance to the different peaks, have a controllable drop-off, and then sum it all together to get a nice smooth distribution.
Much better. I could improve a few things, of course. The simulation takes a long time to run still, but that has more to do with the distance calculation - I have to calculate every hex's distance from every other hex.

So the uplift becomes:

This uses $c=1.0, t=0.5, d=-0.3$ for weighting factors, with an additional gamma correction of $\gamma=5$. Gamma correction is common in photomanipulation, but if you want to do it by hand, use this formula:
$x' = x^{1/\gamma}$
Where $x$ is your scalar between 0 and 1. This adjusts where the "average" greyscale value is, and can therefore be useful if an image is too bright or dark, while maintaining the 0-1 scale. All in all, there's a nice Fresnel effect going on here.

A niggling thought has entered my mind that I should do like everyone else and build coastlines from the ground up terrain generation. We'll see how things go...it's very tempting. A lot of the highest uplift here is beneath the sea! And many divergent boundaries cross the land (which isn't wrong, but uncommon).

## December 5, 2018

### Elevation XII: The Uplifting

Recently, I discussed how the sauce was made for the uplift maps. It includes this formula:

uplift = (
0.5 * c/max_c +
0.1 * t/max_t -
0.4 * d/max_d + 0.399
)

I'd originally tinkered around with this to get the right coefficients. Now, though. I want to revisit it.

The greatest uplift should occur when C and D are both at their max. The lowest should be where D is max and the others are min.

But this was a distraction from the real issue: so far, I'm not considering the strength of each fault line. Take a look at these plates:

 convergent = red; transform = green; divergent = blue

These boundaries should not be treated the same. The thicker lines indicate stronger interactions, and represent a larger uplift.

To do this, I'll find the closest fault for h in hexes, and capture $s \over d$, where $s$ is the strength of interaction, and $d$ is the distance to the fault line.

.......It was at this point that my project was diverted into fixing the hex distance function. It's not as easy as using the standard distance formula. Why not?

Remember that I'm using a novel hex plate "projection" from the Tao. This means that distances between hemispheres are 1) not displayed according to their true position and 2) are "toroidally" wrapped between the equator. If the two hexes in question are in the same hemisphere, there is no issue: I can use the regular distance formula:
$d = \sqrt{\left(x_2-x_1\right)^2 + \left(y_2-y_1\right)^2}$
Which can be found trivially. But how to handle different hemispheres?

Amit's page here (of course) was extremely helpful in working through this. I realized that if the on-screen distance is correct inside a hemisphere, then I needed to transform one of the hemispheres to simulate this, and then take that distance.

I had been using a really inefficient method where I found a point on the equator that minimized the distance between each hex and that point. I feel dirty just describing it. This method is cleaner, quicker, and not brute-force.

Then I realized that it would be even better to use IDW (which is great but can take a while to run). So I get this map (using $n=2$ for IDW), which still doesn't make much sense.

The uplift map is easier to interpret (with only one variable instead of 3 smashed into a single color code).

I still don't think I've found the right formula. But I think I'm on the right track. There are not nearly enough high uplifting ranges, and this causes the simulation to stop "early," when the height reaches the maximum value. The problem is, the rest of the map is still pretty flat at this point. So some work remains to be done.