skirmishMapBuilder.terrainBake: bakes a skirmish map's landscape into a `.terrainData`.
Tool code, run in edit mode after changing a map's layout; the map builders only reference the baked asset:
require("skirmishMapBuilder.terrainBake").bake(require("rtsSkirmishKit.maps.dunes").TERRAIN)
A spec describes the ground as a stack (later steps win):
base height of the whole rect before anything else (an island map starts under the sea)
relief { featureSize, amplitude } gentle rolling noise over everything
land { { x, z, r } ... } discs raised to `landHeight` (islands), `landJitter` roughens their shores
bars { { { x, z }, { x, z }, width, height } ... } walkable causeways (sandbars) drawn as bands
frame { inset, height, feather, jitter, featureSize, ridge } hills or dunes outside the battlefield
pads { { x, z, w, d } ... } flattened to 0 (bases, plazas)
ridges { { points = { { x, z } ... }, width, height } ... } raised impassable ridges inside the field
basins { { x, z, r, depth } ... } hollows (oasis pools, ponds)
surfaces top-first list of { name, albedo, normal, tiling, tint, rule = ... }; the last is the base cover.
rules: { kind = "curves", width, feather, jitter } (paths + base yards + mine yards),
{ kind = "lines", lines = { { { x, z } ... } ... }, width, feather, jitter } (bands of its own, e.g. woods),
{ kind = "slope", min }, { kind = "height", min?, max? }, { kind = "noise", min, featureSize },
{ kind = "base" }
paths, yards polylines { { x, z } ... } and discs { x, z, r } that the "curves" rule paints
lines(g: any, pts: { { number } }) → void
| arg | type | description |
|---|
| g | any | |
| pts | { { number } } | |
curveBand(g: any, r: any, name: string, curves: { any }, args: { [string]: any }) → any
| arg | type | description |
|---|
| g | any | |
| r | any | |
| name | string | |
| curves | { any } | |
| args | { [string]: any } | |
define(spec: { [string]: any }) → any
| arg | type | description |
|---|
| spec | { [string]: any } | |
addCover(args: { [string]: any }, curves: { any }?) → void
| arg | type | description |
|---|
| args | { [string]: any } | |
| curves | { any }? | |
band(name: string, args: { [string]: any }, curves: { any }?) → void
| arg | type | description |
|---|
| name | string | |
| args | { [string]: any } | |
| curves | { any }? | |
bake(spec: { [string]: any }) → any
Bake (or re-bake in place) a map's landscape from its TERRAIN spec. Returns the terrainData reference.
| arg | type | description |
|---|
| spec | { [string]: any } | |