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

Synthesizing World Terrain

The random way to get terrain for a world is to use one of several synthesis methods built into Xconq.

Totally random terrain is available via the synthesis method make-random-terrain. This just randomly chooses a terrain type for each cell, using the weights in the occurrence property of each type. An occurrence of 0 means that the type will never be placed anywhere. This method produces a sort of speckly-looking world, and is better for testing than for actual play. Still, if you have two types vacuum and solar-system, then a form like

(add (vacuum solar-system) occurrence (20 1))

will give you a nice starfield for a space game.

The fractal world method make-fractal-percentile-terrain descends from the most venerable part of Xconq (it was once a piece of Atari Basic code). It uses a fractal algorithm along with percentile-based terrain classification to make realistic-looking worlds with terrain and elevations.

To use this method, you first specify how many, what size, and what height of blobs to splash onto the world, and how many times to average cells with their neighbors. Then you specify the subdivision of all the possible altitudes and moisture levels into different kinds of terrain. For instance, desert in the standard terrain ranges from sea level (alt-percentile-min = 70%) to high elevations (alt-percentile-max = 93%) but only in the lowest percentiles of moisture (wet-percentile-min = 0%, wet-percentile-max = 20%). It is important that all percentiles be assigned to some terrain type, or the map generator will complain and subsitute terrain type 0 (the first-defined type); when designing terrain percentiles, it is helpful to make a chart with altitude percentiles 0-100 on one axis and moisture percentiles on the other. Note that overlapping on this chart is OK, and the terrain generator will pick the lowest-numbered terrain. Also note that you don't have to include every terrain type.

The alt numbers are also used to compute elevations for games that need them, but the wet numbers need not have anything to do with water at all; they could just as easily represent smog levels or vegetation densities. If you only want to use one of the two layers, just set the percentiles for the other to be 0 - 100 for all terrain types.

[should have an example]

The method make-maze-terrain produces a maze consisting of a mix of "solid", "passageway", and "room" terrain. It uses the maze-room-density and maze-passage-density properties of each terrain type to decide how much of each to use for rooms and passages. The method first does random terrain generation, using the occurrence property to decide how much of each terrain to put down (remember that occurrence defaults to 1 for all terrain types). Then it carves out rooms, and passageways between them. The passages and rooms are guaranteed to be completely connected.

The method make-earth-like-terrain attempts to model the natural processes and generate terrain as similar as possible to what is observed on Earth today.

You should note that at least one method for synthesizing terrain must be available, unless you can guarantee that terrain will be loaded from a file. The following subsections describe optional additional synthesis methods that you can include.


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