Designing Games with Xconq - Synthesis Methods

Go to the first, previous, next, last section, table of contents.

## Synthesis Methods

The synthesis method list specifies which methods will be run, and in what order. After they have all been run, Xconq runs a consistency and completeness check. For instance, there should be a world with terrain everywhere. Failure at this point is fatal; Xconq will either exit or return to a game setup dialog.

- Synthesis Method List
- Fractal World
- Maze World
- Random World
- Earthlike World
- Random Terrain Changes
- Making Rivers
- Making Roads
- Making Countries
- Making Independent Units
- Making Weather
- Making Initial Supply
- Naming Geographical Features
- Naming Units
- Making a Random Date

### Synthesis Method List

GlobalVariable: `synthesis-methods` method-list

This variable is a list of synthesis methods. If the list is empty, no synthesis methods will be run.

The list of synthesis methods is ordered, and many contain duplicates, so that a method can be run multiple times during setup. Note that most of the existing methods will simply return if they detect that their work has already been done, so multiple runs will have no effect.

The default synthesis method list is effectively

    (make-fractal-percentile-terrain
     make-countries
     make-independent-units
     make-roads
     make-rivers
     make-weather
     init-supplies
     name-geographical-features
     )

GlobalVariable: `synthesis-done` list

This variable is a list of what methods were used, and how many times. This is for the use of the save/restore machinery, should not normally be manipulated by game designers.

### Fractal World

The fractal world synthesizer can make a variety of natural-looking terrain. It relies on a number of parameters to govern a single algorithm.

SynthesisMethod: `make-fractal-percentile-terrain`

This method generates the terrain layer of a world. It works by generating two distinct layers of random blobs, known as the "alt" and "wet" layers, then decides on a terrain type for each cell. If elevations are defined, then this method will use the "alt" layer to produce elevations.

GlobalVariable: `alt-blob-density` n

GlobalVariable: `wet-blob-density` n

These variables are the number of blobs to put down, expressed as number per 10,000 cells. Defaults to `500`.

GlobalVariable: `alt-blob-size` n.f%

GlobalVariable: `wet-blob-size` n.f%

These variables are the average number of cells in a blob, expressed as number per 10,000 cells. Defaults to `100`.

GlobalVariable: `alt-blob-height` n

GlobalVariable: `wet-blob-height` n

These variables are the amounts by which to increment or decrement within a blob. Defaults to `1000`.

GlobalVariable: `alt-smoothing` n

GlobalVariable: `wet-smoothing` n

These variables specify the number of averaging steps to perform after the blobs have been generated. Defaults to `2`.

TerrainTypeProperty: `alt-percentile-min` n%

TerrainTypeProperty: `alt-percentile-max` n%

TerrainTypeProperty: `wet-percentile-min` n%

TerrainTypeProperty: `wet-percentile-max` n%

These properties are the percentiles of elevations and moistures that result in the given terrain type. Percentile ranges may overlap, in which case the earlier-defined terrain type will be used. If a cell has a alt and wet that does not fall in any of the ranges, then terrain type 0 will be used there and players will be warned. Mins defaults to `0`, maxes to `100`.

After the terrain has been assigned types, the method will give a single type to all the cells on the edge of the area.

GlobalVariable: `edge-terrain`

This variable is the type of terrain to fill in on all the edges of a world. The edges of a world have little or no effect on the game, but the terrain type should be something distinctive, so that players can recognize the edges easily. (For instance, ice is usually a good choice for edges, but probably not on a map of Antarctica!) Defaults to terrain type 0 (the first defined type).

### Maze World

A maze consists of a set of randomly placed "rooms" connected by random passages.

SynthesisMethod: `make-maze-terrain`

This method creates terrain that looks like a maze. It starts by randomly assigning terrain according to its `occurrence`, similarly to `make-random-terrain` below, then carves out rooms and passages, filling each of those with terrain types according to their respective occurrences.

TerrainTypeProperty: `maze-room-occurrence` n

