Writing it
dirt { scatter perSquare=40 { pebble } } // inside a surface: lands on it
scatter at=pool count=2 { rock size="6dmm .. 10dmm" } // two rocks in the pool
scatter at="foot(cliff)" perSquare=55 reach="4dmm" { stone } // scree at the cliff's foot
scatter perSquare=3 { stone weight=3; boulder } // a mix, three stones to a boulder
scatter perSquare=3 { rock size="4dmm .. 8dmm" weight=3; flower; tree top="$bottom + [22dmm .. 30dmm]" weight=1 } // a glade
A scatter needs exactly one of count and perSquare. reach needs at=foot(…). A scatter holds rocks, flowers and trees, alone or mixed, and definitions whose stack is one such thing (scatter count=3 { boulder size="7dmm .. 10dmm" }: the child's properties are the definition's params, a tree's top= is its height, weight= is its share, and a place word on the child is dt::place; see demo/scatter-definition.dtile). With several children, each child's weight= is its share of the mix (default: equal), whatever the kind. A mix is placed with one gap (default 1dmm) between every two things: trees first (largest crown first, laid out together; an error names how many fit when not all do), then rocks clear of the crowns, then flowers on dry ground clear of both. A mix is not gathered at a foot; at= a region or a line works as for any scatter. A scatter is built where it is listed: a dirt listed after it lies on its rocks and banks against its trunks, and grass listed after it grows round it. Every scattered thing keeps inside the tile and clear of other solids: it is nudged inward, never clipped.
Reference
at= region, line, foot(…)Controls
| Control | Takes | Default | What it does |
|---|---|---|---|
count | count, 0 to 10000, or a range, or a weighted range | not counted: perSquare says how many | how many, in total |
perSquare | per square, a number, a range or a weighted range | — | how many per square of the area, or of length along a line |
spread | length (dmm) | — | a cluster within this distance of a point not built yet check accepts it; build refuses it |
reach | length (dmm) | where the rocks stand: a foot's or a line's own | with at=foot(…): how far out from the foot; with at= a line: how far either side of it |
clumps | per square | — | gathers them into clumps; default spread evenly not built yet check accepts it; build refuses it |
gap | length (dmm) | — | least space between neighbours |
In the library
1x1-cliff-corner.dtilelib:tiles/cliffs/1x1-cliff-corner.dtile1x1-cliff-mound.dtilelib:tiles/cliffs/1x1-cliff-mound.dtile1x1-cliff-spire.dtilelib:tiles/cliffs/1x1-cliff-spire.dtile1x1-cliff.dtilelib:tiles/cliffs/1x1-cliff.dtile2x1-cliff-blocks.dtilelib:tiles/cliffs/2x1-cliff-blocks.dtile2x1-cliff-escarpment.dtilelib:tiles/cliffs/2x1-cliff-escarpment.dtile2x1-cliff-needles.dtilelib:tiles/cliffs/2x1-cliff-needles.dtile2x1-cliff-rubble.dtilelib:tiles/cliffs/2x1-cliff-rubble.dtile2x1-cliff.dtilelib:tiles/cliffs/2x1-cliff.dtile2x2-cliff-canyon.dtilelib:tiles/cliffs/2x2-cliff-canyon.dtile2x2-cliff-corner.dtilelib:tiles/cliffs/2x2-cliff-corner.dtile2x2-cliff-massif.dtilelib:tiles/cliffs/2x2-cliff-massif.dtile2x2-cliff-plateau.dtilelib:tiles/cliffs/2x2-cliff-plateau.dtile1x1-grass-flowers.dtilelib:tiles/ground/1x1-grass-flowers.dtile1x1-grass-tree.dtilelib:tiles/ground/1x1-grass-tree.dtile2x1-tree-row.dtilelib:tiles/ground/2x1-tree-row.dtile2x2-glade.dtilelib:tiles/ground/2x2-glade.dtile1x1-water+grass-angle.dtilelib:tiles/water/1x1-water+grass-angle.dtile1x1-water+grass-corner.dtilelib:tiles/water/1x1-water+grass-corner.dtile1x1-water+grass-tree.dtilelib:tiles/water/1x1-water+grass-tree.dtile1x1-water+grass.dtilelib:tiles/water/1x1-water+grass.dtile1x1-water+soil-angle.dtilelib:tiles/water/1x1-water+soil-angle.dtile1x1-water+soil-corner.dtilelib:tiles/water/1x1-water+soil-corner.dtile1x1-water+soil.dtilelib:tiles/water/1x1-water+soil.dtile1x1-water-u+grass.dtilelib:tiles/water/1x1-water-u+grass.dtile1x1-water-u+soil.dtilelib:tiles/water/1x1-water-u+soil.dtile
Generated from dharmatiles elements scatter by cargo xtask docs.
Notes
- at=foot(cliff)
- Gathers at the foot of that kind of thing:
cliff,wall,rockortree. Scattered at a cliff's foot, rocks take the cliff's rock: that is scree. - at=line
- Spreads along a drawn line, an edge or an edge path, within
reacheither side of it (default5dmm), to the ends of the line rounded.perSquarecounts the line's length in squares. It builds for rocks, flowers and trees alike:scatter at=road count=3 reach="3dmm" { tree top="$bottom + [26dmm .. 32dmm]" }. A single thing at a line is refused (a line has no one place on it); a scatter is how several stand along one. - trees
- A scatter of trees places every crown clear of the others (centres at least both crown radii and
gapapart, default1dmm), each trunk a crown radius in from the tile edge and clear of what already stands, then grows them one after another, each from its own seed. A tree is a heavy build: ask for few. If the crowns cannot all fit it is an error naming how many do, never fewer trees without a word. - count, perSquare
- Take a weighted range (of plain numbers):
perSquare="low(2..8, 3)". Each whole number of a range is as likely as any other. See weighted ranges. - inside a surface
- A scatter written inside
dirtorgrassis placed on that surface, in its area.
A scatter is a region of its own, its at= area (or the tile), and the things it places are its children: a tree in a scatter has the scatter, then the tile, as parents. A single thing never takes a count: tree count=3 is an error whose help says to use a scatter. See placement in the language guide.
Seen from the language
The guide pages that use scatter: The stack, Placement and scatter, Values and ranges, Weighted ranges, Names, Seeds, Worked tiles.
