Random map generator for Dominions
Copyright (c) 2002 Keldon Jones (keldon@ont.com)
Modified (2004) by Philippe Duchon (duchon.philippe@free.fr) for
Dominions2 compatibility
Prettifying script for GIMP by Jeff Kelly and Leif Roar Moldskred
Perl script to run the whole thing by Leif Roar Moldskred



This is a random map generator for the game Dominions2.  To learn more,
visit Illwinter's web site at http://www.illwinter.com .

----------------------------------------

COMPILATION

The included Makefile should be enough to compile on Unix systems;
type "make" and you should get a brand new "dommap" executable.

To compile on a different system... I don't know. The files in the
"Win" directory are from Arryn's version of the source code, as a
Microsoft Developer Studio project; but then, the source code itself
is slightly different. If you have Developer Studio, you might try
copying these files back into the main directory. But then, if you
have Developer Studio, chances are you already know how to compile
standard C...

----------------------------------------

INSTALLATION

Copy the dommap executable wherever you want it to be. On Unix
systems, you typically want it either in some standard directory like
/usr/local/bin, or in some personal directory that appears in your
$PATH environonment variable (like ~/bin/).

If you want to use Leif's Perl script, which is highly recommended,
you will need Perl, and Gimp version 1.2. You also need to copy the
file "selective-blur-batch.scm" in some directory where Gimp will look
for new scripts; on my system, this is ~/.gimp-1.2/scripts/.

----------------------------------------

RUNNING

You can run dommap either by itself (see below for the long list of
command line switches; or use "dommap --help"), or with the
"run_dommap.sh" script, which will prompt you for arguments [WARNING:
this script has not been changed since the Dominions 1 version; it may
be obsolete by now], or by using Leif's "run_dom_map.pl" Perl script.
This script accepts the same command line arguments as dommap, and a
few more. It will then run dommap a number of times with these
settings, will make them look better with the "selective-blur" script
[requires GIMP], will zip each map into its own Zip file, and will
write a small HTML file with thumbnails of the various maps. Very
handy, and heartily recommended.

----------------------------------------

WHAT'S IN THERE

This generator uses fractal algorithms to generate elevation and richness
plots for the map.  These plots are then used to determine the terrain
type for each pixel on the map.  After that, the map is divided up into
a given number of land and sea provinces and borders are drawn.  Then the
map image file and a simple map description file are output.

Currently, the .map file contains some terrain information that is
very experimentally based on the percentage of pixels of each color in
a given province. There are no options to change how this works - this
will probably be done in a future version.

There are several command-line options that determine how the map is
generated.  They are listed below with their defaults and a description
of what they control.

If you don't like using the command-line, try the "run_dommap.sh" shell
script.  It has a user-editable portion near the top that resembles a
configuration file.


General options:

-v

Specifies verbose mode.  Prints information about what is happening.


Basic map options:

-h <height>  Default: 550

Controls the height of the map in pixels.  Maximum is 2400.

-w <width>   Default: 750

Controls the width of the map in pixels.  Maximum is 3200.

-n <name>    Default: "random"

The name of the map.  Specifies what the output files are named, and
also the title of the map when choosing from within the game.

-s <seed>    Default: seeded with current time

Specifies the random seed to use for all random number generation.  You
can use the same seed to generate the same map time after time.  This is
useful if you are tweaking some of the other options.  The map seed is
also saved in the .map file in the #description field.


Terrain generation options:

-r <ruggedness>      Default: 1.5

Higher numbers generate more rugged, chaotic terrain.  I recommend
staying between 1 and 2.  Numbers near 1 generate very smooth, boring
terrain.  Numbers above 2 generate very complicated coastlines.

-d <dithering>       Default: 0.08

Controls the "fuzzyness" between different terrain types.  A value
of 0 generates smooth, sharp borders between forest and plains, for
example.  A value too high generates basically random dots.

-wl <water line>     Default: 35

Controls the percentage of water on the map.

-tl <tree line>      Default: 60

Controls the percentage of lowlands.  Terrain that is above the water
line and below the tree line are swamp, plains, or farmland.

-ml <mountain line>  Default: 80

Controls the percentage of high elevations.  Terrain that is above the
tree line and below the mountain line are wasteland, plains, and forest.
Any terrain above the mountain line is tundra, forest, or mountains.

-pl <poverty line>   Default: 20

Controls the percentage of poor terrain.  Poor terrain is tundra,
wasteland, and swamp.

-rl <rich line>      Default: 80

Controls the percentage of rich terrain.  Any terrain above the rich
line is mountain, forest, or farmland.


Province options:

-ns <num sea provinces>  Default: 10

Specifies the number of sea provinces.  You may not end up with this
number if the amount of sea is too low, or the spread between sea
provinces is too high (see below).

-nl <num land provinces> Default: 90

Specifies the number of land provinces.  See caveat above.

-ps <percent special>    Default: 20

Specifies the percentage of land provinces that will have "special"
shapes.  For now this means provinces that will be stretched
vertically or horizontally.

-sa <shore avoidance>    Default: 30

Sea province capitals will not be placed too close to the shore (or the
edge of the map).  This value (in pixels) specifies the minimum
distance.

-la <shore avoidance>    Default: 8

Land provice capitals will not be placed too close to the shore (or the
edge of the map).  This value (in pixels) specifies the minimum
distance.

-ss <sea spread>         Default: 60

Specifies minimum distance (in pixels) between centers of sea
provinces.

-ls <land spread>        Default: 25

Specifies minimum distance (in pixels) between centers of land
provinces.

-sc <shore cost>         Default: 1000000

Cost of having province "bleed" from land to sea or vice versa.  If
this is too small, some sea provinces may have their borders cross
into land, or vice versa.

-tc <terrain cost>       Default: 10

Cost of having provinces borders cross different terrain types.  If
this is made large, the province borders will follow natural terrain
boundaries.  If made small, the province algorithm will ignore the
terrain differences.

-sm <border smoothing>   Default: 1

Number of times to run the border smoothing algorithm.  This prevents
extra border pixels, and also smooths the coastline.


Map file generation options:


-sn <min neighbors>      Default: 2

Minimum number of sea neighbors a sea province needs to be
considered a starting province.  Land neighbors to the province don't
count.  This prevents isolated lakes to be starting provinces for
the sea nations.

-ln <min neighbors>      Default: 4

Minimum number of land neighbors a land province needs to be
considered a starting province.  Sea neighbors don't count.