This property is the weighted amount of this terrain type in rooms in the maze.

TerrainTypeProperty: `maze-passage-occurrence` n

This property is the weighted amount of this terrain type in passageways in the maze.

GlobalVariable: `maze-room-density` n

This variable is the fraction of the maze that is room, expressed as the number of cells per 10,000 cells in the area. Defaults to `1000`.

GlobalVariable: `maze-passage-density` n

This variable is the fraction of the area that is passageway, expressed as the number of cells per 10,000 cells in the area. Defaults to `3000`.

This method will apply edge terrain as a last step.

### Random World

The random world generator just assigns terrain and elevations randomly.

SynthesisMethod: `make-random-terrain`

This method generates completely random terrain. It uses a simple weighting to govern how much of each terrain type appears, and makes random elevations as well.

TerrainTypeProperty: `occurrence` n

This property is the percentage of the world that will be of this type, if the terrain is cell terrain. If the terrain is border or connection, it is the probability (expressed as .01% increments) that any direction of any cell will have that border or connection. Defaults to `1`.

### Earthlike World

Earthlike generation uses algorithms that more closely approximate realistic terrain.

SynthesisMethod: `make-earthlike-terrain`

This method generates terrain that approximates what actually appears on Earth.

### Random Terrain Changes

Terrain generation methods may postprocess the generated terrain by randomly changing cells of some types.

TableTT: `terrain-density` t1 t2 -> .01n%

This table is the .01% chance that a cell of type t1 will be changed to type t2.

### Making Rivers

Rivers are borders or connections consisting of "watery terrain" that run downhill to regions of water.

SynthesisMethod: `make-rivers`

This method looks for a border or connection terrain type with a `subtype-x` of `river-x`. then uses the world's elevation data to run rivers downhill (always choosing the lowest of possible adjacent locations) until they reach cell terrain with a `subtype` > 0. This method will not run if there are no appropriate terrain types, nor if there is no elevation data.

TerrainTypeProperty: `river-chance` n%

This property is the chance that a river will start in or around a cell of this terrain type.

GlobalVariable: `river-sink-terrain` t

If the value of this variable is a terrain type, then a cell completely surrounded by river will be changed to be this type. Defaults to `non-terrain`.

Note that the algorithm computes rivers in a deterministic way, so high values of `river-chance` do not result in tangled rivers.

### Making Roads

The road generation method makes networks of connection terrain between particular unit types, usually those resembling cities.

SynthesisMethod: `make-roads`

This methods synthesizes roads for an area. For any connection type of terrain, if no layer has been created for it already, and the type has a `subtype-x` of 3, put down roads between any pair of units whose `road-chance` is nonzero. The method will attempt to share road routes whenever possible, and choose terrain according to `road-into-chance`. In addition, the method may also generate spur roads connecting units to existing roads, and run roads from one edge of the area to another.

TableUU: `road-chance` u1 u2 -> n%

This table is the chance that a road will be laid, running from a unit of type u1 to one of type u2. Note that is not a symmetrical relationship; since roads follow random paths, if the `road-chance` causes a road to be laid from u1 to u2, and another from u2 to u1, it is quite possible that the result will be two different roads connecting the two units.

TableTT: `road-into-chance` t1 t2 -> n%

This table is the chance that a road will be chosen to pass from terrain of type t1 into terrain of type t2. Defaults to `100`.

UnitTypeProperty: `spur-chance` n%

This property is the percentage chance that the unit will get a spur road running from the unit to the nearest existing road.

UnitTypeProperty: `spur-range` dist

This property is the radius of the area that will be searched for an existing road. Defaults to `1`, which results in spurs connecting only to roads in adjacent cells.

UnitTypeProperty: `road-to-edge-chance` n%

This property is the percentage chance that the unit will have a road running from the unit to some edge of the area.

GlobalVariable: `edge-road-density` n

This variable is the density of roads that run from one area edge to another, expressed as the number per 10,000 cells in the area. (note, not counting just edge cells).

