Layers constitute the bulk of data about an area of the world.
Each layer assigns a value to each cell in the area;
examples include cell terrain, temperatures, elevations, and so forth.
Since there may be many cells in a layer with the same values,
each layer uses a common run-length encoding scheme.
In this scheme, each horizontal band of cells
is a separate text string, and the contents of the string encode
individual numeric values, one for each cell.
The encoding uses the characters a..~
and :..[
for 0 through 63,
and decimal digits followed by commas (or the end of the string)
for all other numbers.
An optional -
is allowed, and indicates a negative value.
Runs of constant value are prefixed with their length, in decimal.
The character *
separates run lengths from values expressed
as digits.
Thus, the string
"40adaa100,2*-99"
represents 46 values in all: 40 zeroes, a three, 2 more zeros, a 100, and two -99s. Although this format is quite unreadable, it has the advantages of compactness and portability; the expectation is that most layer editing will be done on-line. Note that the run encoding is entirely optional.
The following subforms at the beginning of layer data have special effects:
LayerSubform: constant
n
This subform causes every value in the layer to be set to n.
LayerSubform: subarea
x y w h
This subform indicates that the layer data should be positioned at the given rectangle in the layer.
LayerSubform: xform
mul add
This subform has the effect of first multiplying the raw value by mul, then adding add and storing the result into the layer.
LayerSubform: by-bits
LayerSubform: by-char
str
This subform specifies that the characters in str give the encodings of values in the layer. The first character in str encodes 0, the second encodes 1, and so forth.
LayerSubform: by-name
name-list
[what is the syntax of name-list exactly?] This subform is for generic worlds that are useful across multiple game designs. The value/name pairs allow for the matching of terrain types by name, so that if, say, the "sea" terrain type was type #0 in one game and type #4 in another, the world would have sea in all the same places after it was read in. In practice, only a few worlds are this general. If a named terrain type is not present, Xconq will warn about it and substitute type 0.
AreaProperty: terrain
layer-data...
This property is the actual layer of terrain types for cells.
AreaProperty: aux-terrain
terrain-type layer-data...
This property fills in values for borders, connections, and coatings. For border and connection terrain, the value is a six-bit number (0..63), with a bit turned on in each direction that there is a border or connection. For coating types, the value is the depth of the coating.
AreaProperty: features
feature-list layer-data...
This property specifies the nature and location of all geographical features.
The feature-list is a list of lists, where each sublist has the form
([id] typename name [super])
where id is the numerical id referenced in the layer data
(defaults to feature's position in the feature-list),
typename is a symbol or string giving the general type of feature
(such as bay
),
name is the name of the feature
(such as "Bay of Bengal"
),
and super is the optional id of another feature that
incorporates this feature.
AreaProperty: material
material-type layer-data...
This property declares the quantity of the given material-type in each cell of the area.
AreaProperty: people-sides
layer-data...
This property says which side the people of each cell are on.
A side-encoding of exact
assigns 0 to independence (no side),
1 to the first side, and so forth; otherwise, the encoding is a list
of side names/ids and numbers.