# More details of the XML configuration. Devil of the Rings

On this planet, I demonstrate the creation of the continent outlines using functions defined on the sphere. In particular, I pursue the goal of creating crater-like continents. Currently, it is the newest planet, and it has the XML configuration file.

## Base heights mesh

In GHeights element the child element Land lacks Pits and Eartherize sub-elements since post-processing of the base heights mesh in this case is not needed.

The base heights mesh’s layer builders are more complex than for Pandemic planet. Firstly, GLayerExprFigure is used several times to create circles of different sizes.

<GLayerFold apply_limits="False" fold="\x y->if (x>0 && y>0) then min x y else max x y">
<GLayerExprFigure contour="\phi _->0.1" size="\rnd->2.618" profile="\d->max 0.139 (min 1 (1/(fromIntegral d)**0.91))" count="5"/>
<GLayerExprFigure contour="\phi _->0.1" size="\rnd->1.618" profile="\d->max 0.139 (min 1 (1/(fromIntegral d)**0.99))" count="8"/>
<GLayerExprFigure contour="\phi _->0.1" size="\rnd->1.000" profile="\d->max 0.139 (min 1 (1/(fromIntegral d)**1.19))" count="13"/>
</GLayerFold>


The profile attributes are specially chosen so that the inland seas become shallow and there is a high probability of the archipelagos formation in them. Then the result is folded with the high frequency sphere noise.

<GLayerSphereNoise frequency="3.5" lacunarity="2.0" octaves="7" persistence="0.8"/>


It is made with the following GLayerFold element.

<GLayerFold apply_limits="False" fold="\x y->(3/4+x/4)*y*(if y<=0 then 0 else 0.238+(1/(1+(0.312*y))))">
...
<GLayerFold>


This gives us the final data for the base heights mesh (with visible ocean territory).

## Rivers

There is sources_per_romb set to 1.33 in Rivers element; there can be from one to two river sources in a romb, and two sources can be with probability of 0.33. var_arc parameter has been reduced so that there are no long and narrow islands in rivers (sometimes noticeable on Pandemic planet).

## Relief

The water surface creation is defined by WHeights element.

<WHeights>
<Smoothing fading_power="1.6" river_max_dist="1.0" river_strength="1.1" sea_max_dist="1.0" sea_strength="1.1" strength_incr="1.1">
<Iter kStr="0" first="Distance" dSort="Inc" hSort="Inc" sm_dir="down"/>
<Iter kStr="0" first="Distance" dSort="Dec" hSort="Dec" sm_dir="up"/>
...
</LcDHPointSort>
</Smoothing>
</WHeights>


As you can see, the main thing that taking place here is inter-romb smoothing, which converges rather slowly and the process must be repeated many times. The number of repetitions here is quite large also because of the large elevation differences on the outer ocean shores. Number of repetitions can be lessen for planets of many other types.

An important change has been made in the latest version: now the river channels is not fully fixed under smoothing of the water surface and there is a need for the subsequent alignment of the river channels height. This part has not yet been fully done, and one can notice small inconsistencies in the final z-level data of the rivers and underlining relief.

The hill-layer goes via a similar smoothing procedure, and the river channels are not fixed at all. This layer can be interpreted as a layer of varying thickness, which is superimposed on top of the water layer. Then it serves as an initial material for the terrain layer, the later is carved out the hill-layer.

<HHeights hill_delta="\v->if v>=0 then 0.05+0.95*v else (if v>(-0.5) then 0.05 else 1.0)">
<Iter kStr="0" first="Distance" dSort="Dec" hSort="Dec" sm_dir="up" radius="20"/>
<Iter kStr="0" first="Distance" dSort="Dec" hSort="Dec" sm_dir="up" radius="10"/>
...
</LcDHPointSort>
</Smoothing>
</HHeights>


hill_delta attribute specifies a function that gives the initial heights of the hill-layer.

Terrain element defines a noise data layer combined with the hill-layer. There will be a next post about it.

Here is an example of visual results of the relief creation steps.

 Water surface Hill-layer Final relief