### Making Countries

The `make-countries` method sets up the starting units for each side, placing them in a confined area, separated from the starting units of other sides and taking terrain preferences into account. If requested, this method will also expand the country outwards by a specified amount, possibly placing additional units in the process.

SynthesisMethod: `make-countries`

This method works by looking for a likely place for the country, randomly places a basic set of starting units within that area, then expands the country outwards. The parameters give you control over the mix of terrain types in the country, as well as the size and relative positions of the different countries. This method runs on any side with fewer units than it is supposed to start with, as given by the parameters below. It places groups of units at locations separated from each other by specified distances.

GlobalVariable: `country-radius-min` dist

This variable is the radius of the country's initial area. Defaults to `-1`, which allows the algorithm to calculate a "reasonable" country size appropriate to the given number of units.

GlobalVariable: `country-separation-min` dist

GlobalVariable: `country-separation-max` dist

These variables are the minimum and maximum distances of country centers from each other, in cells. If small, countries will mostly overlap; if very large, then attempts to use small worlds will fail; if the max and min are too close to each other, placements can also fail. For both of these, a value of `-1` disables their effect. Both default to `-1`.

The max separation bound needs to be satisfied for a country with respect to only one other country, so for instance the final layout may involve a long "string" of countries where the first and last countries are very far apart from each other. The minimum bound must be satisfied for all pairs of countries.

TerrainTypeProperty: `country-terrain-min` n

This property is the minimum amount of terrain that must be within the country's initial radius.

TerrainTypeProperty: `country-terrain-max` n

This property is the most terrain of the given type that may appear. If `-1`, then any amount may be present. Defaults to `-1`.

UnitTypeProperty: `start-with` n

UnitTypeProperty: `independent-near-start` n

These properties set the number of units of the given type in a player's country. These units are randomly scattered within the initial radius, and the `favored` table (see below) decides which terrains will be used. Units may be placed inside each other; in fact, units with no favored terrain will be made into occupants if possible.

The independent units will be placed after the ones belonging to the side, so on the average they will get the less desirable locations in the country. Unlike the randomly-scattered independent units, these will be named using the side's namers.

Both default to `0`.

TableUT: `favored-terrain` u t -> n%

This table sets the probability of the unit type being on the given type of terrain at the outset. A value of `0` is an absolute prohibition against placing the unit on that type of terrain, thus every game must specify at least one non-zero value for some terrain type and some initial unit type. Defaults to `100`.

Once the initial country area has been set up, then you can allow the countries to expand outwards. Expansion occurs at the same rate for all countries. Countries may expand into and through each other. Expansion occurs as a number of steps, each step increasing the radius of countries by 1 all around.

TerrainTypeProperty: `country-growth-chance` n%

This property is the chance that a country will expand onto an unclaimed cell of the given terrain type. Defaults to `100`.

TerrainTypeProperty: `country-takeover-chance` n%

This property is the chance that a country will expand onto another country's cell of the given terrain type.

UnitTypeProperty: `unit-growth-chance` n.f%

This property is the chance that a unit of the given type will be placed when the country expands onto a cell. The unit will only be placed if the `favored` chance is also true.

UnitTypeProperty: `independent-growth-chance` n.f%

This property is the chance that an independent unit of the given type will be placed when the country expands onto a cell. The `favored` chance is also evaluated.

UnitTypeProperty: `unit-takeover-chance` n.f%

This property is the chance that a unit of the given type in another country and belonging to another side will be given to the growing side.

UnitTypeProperty: `independent-takeover-chance` n.f%

This property is the chance that an independent unit of the given type in another country will be given to the growing side.

GlobalVariable: `country-radius-max` dist

This variable is a cap on the country growth process. Values between `0` and `country-radius-min` prevent country growth entirely, while a value of `-1` allows growth to encompass the entire world.

UnitTypeProperty: `country-units-max` n

This property is a cap on the number of units given to the side's country. Defaults to `-1`, which disables any limit.

GlobalVariable: `growth-stop-chance` n%

This variable is the chance that a country's growth will stop, if during the current step no new cells were added to the country.

TerrainTypeProperty: `country-people-chance` n%

This property is the chance that the people's side will be changed to match that for the country they are in. Defaults to `100`.

### Making Independent Units

SynthesisMethod: `make-independent-units`

This method scatters independent units randomly over the world. This method will not run if the specified density of independent units has already been achieved, for instance from a predefined world or from country placement. Independent units that should be inside other independents will be handled correctly.

TableUT: `independent-density` u t -> .01n%

This table is the probability that an independent unit of type u will be placed on a empty cell with terrain of type t.

TerrainTypeProperty: `independent-people-chance` .01n%

This property is the chance that the people of a cell with this terrain type will be made independent.

### Making Weather

Weather synthesis sets up an initial state for the weather.

SynthesisMethod: `make-weather`

This method sets up weather-related layers, including temperature, winds, and clouds.

### Making Initial Supply

By default, all units start out empty of materials. The supply initialization method gives each unit a starting supply, according to the initial supply tables.

SynthesisMethod: `make-initial-materials`

This method fills unit and cell supplies to specified levels. It will fill all units in existence at the moment it runs, including units that have not appeared yet. Similarly, all cells will be filled.

TableUM: `unit-initial-supply` u m -> n

This table is the amount of each material that each unit will start out with. If the initial supply is greater than unit's capacity, then the unit will just be filled to capacity.

Terrain cells may also have initial material levels.

TableTM: `terrain-initial-supply` t m -> n

This table is the amount of material m that each cell with terrain t will start out with. This will be limited by the cell's capacity.

Sides with treasuries may start with an initial amount.

MaterialTypeProperty: `initial-treasury` n

This is the amount of each material type that a side's treasury will start with.

GlobalVariable: `indepside-has-treasury` t/f

This is true if the independent units have a common treasury. (This may be necessary if indeps may construct units, and those units need treasury material.)

### Naming Geographical Features

Although named geographical features don't affect the outcome of a game in any way, they are useful for "color" and for identifying locations more readably.

SynthesisMethod: `name-geographical-features`

This method identifies and names regions as geographical features, such as mountain ranges and islands.

GlobalVariable: `feature-namers` feature-namer-list

This variable is a list of feature types and their associated namers. This is used for features not intersecting any country with a namer for the feature's type. Defaults to `()`.

GlobalVariable: `feature-types` feature-expr-list

This variable is a list of feature types that may be identified. Each list element has the form `(typename [name] [parameters])`, where typename is from the list given below, name is the specific name of the type (which is used in `feature-namers`, and parameters is any optional parameters describing how to identify features of that type. Defaults to `()`.

- `peak` [name] [density] This type causes the synthesizer to look for high points, at a density of density per 10,000 cells (defaulting to 50).
- `island` [name] [sizemax] This type identifies areas of non-liquid terrain surrounded by liquid terrain, up to sizemax (default 30) cells in size.
- `lake` [name] [sizemax] This type identifies areas of liquid terrain surrounded by non-liquid terrain, up to sizemax (default 30) cells in size.
- `bay` [name] This type identifies cells that are liquid but at least 2/3 surrounded by non-liquid terrain.

### Naming Units

SynthesisMethod: `name-units-randomly`

This method gives names to previously-unnamed units, using their usual namers.

### Making a Random Date

For extra color, games can be set up to start at a random date within a given range. If day or year effects are defined, this also has the effect of making the game start at a random time of day or year.

SynthesisMethod: `make-random-date`

This method generates a random starting date, within specified bounds.

GlobalVariable: `initial-date-min` date

This variable is the earliest possible date for the game. Defaults to `""`.

GlobalVariable: `initial-date-max` date

This variable is the latest possible date for the game. Defaults to `""`.

Go to the first, previous, next, last section, table of contents.